Search in sources :

Example 1 with IModel3D

use of logisticspipes.proxy.object3d.interfaces.IModel3D in project LogisticsPipes by RS485.

the class LogisticsNewRenderPipe method renderDestruction.

public static void renderDestruction(CoreUnroutedPipe pipe, World worldObj, int x, int y, int z, EffectRenderer effectRenderer) {
    if (pipe.container != null && pipe.container.renderState != null && pipe.container.renderState.cachedRenderer != null) {
        for (RenderEntry entry : pipe.container.renderState.cachedRenderer) {
            IModel3D model = entry.getModel().twoFacedCopy();
            IBounds bounds = model.bounds();
            double xMid = (bounds.min().x() + bounds.max().x()) / 2;
            double yMid = (bounds.min().y() + bounds.max().y()) / 2;
            double zMid = (bounds.min().z() + bounds.max().z()) / 2;
            model.apply(new LPTranslation(-xMid, -yMid, -zMid));
            effectRenderer.addEffect(new EntityModelFX(worldObj, x + xMid, y + yMid, z + zMid, model, entry.getOperations(), entry.getTexture()));
        }
    }
}
Also used : IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) IBounds(logisticspipes.proxy.object3d.interfaces.IBounds) EntityModelFX(logisticspipes.pipefxhandlers.EntityModelFX)

Example 2 with IModel3D

use of logisticspipes.proxy.object3d.interfaces.IModel3D in project LogisticsPipes by RS485.

the class LogisticsNewRenderPipe method loadModels.

