mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 04:09:43 +00:00
Fixed up rendering of combustion gen and vat.
This commit is contained in:
1 parent
e78c2fffe6
commit
e5cd70f905
16 files changed
+89
-101
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package crazypants.enderio.farm;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -15,6 +14,7 @@ import crazypants.render.RenderUtil;
|
||||
import crazypants.render.VertexTransform;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
public class FarmingStationRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@@ -38,16 +38,9 @@ public class FarmingStationRenderer implements ISimpleBlockRenderingHandler {
|
||||
textures[4] = EnderIO.blockFarmStation.getIcon(3, 0);
|
||||
textures[5] = EnderIO.blockFarmStation.getIcon(3, 0);
|
||||
|
||||
Tessellator.instance.setBrightness(15 << 20 | 15 << 4);
|
||||
float b = 1;
|
||||
if(world != null) {
|
||||
b = RenderUtil.claculateTotalBrightnessForLocation(Minecraft.getMinecraft().theWorld, x, y, z);
|
||||
}
|
||||
|
||||
float[] cols = new float[6];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
float m = RenderUtil.getColorMultiplierForFace(ForgeDirection.values()[i]);
|
||||
cols[i] = b * m;
|
||||
cols[i] = RenderUtil.getColorMultiplierForFace(ForgeDirection.values()[i]);
|
||||
}
|
||||
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE;
|
||||
@@ -56,7 +49,7 @@ public class FarmingStationRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
float scale = 0.7f;
|
||||
float width = 0.4f;
|
||||
float trans = (1 - scale)/2;
|
||||
float trans = (1 - scale) / 2;
|
||||
bb = BoundingBox.UNIT_CUBE.scale(1, scale, width);
|
||||
bb = bb.translate(0, -trans, 0);
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
@@ -71,12 +64,11 @@ public class FarmingStationRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
float topWidth = 0.15f;
|
||||
bb = BoundingBox.UNIT_CUBE.scale(1, topWidth, 1);
|
||||
bb = bb.translate(0, 0.2f + topWidth/2f, 0);
|
||||
bb = bb.translate(0, 0.2f + topWidth / 2f, 0);
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
CubeRenderer.render(bb, textures, null, cols);
|
||||
Tessellator.instance.addTranslation(-x, -y, -z);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,6 +97,11 @@ public class FarmingStationRenderer implements ISimpleBlockRenderingHandler {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vertex vertex) {
|
||||
apply(vertex.xyz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3d vec) {
|
||||
if(vec.y > 0.9) {
|
||||
|
||||
@@ -4,18 +4,13 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IAdvancedTooltipProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag);
|
||||
|
||||
|
||||
|
||||
+10
-7
@@ -35,12 +35,14 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
|
||||
|
||||
private OverlayRenderer overlayRenderer = new OverlayRenderer();
|
||||
|
||||
private FacingVertexTransform vt = new FacingVertexTransform();
|
||||
|
||||
private TileCombustionGenerator gen;
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
|
||||
short facing = 3;
|
||||
short facing = (short)ForgeDirection.EAST.ordinal();
|
||||
boolean active = false;
|
||||
if(world != null) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
@@ -61,7 +63,8 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
|
||||
//middle chunk
|
||||
bb = BoundingBox.UNIT_CUBE;
|
||||
bb = bb.scale(1, 0.34, 1);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, facing);
|
||||
vt.setFacing(facing);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt);
|
||||
|
||||
scaleX = facing != 4 && facing != 5;
|
||||
scx = scaleX ? 0.7f : 1;
|
||||
@@ -71,18 +74,18 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
|
||||
bb = BoundingBox.UNIT_CUBE;
|
||||
bb = bb.scale(scx, 0.21, scz);
|
||||
bb = bb.translate(0, 0.26f, 0);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, facing);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt);
|
||||
|
||||
|
||||
//lower 1/3
|
||||
bb = BoundingBox.UNIT_CUBE;
|
||||
bb = bb.scale(scx, 0.21, scz);
|
||||
bb = bb.translate(0, -0.26f, 0);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, facing);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt);
|
||||
|
||||
//top / bottom connectors
|
||||
bb = BoundingBox.UNIT_CUBE.scale(0.35, 1, 0.35);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, facing);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt);
|
||||
|
||||
//tanks
|
||||
float size = 0.64f;
|
||||
@@ -96,10 +99,10 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
|
||||
bb = bb.translate(tx, 0, tz);
|
||||
|
||||
IIcon tex = EnderIO.blockFusedQuartz.getDefaultFrameIcon(0);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, facing, tex);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt, tex);
|
||||
|
||||
bb = bb.translate(-tx * 2, 0, -tz * 2);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, facing, tex);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt,tex);
|
||||
|
||||
if(gen != null) {
|
||||
ccr.renderBlock(world, block, x, y, z, overlayRenderer);
|
||||
|
||||
@@ -3,6 +3,7 @@ package crazypants.enderio.machine.generator;
|
||||
import crazypants.render.VertexTransform;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
class FacingVertexTransform implements VertexTransform {
|
||||
|
||||
@@ -16,6 +17,11 @@ class FacingVertexTransform implements VertexTransform {
|
||||
transX = facing != 4 && facing != 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vertex vertex) {
|
||||
apply(vertex.xyz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3d vec) {
|
||||
if(vec.y > 0.8 || vec.y < 0.2) {
|
||||
@@ -29,10 +35,6 @@ class FacingVertexTransform implements VertexTransform {
|
||||
vec.z += 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
// vec.y -= 0.5;
|
||||
// vec.y *= 0.8;
|
||||
// vec.y += 0.5;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ import crazypants.render.CustomCubeRenderer;
|
||||
import crazypants.render.CustomRenderBlocks;
|
||||
import crazypants.render.IRenderFace;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.render.VertexTransform;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
@@ -19,32 +20,26 @@ public class TranslatedCubeRenderer {
|
||||
|
||||
public static TranslatedCubeRenderer instance = new TranslatedCubeRenderer();
|
||||
|
||||
private FaceRenderer faceRenderer = new FaceRenderer();
|
||||
private XFormRenderer xformRenderer = new XFormRenderer();
|
||||
|
||||
private CustomCubeRenderer ccr = new CustomCubeRenderer();
|
||||
|
||||
public void renderBoundingBox(int x, int y, int z, Block block, BoundingBox bb, int facing) {
|
||||
// block.setBlockBounds(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
|
||||
// faceRenderer.xform.setFacing(facing);
|
||||
// ccr.renderBlock(Minecraft.getMinecraft().theWorld, block, x, y, z, faceRenderer);
|
||||
// block.setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
renderBoundingBox(x, y, z, block, bb, facing, null);
|
||||
public void renderBoundingBox(int x, int y, int z, Block block, BoundingBox bb, VertexTransform vt) {
|
||||
renderBoundingBox(x, y, z, block, bb, vt, null);
|
||||
}
|
||||
|
||||
public void renderBoundingBox(int x, int y, int z, Block block, BoundingBox bb, int facing, IIcon overrideTexture) {
|
||||
public void renderBoundingBox(int x, int y, int z, Block block, BoundingBox bb, VertexTransform vt, IIcon overrideTexture) {
|
||||
block.setBlockBounds(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
|
||||
|
||||
faceRenderer.xform.setFacing(facing);
|
||||
|
||||
xformRenderer.xform = vt;
|
||||
ccr.setOverrideTexture(overrideTexture);
|
||||
ccr.renderBlock(Minecraft.getMinecraft().theWorld, block, x, y, z, faceRenderer);
|
||||
ccr.renderBlock(Minecraft.getMinecraft().theWorld, block, x, y, z, xformRenderer);
|
||||
ccr.setOverrideTexture(null);
|
||||
block.setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
|
||||
private class FaceRenderer implements IRenderFace {
|
||||
private class XFormRenderer implements IRenderFace {
|
||||
|
||||
public FacingVertexTransform xform = new FacingVertexTransform();
|
||||
public VertexTransform xform;
|
||||
|
||||
@Override
|
||||
public void renderFace(CustomRenderBlocks rb, ForgeDirection face, Block par1Block, double x, double y, double z, IIcon texture, List<Vertex> refVertices,
|
||||
@@ -53,7 +48,7 @@ public class TranslatedCubeRenderer {
|
||||
Vector3d xyz = new Vector3d(x,y,z);
|
||||
for (Vertex v : refVertices) {
|
||||
v.xyz.sub(xyz);
|
||||
xform.apply(v.xyz);
|
||||
xform.apply(v);
|
||||
}
|
||||
}
|
||||
Tessellator.instance.addTranslation((float)x, (float)y, (float)z);
|
||||
|
||||
@@ -35,6 +35,7 @@ public class BlockVat extends AbstractMachineBlock<TileVat> {
|
||||
|
||||
protected IIcon onIcon;
|
||||
protected IIcon topIcon;
|
||||
protected IIcon blockIconSingle;
|
||||
|
||||
public BlockVat() {
|
||||
super(ModObject.blockVat, TileVat.class);
|
||||
@@ -43,7 +44,10 @@ public class BlockVat extends AbstractMachineBlock<TileVat> {
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iIconRegister) {
|
||||
blockIcon = iIconRegister.registerIcon("enderio:vatFront");
|
||||
blockIconSingle = iIconRegister.registerIcon("enderio:vatFrontSingle");
|
||||
onIcon = iIconRegister.registerIcon("enderio:vatFrontOn");
|
||||
|
||||
|
||||
topIcon = iIconRegister.registerIcon("enderio:vatTop");
|
||||
|
||||
overlayIconPull = iIconRegister.registerIcon("enderio:vatOverlayPull");
|
||||
@@ -53,6 +57,11 @@ public class BlockVat extends AbstractMachineBlock<TileVat> {
|
||||
overlayIconNone = iIconRegister.registerIcon("enderio:machineOverlayNone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) {
|
||||
// used to render the block in the world
|
||||
@@ -65,6 +74,8 @@ public class BlockVat extends AbstractMachineBlock<TileVat> {
|
||||
|
||||
if(blockSide == ForgeDirection.UP.ordinal() || blockSide == ForgeDirection.DOWN.ordinal()) {
|
||||
return topIcon;
|
||||
} else if(blockSide == ForgeDirection.EAST.ordinal() || blockSide == ForgeDirection.WEST.ordinal()) {
|
||||
return blockIconSingle;
|
||||
}
|
||||
|
||||
if(on) {
|
||||
@@ -74,6 +85,8 @@ public class BlockVat extends AbstractMachineBlock<TileVat> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int blockSide, int blockMeta) {
|
||||
if(blockSide == ForgeDirection.UP.ordinal() || blockSide == ForgeDirection.DOWN.ordinal()) {
|
||||
|
||||
@@ -3,23 +3,23 @@ package crazypants.enderio.machine.still;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.generator.TranslatedCubeRenderer;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.CubeRenderer;
|
||||
import crazypants.render.CustomCubeRenderer;
|
||||
import crazypants.render.CustomRenderBlocks;
|
||||
import crazypants.render.IRenderFace;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.render.VertexTransform;
|
||||
import crazypants.util.ForgeDirectionOffsets;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
@@ -52,52 +52,19 @@ public class VatRenderer implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IIcon[] textures = new IIcon[6];
|
||||
if(world != null) {
|
||||
textures[0] = EnderIO.blockVat.getIcon(world, x, y, z, ForgeDirection.NORTH.ordinal());
|
||||
textures[1] = EnderIO.blockVat.getIcon(world, x, y, z, ForgeDirection.NORTH.ordinal());
|
||||
textures[2] = EnderIO.blockVat.getIcon(world, x, y, z, ForgeDirection.UP.ordinal());
|
||||
textures[3] = EnderIO.blockVat.getIcon(world, x, y, z, ForgeDirection.DOWN.ordinal());
|
||||
textures[4] = EnderIO.blockVat.getIcon(world, x, y, z, ForgeDirection.NORTH.ordinal());
|
||||
textures[5] = EnderIO.blockVat.getIcon(world, x, y, z, ForgeDirection.NORTH.ordinal());
|
||||
} else {
|
||||
textures[0] = EnderIO.blockVat.getIcon(3, 0);
|
||||
textures[1] = EnderIO.blockVat.getIcon(3, 0);
|
||||
textures[2] = EnderIO.blockVat.getIcon(1, 0);
|
||||
textures[3] = EnderIO.blockVat.getIcon(0, 0);
|
||||
textures[4] = EnderIO.blockVat.getIcon(3, 0);
|
||||
textures[5] = EnderIO.blockVat.getIcon(3, 0);
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness(15 << 20 | 15 << 4);
|
||||
float b = 1;
|
||||
if(world != null) {
|
||||
b = RenderUtil.claculateTotalBrightnessForLocation(Minecraft.getMinecraft().theWorld, x, y, z);
|
||||
}
|
||||
|
||||
float[] cols = new float[6];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
float m = RenderUtil.getColorMultiplierForFace(ForgeDirection.values()[i]);
|
||||
cols[i] = b * m;
|
||||
}
|
||||
|
||||
float fudge = 1f;
|
||||
|
||||
//-x side
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.333, fudge,fudge);
|
||||
bb = bb.translate(0.5f - (0.333f/2),0,0);
|
||||
xform.set(x, y, z);
|
||||
CubeRenderer.render(bb, textures, xform, cols);
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.334, fudge,fudge);
|
||||
bb = bb.translate(0.5f - (0.334f/2),0,0);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, xform);
|
||||
|
||||
bb = BoundingBox.UNIT_CUBE.scale(0.4, fudge,fudge);
|
||||
xform.set(x, y, z);
|
||||
CubeRenderer.render(bb, textures, xform, cols);
|
||||
bb = BoundingBox.UNIT_CUBE.scale(0.334, fudge,fudge);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, xform);
|
||||
|
||||
bb = BoundingBox.UNIT_CUBE.scale(0.333, fudge,fudge);
|
||||
bb = bb.translate(-0.5f + (0.333f/2),0,0);
|
||||
xform.set(x, y, z);
|
||||
CubeRenderer.render(bb, textures, xform, cols);
|
||||
bb = BoundingBox.UNIT_CUBE.scale(0.334, fudge,fudge);
|
||||
bb = bb.translate(-0.5f + (0.334f/2),0,0);
|
||||
TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, xform);
|
||||
|
||||
if(vat != null) {
|
||||
ccr.renderBlock(world, block, x, y, z, overlayRenderer);
|
||||
@@ -116,9 +83,11 @@ public class VatRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
Tessellator tes = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
tes.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
tes.draw();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,28 +97,21 @@ public class VatRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private static class VertXForm implements VertexTransform {
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public VertXForm() {
|
||||
}
|
||||
|
||||
void set(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@Override
|
||||
public void apply(Vertex vertex) {
|
||||
apply(vertex.xyz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3d vec) {
|
||||
if(vec.x > 0.9 || vec.x < 0.1) {
|
||||
|
||||
vec.z -= 0.5;
|
||||
vec.z *= 0.4;
|
||||
vec.z *= 0.42;
|
||||
vec.z += 0.5;
|
||||
}
|
||||
vec.add(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,7 +135,6 @@ public class VatRenderer implements ISimpleBlockRenderingHandler {
|
||||
if(tex != null) {
|
||||
ccr.getCustomRenderBlocks().doDefaultRenderFace(face,par1Block,x,y,z, tex);
|
||||
}
|
||||
|
||||
Tessellator.instance.addTranslation(-(float)offset.x, -(float)offset.y, -(float)offset.z);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package crazypants.render;
|
||||
import crazypants.vecmath.Quat4d;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
public class VertexRotation implements VertexTransform {
|
||||
|
||||
@@ -18,6 +19,11 @@ public class VertexRotation implements VertexTransform {
|
||||
quat = Quat4d.makeRotate(angle, axis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vertex vertex) {
|
||||
apply(vertex.xyz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3d vec) {
|
||||
vec.sub(center);
|
||||
|
||||
@@ -2,9 +2,12 @@ package crazypants.render;
|
||||
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
public interface VertexTransform {
|
||||
|
||||
public abstract void apply(Vertex vertex);
|
||||
|
||||
public abstract void apply(Vector3d vec);
|
||||
|
||||
public abstract void applyToNormal(Vector3f vec);
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Collection;
|
||||
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
public class VertexTransformComposite implements VertexTransform {
|
||||
|
||||
@@ -22,12 +23,18 @@ public class VertexTransformComposite implements VertexTransform {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vertex vertex) {
|
||||
for (VertexTransform xform : xforms) {
|
||||
xform.apply(vertex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3d vec) {
|
||||
for (VertexTransform xform : xforms) {
|
||||
xform.apply(vec);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package crazypants.render;
|
||||
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
public class VertexTranslation implements VertexTransform {
|
||||
|
||||
@@ -29,6 +30,11 @@ public class VertexTranslation implements VertexTransform {
|
||||
this(trans.x, trans.y, trans.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vertex vertex) {
|
||||
apply(vertex.xyz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3d vec) {
|
||||
vec.x += x;
|
||||
|
||||
Reference in new issue
Block a user