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();
}
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);
}
Aggregations