Search in sources :

Example 1 with LaserType

use of buildcraft.lib.client.render.laser.LaserData_BC8.LaserType in project BuildCraft by BuildCraft.

the class RenderTickListener method renderMarkerCache.

private static void renderMarkerCache(EntityPlayer player, MarkerSubCache<?> cache) {
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;
    profiler.startSection("compute");
    Set<LaserData_BC8> toRender = new HashSet<>();
    for (final BlockPos a : cache.getAllMarkers()) {
        for (final BlockPos b : cache.getValidConnections(a)) {
            if (a.toLong() > b.toLong()) {
                // Only render each pair once
                continue;
            }
            Vec3d start = VecUtil.convertCenter(a);
            Vec3d end = VecUtil.convertCenter(b);
            Vec3d startToEnd = end.subtract(start).normalize();
            Vec3d endToStart = start.subtract(end).normalize();
            start = start.add(VecUtil.scale(startToEnd, 0.125));
            end = end.add(VecUtil.scale(endToStart, 0.125));
            LaserType laserType = cache.getPossibleLaserType();
            if (laserType == null || isLookingAt(a, b, player)) {
                laserType = BuildCraftLaserManager.MARKER_DEFAULT_POSSIBLE;
            }
            LaserData_BC8 data = new LaserData_BC8(laserType, start, end, 1 / 16.0);
            toRender.add(data);
        }
    }
    profiler.endStartSection("render");
    for (LaserData_BC8 laser : toRender) {
        LaserRenderer_BC8.renderLaserStatic(laser);
    }
    profiler.endSection();
}
Also used : LaserType(buildcraft.lib.client.render.laser.LaserData_BC8.LaserType) Profiler(net.minecraft.profiler.Profiler) BlockPos(net.minecraft.util.math.BlockPos) LaserData_BC8(buildcraft.lib.client.render.laser.LaserData_BC8) Vec3d(net.minecraft.util.math.Vec3d) HashSet(java.util.HashSet)

Example 2 with LaserType

use of buildcraft.lib.client.render.laser.LaserData_BC8.LaserType in project BuildCraft by BuildCraft.

the class RenderTube method renderTileEntityFast.

@Override
public void renderTileEntityFast(@Nonnull TileMiner tile, double x, double y, double z, float partialTicks, int destroyStage, float partial, @Nonnull BufferBuilder buffer) {
    if (tile.isComplete()) {
        return;
    }
    double tubeY = tile.getPos().getY() - tile.getLength(partialTicks);
    BlockPos from = tile.getPos();
    buffer.setTranslation(x - from.getX(), y - from.getY(), z - from.getZ());
    Vec3d start = new Vec3d(from.getX() + 0.5, from.getY(), from.getZ() + 0.5);
    Vec3d end = new Vec3d(from.getX() + 0.5, tubeY, from.getZ() + 0.5);
    LaserData_BC8 data = new LaserData_BC8(laserType, start, end, 1 / 16.0);
    LaserRenderer_BC8.renderLaserDynamic(data, buffer);
    buffer.setTranslation(0, 0, 0);
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) LaserData_BC8(buildcraft.lib.client.render.laser.LaserData_BC8) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

LaserData_BC8 (buildcraft.lib.client.render.laser.LaserData_BC8)2 BlockPos (net.minecraft.util.math.BlockPos)2 Vec3d (net.minecraft.util.math.Vec3d)2 LaserType (buildcraft.lib.client.render.laser.LaserData_BC8.LaserType)1 HashSet (java.util.HashSet)1 Profiler (net.minecraft.profiler.Profiler)1