Search in sources :

Example 1 with TubeLineRenderOrientation

use of logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation in project LogisticsPipes by RS485.

the class LineTubeRenderer method renderToList.

@Override
public void renderToList(CoreUnroutedPipe pipe, List<RenderEntry> objectsToRender) {
    if (pipe instanceof HSTubeLine) {
        HSTubeLine tube = (HSTubeLine) pipe;
        if (tube.getOrientation() != null) {
            TubeLineRenderOrientation speedupDirection = tube.getOrientation().getRenderOrientation();
            objectsToRender.addAll(LineTubeRenderer.tubeLineBase.get(speedupDirection).stream().map(model -> new RenderEntry(model, new I3DOperation[] { new LPUVTransformationList(new LPUVTranslation(0, 0)) }, LineTubeRenderer.TEXTURE)).collect(Collectors.toList()));
        }
    }
}
Also used : HSTubeLine(logisticspipes.pipes.tubes.HSTubeLine) TubeLineRenderOrientation(logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation) RenderEntry(logisticspipes.renderer.newpipe.RenderEntry) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation)

Example 2 with TubeLineRenderOrientation

use of logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation in project LogisticsPipes by RS485.

the class LineTubeRenderer method renderHighlight.

@Override
public void renderHighlight(ITubeOrientation orientation) {
    TubeLineRenderOrientation direction = (TubeLineRenderOrientation) orientation.getRenderOrientation();
    LineTubeRenderer.tubeLine.get(direction).copy().render(LPColourMultiplier.instance(0xFFFFFFFF));
}
Also used : TubeLineRenderOrientation(logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation)

Example 3 with TubeLineRenderOrientation

use of logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation in project LogisticsPipes by RS485.

the class LineTubeRenderer method loadModels.

public static void loadModels() {
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/HSTube-Line_result.obj"), 7, new LPScale(1 / 100f));
        // tubeTurnMounts
        for (TubeLineRenderOrientation turn : TubeLineRenderOrientation.values()) {
            LineTubeRenderer.tubeLineBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Side ") || entry.getKey().contains(" Side ") || entry.getKey().endsWith(" Side")).forEach(entry -> {
            LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.EAST_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))));
            LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.NORTH_SOUTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
        });
        if (LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.EAST_WEST).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Side. Only loaded " + LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.EAST_WEST).size());
        }
        for (TubeLineRenderOrientation turn : TubeLineRenderOrientation.values()) {
            LineTubeRenderer.tubeLine.put(turn, SimpleServiceLocator.cclProxy.combine(LineTubeRenderer.tubeLineBase.get(turn)));
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LogisticsNewRenderPipe(logisticspipes.renderer.newpipe.LogisticsNewRenderPipe) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) HSTubeLine(logisticspipes.pipes.tubes.HSTubeLine) LogisticsPipes(logisticspipes.LogisticsPipes) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) HashMap(java.util.HashMap) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) ArrayList(java.util.ArrayList) Objects(java.util.Objects) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) Map(java.util.Map) TubeLineRenderOrientation(logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation) ResourceLocation(net.minecraft.util.ResourceLocation) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) LPScale(logisticspipes.proxy.object3d.operation.LPScale) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) Collections(java.util.Collections) Nonnull(javax.annotation.Nonnull) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) TubeLineRenderOrientation(logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Aggregations

TubeLineRenderOrientation (logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation)3 HSTubeLine (logisticspipes.pipes.tubes.HSTubeLine)2 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Nonnull (javax.annotation.Nonnull)1 LogisticsPipes (logisticspipes.LogisticsPipes)1 ITubeOrientation (logisticspipes.interfaces.ITubeOrientation)1 CoreUnroutedPipe (logisticspipes.pipes.basic.CoreUnroutedPipe)1 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)1 I3DOperation (logisticspipes.proxy.object3d.interfaces.I3DOperation)1 IModel3D (logisticspipes.proxy.object3d.interfaces.IModel3D)1 LPColourMultiplier (logisticspipes.proxy.object3d.operation.LPColourMultiplier)1 LPRotation (logisticspipes.proxy.object3d.operation.LPRotation)1 LPScale (logisticspipes.proxy.object3d.operation.LPScale)1 LPTranslation (logisticspipes.proxy.object3d.operation.LPTranslation)1 IHighlightPlacementRenderer (logisticspipes.renderer.newpipe.IHighlightPlacementRenderer)1