Search in sources :

Example 11 with Point3f

use of javax.vecmath.Point3f in project BuildCraft by BuildCraft.

the class MutableVertex method transform.

public MutableVertex transform(Matrix4f matrix) {
    Point3f point = positionvf();
    matrix.transform(point);
    positionv(point);
    Vector3f normal = normal();
    matrix.transform(normal);
    normalv(normal);
    return this;
}
Also used : Point3f(javax.vecmath.Point3f) Vector3f(javax.vecmath.Vector3f)

Example 12 with Point3f

use of javax.vecmath.Point3f in project BuildCraft by BuildCraft.

the class RenderSnapshotBuilder method render.

public static <T extends ITileForSnapshotBuilder> void render(SnapshotBuilder<T> snapshotBuilder, World world, BlockPos tilePos, double x, double y, double z, float partialTicks, BufferBuilder bb) {
    for (SnapshotBuilder<T>.PlaceTask placeTask : snapshotBuilder.clientPlaceTasks) {
        Vec3d prevPos = snapshotBuilder.prevClientPlaceTasks.stream().filter(renderTaskLocal -> renderTaskLocal.pos.equals(placeTask.pos)).map(snapshotBuilder::getPlaceTaskItemPos).findFirst().orElse(snapshotBuilder.getPlaceTaskItemPos(snapshotBuilder.new PlaceTask(tilePos, Collections.emptyList(), 0L)));
        Vec3d pos = prevPos.add(snapshotBuilder.getPlaceTaskItemPos(placeTask).subtract(prevPos).scale(partialTicks));
        for (ItemStack item : placeTask.items) {
            ItemRenderUtil.renderItemStack(x - tilePos.getX() + pos.x, y - tilePos.getY() + pos.y, z - tilePos.getZ() + pos.z, item, world.getCombinedLight(new BlockPos(pos), 0), EnumFacing.SOUTH, bb);
        }
        ItemRenderUtil.endItemBatch();
    }
    Vec3d robotPos = snapshotBuilder.robotPos;
    if (robotPos != null) {
        if (snapshotBuilder.prevRobotPos != null) {
            robotPos = snapshotBuilder.prevRobotPos.add(robotPos.subtract(snapshotBuilder.prevRobotPos).scale(partialTicks));
        }
        bb.setTranslation(x - tilePos.getX(), y - tilePos.getY(), z - tilePos.getZ());
        int i = 0;
        for (EnumFacing face : EnumFacing.VALUES) {
            ModelUtil.createFace(face, new Point3f((float) robotPos.x, (float) robotPos.y, (float) robotPos.z), new Point3f(4 / 16F, 4 / 16F, 4 / 16F), new ModelUtil.UvFaceData(BCBuildersSprites.ROBOT.getInterpU((i * 8) / 64D), BCBuildersSprites.ROBOT.getInterpV(0 / 64D), BCBuildersSprites.ROBOT.getInterpU(((i + 1) * 8) / 64D), BCBuildersSprites.ROBOT.getInterpV(8 / 64D))).lighti(world.getCombinedLight(new BlockPos(robotPos), 0)).render(bb);
            i++;
        }
        for (SnapshotBuilder.BreakTask breakTask : snapshotBuilder.clientBreakTasks) {
            LaserRenderer_BC8.renderLaserDynamic(new LaserData_BC8(BuildCraftLaserManager.POWERS[(int) Math.round(MathUtil.clamp(breakTask.power * 1D / breakTask.getTarget(), 0D, 1D) * (BuildCraftLaserManager.POWERS.length - 1))], robotPos.subtract(new Vec3d(0, 0.27, 0)), new Vec3d(breakTask.pos).add(VecUtil.VEC_HALF), 1 / 16D), bb);
        }
    }
    bb.setTranslation(0, 0, 0);
}
Also used : ModelUtil(buildcraft.lib.client.model.ModelUtil) World(net.minecraft.world.World) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) LaserData_BC8(buildcraft.lib.client.render.laser.LaserData_BC8) EnumFacing(net.minecraft.util.EnumFacing) BCBuildersSprites(buildcraft.builders.BCBuildersSprites) BlockPos(net.minecraft.util.math.BlockPos) LaserRenderer_BC8(buildcraft.lib.client.render.laser.LaserRenderer_BC8) BuildCraftLaserManager(buildcraft.core.client.BuildCraftLaserManager) Point3f(javax.vecmath.Point3f) ItemStack(net.minecraft.item.ItemStack) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) ITileForSnapshotBuilder(buildcraft.builders.snapshot.ITileForSnapshotBuilder) ItemRenderUtil(buildcraft.lib.client.render.ItemRenderUtil) MathUtil(buildcraft.lib.misc.MathUtil) VecUtil(buildcraft.lib.misc.VecUtil) SnapshotBuilder(buildcraft.builders.snapshot.SnapshotBuilder) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Collections(java.util.Collections) ITileForSnapshotBuilder(buildcraft.builders.snapshot.ITileForSnapshotBuilder) SnapshotBuilder(buildcraft.builders.snapshot.SnapshotBuilder) EnumFacing(net.minecraft.util.EnumFacing) LaserData_BC8(buildcraft.lib.client.render.laser.LaserData_BC8) Vec3d(net.minecraft.util.math.Vec3d) ModelUtil(buildcraft.lib.client.model.ModelUtil) Point3f(javax.vecmath.Point3f) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Point3f (javax.vecmath.Point3f)12 ArrayList (java.util.ArrayList)2 Matrix4f (javax.vecmath.Matrix4f)2 Vector3f (javax.vecmath.Vector3f)2 EnumFacing (net.minecraft.util.EnumFacing)2 StructureDataInterface (org.rcsb.mmtf.api.StructureDataInterface)2 AdapterToStructureData (org.rcsb.mmtf.encoder.AdapterToStructureData)2 Tuple2 (scala.Tuple2)2 BCBuildersSprites (buildcraft.builders.BCBuildersSprites)1 ITileForSnapshotBuilder (buildcraft.builders.snapshot.ITileForSnapshotBuilder)1 SnapshotBuilder (buildcraft.builders.snapshot.SnapshotBuilder)1 BuildCraftLaserManager (buildcraft.core.client.BuildCraftLaserManager)1 ModelUtil (buildcraft.lib.client.model.ModelUtil)1 UvFaceData (buildcraft.lib.client.model.ModelUtil.UvFaceData)1 MutableQuad (buildcraft.lib.client.model.MutableQuad)1 ItemRenderUtil (buildcraft.lib.client.render.ItemRenderUtil)1 LaserData_BC8 (buildcraft.lib.client.render.laser.LaserData_BC8)1 LaserRenderer_BC8 (buildcraft.lib.client.render.laser.LaserRenderer_BC8)1 MathUtil (buildcraft.lib.misc.MathUtil)1 VecUtil (buildcraft.lib.misc.VecUtil)1