use of buildcraft.lib.client.render.laser.LaserData_BC8 in project BuildCraft by BuildCraft.
the class PathConnection method renderLaser.
@SideOnly(Side.CLIENT)
private static void renderLaser(Vec3d from, Vec3d to) {
Vec3d one = offset(from, to);
Vec3d two = offset(to, from);
LaserData_BC8 data = new LaserData_BC8(BuildCraftLaserManager.MARKER_PATH_CONNECTED, one, two, RENDER_SCALE);
LaserRenderer_BC8.renderLaserStatic(data);
}
use of buildcraft.lib.client.render.laser.LaserData_BC8 in project BuildCraft by BuildCraft.
the class RenderBuilder method renderTileEntityFast.
@Override
public void renderTileEntityFast(@Nonnull TileBuilder tile, double x, double y, double z, float partialTicks, int destroyStage, float partial, @Nonnull BufferBuilder buffer) {
Minecraft.getMinecraft().mcProfiler.startSection("bc");
Minecraft.getMinecraft().mcProfiler.startSection("builder");
buffer.setTranslation(x - tile.getPos().getX(), y - tile.getPos().getY(), z - tile.getPos().getZ());
Minecraft.getMinecraft().mcProfiler.startSection("box");
Box box = tile.getBox();
LaserBoxRenderer.renderLaserBoxDynamic(box, BuildCraftLaserManager.STRIPES_WRITE, buffer, true);
Minecraft.getMinecraft().mcProfiler.endStartSection("path");
List<BlockPos> path = tile.path;
if (path != null) {
BlockPos last = null;
for (BlockPos p : path) {
if (last != null) {
Vec3d from = new Vec3d(last).add(VecUtil.VEC_HALF);
Vec3d to = new Vec3d(p).add(VecUtil.VEC_HALF);
Vec3d one = offset(from, to);
Vec3d two = offset(to, from);
LaserData_BC8 data = new LaserData_BC8(BuildCraftLaserManager.STRIPES_WRITE_DIRECTION, one, two, 1 / 16.1);
LaserRenderer_BC8.renderLaserDynamic(data, buffer);
}
last = p;
}
}
Minecraft.getMinecraft().mcProfiler.endSection();
buffer.setTranslation(0, 0, 0);
if (tile.getBuilder() != null) {
RenderSnapshotBuilder.render(tile.getBuilder(), tile.getWorld(), tile.getPos(), x, y, z, partialTicks, buffer);
}
Minecraft.getMinecraft().mcProfiler.endSection();
Minecraft.getMinecraft().mcProfiler.endSection();
}
use of buildcraft.lib.client.render.laser.LaserData_BC8 in project BuildCraft by BuildCraft.
the class RenderTickListener method renderMapLocation.
private static void renderMapLocation(@Nonnull ItemStack stack) {
MapLocationType type = MapLocationType.getFromStack(stack);
if (type == MapLocationType.SPOT) {
EnumFacing face = ItemMapLocation.getPointFace(stack);
IBox box = ItemMapLocation.getPointBox(stack);
if (box != null) {
Vec3d[][] vectors = MAP_LOCATION_POINT[face.ordinal()];
GL11.glTranslated(box.min().getX(), box.min().getY(), box.min().getZ());
for (Vec3d[] vec : vectors) {
LaserData_BC8 laser = new LaserData_BC8(BuildCraftLaserManager.STRIPES_WRITE, vec[0], vec[1], 1 / 16.0);
LaserRenderer_BC8.renderLaserStatic(laser);
}
}
} else if (type == MapLocationType.AREA) {
IBox box = ItemMapLocation.getAreaBox(stack);
LAST_RENDERED_MAP_LOC.reset();
LAST_RENDERED_MAP_LOC.initialize(box);
LaserBoxRenderer.renderLaserBoxStatic(LAST_RENDERED_MAP_LOC, BuildCraftLaserManager.STRIPES_WRITE, true);
} else if (type == MapLocationType.PATH) {
List<BlockPos> path = BCCoreItems.mapLocation.getPath(stack);
if (path != null && path.size() > 1) {
BlockPos last = null;
for (BlockPos p : path) {
if (last == null) {
last = p;
}
}
}
// TODO!
} else if (type == MapLocationType.ZONE) {
// TODO!
}
}
use of buildcraft.lib.client.render.laser.LaserData_BC8 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 in project BuildCraft by BuildCraft.
the class RenderLaser method renderTileEntityFast.
@Override
public void renderTileEntityFast(@Nonnull TileLaser tile, double x, double y, double z, float partialTicks, int destroyStage, float partial, @Nonnull BufferBuilder buffer) {
if (BCSiliconConfig.renderLaserBeams || isPlayerWearingGoggles()) {
Minecraft.getMinecraft().mcProfiler.startSection("bc");
Minecraft.getMinecraft().mcProfiler.startSection("laser");
buffer.setTranslation(x - tile.getPos().getX(), y - tile.getPos().getY(), z - tile.getPos().getZ());
if (tile.laserPos != null) {
long avg = tile.getAverageClient();
if (avg > 200_000) {
avg += 200_000;
EnumFacing side = tile.getWorld().getBlockState(tile.getPos()).getValue(BuildCraftProperties.BLOCK_FACING_6);
Vec3d offset = new Vec3d(0.5, 0.5, 0.5).add(new Vec3d(side.getDirectionVec()).scale(4 / 16D));
int index = (int) (avg * MAX_POWER / tile.getMaxPowerPerTick());
if (index > MAX_POWER) {
index = MAX_POWER;
}
LaserData_BC8 laser = new LaserData_BC8(BuildCraftLaserManager.POWERS[index], new Vec3d(tile.getPos()).add(offset), tile.laserPos, 1 / 16D);
LaserRenderer_BC8.renderLaserDynamic(laser, buffer);
}
}
buffer.setTranslation(0, 0, 0);
Minecraft.getMinecraft().mcProfiler.endSection();
Minecraft.getMinecraft().mcProfiler.endSection();
}
}
Aggregations