use of logisticspipes.proxy.object3d.interfaces.IIconTransformation in project LogisticsPipes by RS485.
the class LogisticsNewRenderPipe method renderBoxWithDir.
public static void renderBoxWithDir(ForgeDirection dir) {
List<RenderEntry> objectsToRender = new ArrayList<>();
List<Edge> edgesToRender = new ArrayList<>(Arrays.asList(Edge.values()));
Map<Corner, Integer> connectionAtCorner = new HashMap<>();
for (Edge edge : Edge.values()) {
if (edge.part1 == dir || edge.part2 == dir) {
edgesToRender.remove(edge);
}
}
for (Corner corner : Corner.values()) {
if (corner.ew.dir == dir || corner.ns.dir == dir || corner.ud.dir == dir) {
if (!connectionAtCorner.containsKey(corner)) {
connectionAtCorner.put(corner, 1);
} else {
connectionAtCorner.put(corner, connectionAtCorner.get(corner) + 1);
}
}
}
for (Corner corner : Corner.values()) {
IIconTransformation cornerTexture = LogisticsNewRenderPipe.basicPipeTexture;
int count = connectionAtCorner.containsKey(corner) ? connectionAtCorner.get(corner) : 0;
if (count == 0) {
objectsToRender.addAll(LogisticsNewRenderPipe.corners_M.get(corner).stream().map(model -> new RenderEntry(model, new I3DOperation[] { cornerTexture })).collect(Collectors.toList()));
} else if (count == 1) {
for (PipeTurnCorner turn : PipeTurnCorner.values()) {
if (turn.corner != corner) {
continue;
}
if (turn.getPointer() == dir) {
objectsToRender.add(new RenderEntry(LogisticsNewRenderPipe.spacers.get(turn), new I3DOperation[] { cornerTexture }));
break;
}
}
} else if (count == 2) {
for (PipeTurnCorner turn : PipeTurnCorner.values()) {
if (turn.corner != corner) {
continue;
}
if (turn.getPointer() == dir) {
objectsToRender.add(new RenderEntry(LogisticsNewRenderPipe.corners_I.get(turn), new I3DOperation[] { cornerTexture }));
break;
}
}
} else if (count == 3) {
objectsToRender.addAll(LogisticsNewRenderPipe.corners_I3.get(corner).stream().map(model -> new RenderEntry(model, new I3DOperation[] { cornerTexture })).collect(Collectors.toList()));
}
}
objectsToRender.addAll(edgesToRender.stream().map(edge -> new RenderEntry(LogisticsNewRenderPipe.edges.get(edge), new I3DOperation[] { LogisticsNewRenderPipe.basicPipeTexture })).collect(Collectors.toList()));
for (RenderEntry model : objectsToRender) {
model.getModel().render(model.getOperations());
}
}
use of logisticspipes.proxy.object3d.interfaces.IIconTransformation in project LogisticsPipes by RS485.
the class LogisticsNewSolidBlockWorldRenderer method renderInventoryBlock.
public void renderInventoryBlock(Block block2, int metadata) {
//don't break other mods' guis when holding a pipe
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
//force transparency
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
Block block = LogisticsPipes.LogisticsPipeBlock;
Tessellator tess = Tessellator.instance;
BlockRotation rotation = BlockRotation.ZERO;
tess.startDrawingQuads();
IIconTransformation icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(metadata));
//Draw
LogisticsNewSolidBlockWorldRenderer.block.get(rotation).render(icon);
if (metadata != LogisticsSolidBlock.LOGISTICS_BLOCK_FRAME) {
for (CoverSides side : CoverSides.values()) {
LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side).get(rotation).render(icon);
}
}
tess.draw();
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
// nicely leave the rendering how it was
GL11.glPopAttrib();
}
Aggregations