Fix vertex transforms not being applied to techne face normals

This commit is contained in:
tterrag1098 committed 2015-08-04 01:38:45 -04:00
1 parent de86f78ec8
commit d1469af69d
2 files changed
+28 -1

No files matched your search

@@ -289,9 +289,20 @@ public class TechneUtil {
tv.add(0.5, 0, 0.5);
if(vt != null) {
vt.apply(v);
// TODO BLECH
if (vt instanceof VertexRotationFacing) {
normal = ((VertexRotationFacing) vt).rotate(normal);
}
if (vt instanceof VertexTransformComposite) {
for (VertexTransform xform : ((VertexTransformComposite) vt).xforms) {
if (xform instanceof VertexRotationFacing) {
normal = ((VertexRotationFacing) xform).rotate(normal);
}
}
}
}
if (isbrh) {
if(isbrh) {
int c = (int) (0xFF * RenderUtil.getColorMultiplierForFace(normal));
tes.setColorOpaque(c, c, c);
}
@@ -26,4 +26,20 @@ public class VertexRotationFacing extends VertexRotation {
setAngle(ROTATION_AMOUNT * 3);
}
}
public ForgeDirection rotate(ForgeDirection dir) {
if (dir.offsetY != 0) {
return dir;
}
if (getAngle() == ROTATION_AMOUNT) {
return dir.getRotation(ForgeDirection.DOWN);
}
if (getAngle() == ROTATION_AMOUNT * 2) {
return dir.getOpposite();
}
if (getAngle() == ROTATION_AMOUNT * 3) {
return dir.getRotation(ForgeDirection.UP);
}
return dir;
}
}