public static void loadModels() {
    if (!SimpleServiceLocator.cclProxy.isActivated())
        return;
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/PipeModel_moved.obj"), 7, new LPScale(1 / 100f));
        List<IModel3D> highlightList = new ArrayList<>();
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            LogisticsNewRenderPipe.sideNormal.put(dir, new ArrayList<>());
            String grp = "Side_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.sideNormal.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.sideNormal.get(dir).size() != 4) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideNormal.get(dir).size());
            }
        }
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            LogisticsNewRenderPipe.sideBC.put(dir, new ArrayList<>());
            String grp = "Side_BC_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.sideBC.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.sideBC.get(dir).size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideBC.get(dir).size());
            }
        }
        for (Edge edge : Edge.values()) {
            String grp;
            if (edge.part1 == ForgeDirection.UP || edge.part1 == ForgeDirection.DOWN) {
                grp = "Edge_M_" + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part1) + "_" + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part2);
            } else {
                grp = "Edge_M_S_" + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part1) + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part2);
            }
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.edges.put(edge, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.edges.get(edge) == null) {
                throw new RuntimeException("Couldn't load " + edge.name() + " (" + grp + ")");
            }
            highlightList.add(LogisticsNewRenderPipe.edges.get(edge));
        }
        for (Corner corner : Corner.values()) {
            LogisticsNewRenderPipe.corners_M.put(corner, new ArrayList<>());
            String grp = "Corner_M_" + corner.ud.s + "_" + corner.ns.s + corner.ew.s;
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.corners_M.get(corner).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.corners_M.get(corner).size() != 2) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.corners_M.get(corner).size());
            }
            highlightList.addAll(LogisticsNewRenderPipe.corners_M.get(corner));
        }
        for (Corner corner : Corner.values()) {
            LogisticsNewRenderPipe.corners_I3.put(corner, new ArrayList<>());
            String grp = "Corner_I3_" + corner.ud.s + "_" + corner.ns.s + corner.ew.s;
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.corners_I3.get(corner).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.corners_I3.get(corner).size() != 2) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.corners_I3.get(corner).size());
            }
        }
        for (PipeSupport support : PipeSupport.values()) {
            String grp = "Support_" + LogisticsNewRenderPipe.getDirAsString_Type1(support.dir) + "_" + support.ori.s;
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.supports.put(support, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.supports.get(support) == null) {
                throw new RuntimeException("Couldn't load " + support.name() + " (" + grp + ")");
            }
        }
        for (PipeTurnCorner corner : PipeTurnCorner.values()) {
            String grp = "Corner_I_" + corner.corner.ud.s + "_" + corner.corner.ns.s + corner.corner.ew.s;
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp)) {
                    char c = ' ';
                    if (!entry.getKey().endsWith(" " + grp)) {
                        c = entry.getKey().charAt(entry.getKey().indexOf(" " + grp) + (" " + grp).length());
                    }
                    if (Character.isDigit(c)) {
                        if (c == '2') {
                            if (corner.turn != Turn.NORTH_SOUTH) {
                                continue;
                            }
                        } else if (c == '1') {
                            if (corner.turn != Turn.EAST_WEST) {
                                continue;
                            }
                        } else {
                            throw new UnsupportedOperationException();
                        }
                    } else {
                        if (corner.turn != Turn.UP_DOWN) {
                            continue;
                        }
                    }
                    LogisticsNewRenderPipe.corners_I.put(corner, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.corners_I.get(corner) == null) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + ")");
            }
        }
        for (PipeTurnCorner corner : PipeTurnCorner.values()) {
            String grp = "Spacer" + corner.number;
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.spacers.put(corner, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.spacers.get(corner) == null) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + ")");
            }
        }
        for (PipeMount mount : PipeMount.values()) {
            String grp = "Mount_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.dir) + "_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.side);
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.mounts.put(mount, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.mounts.get(mount) == null) {
                throw new RuntimeException("Couldn't load " + mount.name() + " (" + grp + ")");
            }
        }
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            LogisticsNewRenderPipe.texturePlate_Inner.put(dir, new ArrayList<>());
            String grp = "Inner_Plate_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.texturePlate_Inner.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.texturePlate_Inner.get(dir).size() != 2) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.texturePlate_Inner.get(dir).size());
            }
        }
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            LogisticsNewRenderPipe.texturePlate_Outer.put(dir, new ArrayList<>());
            String grp = "Texture_Plate_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.texturePlate_Outer.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)).apply(new LPTranslation(-0.5, -0.5, -0.5)).apply(new LPScale(1.001D)).apply(new LPTranslation(0.5, 0.5, 0.5)))));
            if (LogisticsNewRenderPipe.texturePlate_Outer.get(dir).size() != 2) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.texturePlate_Outer.get(dir).size());
            }
        }
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            LogisticsNewRenderPipe.sideTexturePlate.put(dir, new Quartet<>(new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>()));
            String grp = "Texture_Side_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp)) {
                    IModel3D model = LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)));
                    double sizeA = (model.bounds().max().x() - model.bounds().min().x()) + (model.bounds().max().y() - model.bounds().min().y()) + (model.bounds().max().z() - model.bounds().min().z());
                    double dis = Math.pow(model.bounds().min().x() - 0.5D, 2) + Math.pow(model.bounds().min().y() - 0.5D, 2) + Math.pow(model.bounds().min().z() - 0.5D, 2);
                    if (sizeA < 0.5D) {
                        if ((dis > 0.22 && dis < 0.24) || (dis > 0.38 && dis < 0.40)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue4().add(model);
                        } else if ((dis < 0.2 && dis > 0.18) || (dis < 0.36 && dis > 0.34)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue2().add(model);
                        } else {
                            throw new UnsupportedOperationException("Dis: " + dis);
                        }
                    } else {
                        if ((dis > 0.22 && dis < 0.24) || (dis > 0.38 && dis < 0.40)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue3().add(model);
                        } else if ((dis < 0.2 && dis > 0.18) || (dis < 0.36 && dis > 0.34)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue1().add(model);
                        } else {
                            throw new UnsupportedOperationException("Dis: " + dis);
                        }
                    }
                }
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue1().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue1().size());
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue2().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue2().size());
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue3().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue3().size());
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue4().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue4().size());
            }
        }
        for (PipeMount mount : PipeMount.values()) {
            LogisticsNewRenderPipe.textureConnectorPlate.put(mount, new ArrayList<>());
            String grp = "Texture_Connector_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.dir) + "_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.side);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.textureConnectorPlate.get(mount).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.textureConnectorPlate.get(mount).size() != 4) {
                throw new RuntimeException("Couldn't load " + mount.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.textureConnectorPlate.get(mount).size());
            }
        }
        highlight = SimpleServiceLocator.cclProxy.combine(highlightList);
        pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/PipeModel_Transport_Box.obj"), 7, new LPScale(1 / 100f));
        LogisticsNewRenderPipe.innerTransportBox = LogisticsNewRenderPipe.compute(pipePartModels.get("InnerTransportBox").backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)).apply(new LPTranslation(-0.5, -0.5, -0.5)).apply(new LPScale(0.99D)).apply(new LPTranslation(0.5, 0.5, 0.5)));
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : java.util(java.util) IVec3(logisticspipes.proxy.object3d.interfaces.IVec3) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) Textures(logisticspipes.textures.Textures) LogisticsPipes(logisticspipes.LogisticsPipes) IIconTransformation(logisticspipes.proxy.object3d.interfaces.IIconTransformation) Quartet(logisticspipes.utils.tuples.Quartet) logisticspipes.proxy.object3d.operation(logisticspipes.proxy.object3d.operation) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) IBounds(logisticspipes.proxy.object3d.interfaces.IBounds) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) GL11(org.lwjgl.opengl.GL11) LPConstants(logisticspipes.LPConstants) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) IIconRegister(net.minecraft.client.renderer.texture.IIconRegister) EffectRenderer(net.minecraft.client.particle.EffectRenderer) World(net.minecraft.world.World) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) CoordinateUtils(network.rs485.logisticspipes.world.CoordinateUtils) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Collectors(java.util.stream.Collectors) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) Entry(java.util.Map.Entry) ResourceLocation(net.minecraft.util.ResourceLocation) Data(lombok.Data) TileEntity(net.minecraft.tileentity.TileEntity) PlayerConfig(logisticspipes.config.PlayerConfig) PipeRenderState(logisticspipes.renderer.state.PipeRenderState) AllArgsConstructor(lombok.AllArgsConstructor) EntityModelFX(logisticspipes.pipefxhandlers.EntityModelFX) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) LogisticsPipes(logisticspipes.LogisticsPipes)

Example 3 with IModel3D

use of logisticspipes.proxy.object3d.interfaces.IModel3D in project LogisticsPipes by RS485.

the class LogisticsNewSolidBlockWorldRenderer method computeRotated.

private static Map<BlockRotation, IModel3D> computeRotated(IModel3D m) {
    m.apply(new LPUVScale(1, 0.75));
    Map<BlockRotation, IModel3D> map = new HashMap<>();
    for (BlockRotation rot : BlockRotation.values()) {
        IModel3D model = m.copy();
        switch(rot.getInteger()) {
            case 0:
                model.apply(LPRotation.sideOrientation(0, 3));
                model.apply(new LPTranslation(0, 0, 1));
                break;
            case 1:
                model.apply(LPRotation.sideOrientation(0, 1));
                model.apply(new LPTranslation(1, 0, 0));
                break;
            case 2:
                break;
            case 3:
                model.apply(LPRotation.sideOrientation(0, 2));
                model.apply(new LPTranslation(1, 0, 1));
                break;
        }
        model.computeNormals();
        model.computeStandardLighting();
        map.put(rot, model);
    }
    return map;
}
Also used : LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPUVScale(logisticspipes.proxy.object3d.operation.LPUVScale) HashMap(java.util.HashMap)

Example 4 with IModel3D

use of logisticspipes.proxy.object3d.interfaces.IModel3D in project LogisticsPipes by RS485.

the class CurveTubeRenderer method loadModels.

public static void loadModels() {
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/HSTube-Turn_result.obj"), 7, new LPScale(1 / 100f));
        //tubeTurnMounts
        for (TurnDirection turn : TurnDirection.values()) {
            CurveTubeRenderer.tubeTurnBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Lane ") || entry.getKey().contains(" Lane ") || entry.getKey().endsWith(" Lane")).forEach(entry -> {
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.SOUTH_WEST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 0.0)).apply(new LPRotation(-Math.PI / 2, 0, 1, 0))));
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.EAST_SOUTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.NORTH_EAST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 1.0)).apply(new LPRotation(Math.PI / 2, 0, 1, 0))));
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.WEST_NORTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 0.0)).apply(new LPRotation(Math.PI, 0, 1, 0))));
        });
        if (CurveTubeRenderer.tubeTurnBase.get(TurnDirection.NORTH_EAST).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Lanes. Only loaded " + CurveTubeRenderer.tubeTurnBase.get(TurnDirection.NORTH_EAST).size());
        }
        for (TurnDirection turn : TurnDirection.values()) {
            CurveTubeRenderer.tubeCurve.put(turn, SimpleServiceLocator.cclProxy.combine(CurveTubeRenderer.tubeTurnBase.get(turn)));
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LogisticsNewRenderPipe(logisticspipes.renderer.newpipe.LogisticsNewRenderPipe) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LogisticsPipes(logisticspipes.LogisticsPipes) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) HashMap(java.util.HashMap) LPUVTranslation(logisticspipes.proxy.object3d.operation.LPUVTranslation) LPUVTransformationList(logisticspipes.proxy.object3d.operation.LPUVTransformationList) ArrayList(java.util.ArrayList) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) Map(java.util.Map) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) HSTubeCurve(logisticspipes.pipes.tubes.HSTubeCurve) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) Collectors(java.util.stream.Collectors) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) RenderEntry(logisticspipes.renderer.newpipe.RenderEntry) Pair(logisticspipes.utils.tuples.Pair) Entry(java.util.Map.Entry) ResourceLocation(net.minecraft.util.ResourceLocation) TurnDirection(logisticspipes.pipes.tubes.HSTubeCurve.TurnDirection) LPScale(logisticspipes.proxy.object3d.operation.LPScale) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) TurnDirection(logisticspipes.pipes.tubes.HSTubeCurve.TurnDirection) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Example 5 with IModel3D

use of logisticspipes.proxy.object3d.interfaces.IModel3D in project LogisticsPipes by RS485.

the class GainTubeRenderer method loadModels.

public static void loadModels() {
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/HSTube-Gain_result.obj"), 7, new LPScale(1 / 100f));
        //tubeTurnMounts
        for (TubeGainRenderOrientation turn : TubeGainRenderOrientation.values()) {
            GainTubeRenderer.tubeTurnBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Lane ") || entry.getKey().contains(" Lane ") || entry.getKey().endsWith(" Lane")).forEach(entry -> {
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.EAST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 0.0)).apply(new LPRotation(-Math.PI / 2, 0, 1, 0))));
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.NORTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.WEST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 1.0)).apply(new LPRotation(Math.PI / 2, 0, 1, 0))));
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.SOUTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 0.0)).apply(new LPRotation(Math.PI, 0, 1, 0))));
        });
        if (GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.NORTH).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Lanes. Only loaded " + GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.NORTH).size());
        }
        for (TubeGainRenderOrientation turn : TubeGainRenderOrientation.values()) {
            GainTubeRenderer.tubeGain.put(turn, SimpleServiceLocator.cclProxy.combine(GainTubeRenderer.tubeTurnBase.get(turn)));
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LogisticsNewRenderPipe(logisticspipes.renderer.newpipe.LogisticsNewRenderPipe) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LogisticsPipes(logisticspipes.LogisticsPipes) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) HashMap(java.util.HashMap) LPUVTranslation(logisticspipes.proxy.object3d.operation.LPUVTranslation) LPUVTransformationList(logisticspipes.proxy.object3d.operation.LPUVTransformationList) ArrayList(java.util.ArrayList) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) Map(java.util.Map) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) IBounds(logisticspipes.proxy.object3d.interfaces.IBounds) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) AxisAlignedBB(net.minecraft.util.AxisAlignedBB) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) Collectors(java.util.stream.Collectors) TubeGainRenderOrientation(logisticspipes.pipes.tubes.HSTubeGain.TubeGainRenderOrientation) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) HSTubeGain(logisticspipes.pipes.tubes.HSTubeGain) RenderEntry(logisticspipes.renderer.newpipe.RenderEntry) Pair(logisticspipes.utils.tuples.Pair) ResourceLocation(net.minecraft.util.ResourceLocation) LPScale(logisticspipes.proxy.object3d.operation.LPScale) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale) TubeGainRenderOrientation(logisticspipes.pipes.tubes.HSTubeGain.TubeGainRenderOrientation)

Aggregations

IModel3D (logisticspipes.proxy.object3d.interfaces.IModel3D)13 I3DOperation (logisticspipes.proxy.object3d.interfaces.I3DOperation)8 HashMap (java.util.HashMap)7 LogisticsPipes (logisticspipes.LogisticsPipes)7 CoreUnroutedPipe (logisticspipes.pipes.basic.CoreUnroutedPipe)7 IBounds (logisticspipes.proxy.object3d.interfaces.IBounds)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 Map (java.util.Map)6 Collectors (java.util.stream.Collectors)6 ITubeOrientation (logisticspipes.interfaces.ITubeOrientation)6 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 LPScale (logisticspipes.proxy.object3d.operation.LPScale)5 LPTranslation (logisticspipes.proxy.object3d.operation.LPTranslation)5 IHighlightPlacementRenderer (logisticspipes.renderer.newpipe.IHighlightPlacementRenderer)5 ISpecialPipeRenderer (logisticspipes.renderer.newpipe.ISpecialPipeRenderer)5 LogisticsNewRenderPipe (logisticspipes.renderer.newpipe.LogisticsNewRenderPipe)5 RenderEntry (logisticspipes.renderer.newpipe.RenderEntry)5 Entry (java.util.Map.Entry)4