Temporary fix for quad rotator.
This commit is contained in:
@@ -21,10 +21,7 @@ package appeng.client.render;
|
|||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
import net.minecraft.client.renderer.*;
|
||||||
import net.minecraft.client.renderer.Quaternion;
|
|
||||||
import net.minecraft.client.renderer.Vector3f;
|
|
||||||
import net.minecraft.client.renderer.Vector4f;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ package appeng.client.render.cablebus;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.Matrix4f;
|
||||||
|
import net.minecraft.client.renderer.Vector3f;
|
||||||
import net.minecraft.client.renderer.model.BakedQuad;
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
@@ -64,11 +66,18 @@ public class QuadRotator
|
|||||||
Quad collector = collectors.get();
|
Quad collector = collectors.get();
|
||||||
QuadMatrixTransformer transformer = pipeline.getElement( "transformer", QuadMatrixTransformer.class );
|
QuadMatrixTransformer transformer = pipeline.getElement( "transformer", QuadMatrixTransformer.class );
|
||||||
|
|
||||||
|
// FIXME: Temporary rotation fix
|
||||||
|
Matrix4f mat = new Matrix4f();
|
||||||
|
mat.setTranslation(-0.5f, -0.5f, -0.5f);
|
||||||
|
mat.multiplyBackward(rotation.getMat());
|
||||||
|
mat.translate(new Vector3f(0.5f, 0.5f, 0.5f));
|
||||||
|
|
||||||
for( BakedQuad quad : quads )
|
for( BakedQuad quad : quads )
|
||||||
{
|
{
|
||||||
pipeline.reset( format );
|
pipeline.reset( format );
|
||||||
collector.reset( format );
|
collector.reset( format );
|
||||||
transformer.setMatrix( rotation.getMat() );
|
|
||||||
|
transformer.setMatrix( mat );
|
||||||
pipeline.prepare( collector );
|
pipeline.prepare( collector );
|
||||||
quad.pipe( pipeline );
|
quad.pipe( pipeline );
|
||||||
result.add( collector.bake() );
|
result.add( collector.bake() );
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import appeng.items.parts.ColoredPartItem;
|
|||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.parts.AEBasePart;
|
import appeng.parts.AEBasePart;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
@@ -53,9 +52,6 @@ import java.util.EnumSet;
|
|||||||
public class PartCable extends AEBasePart implements IPartCable
|
public class PartCable extends AEBasePart implements IPartCable
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final ImmutableSet<AEPartLocation> STRAIGHT_PART_LOCATIONS = ImmutableSet.of( AEPartLocation.DOWN, AEPartLocation.NORTH,
|
|
||||||
AEPartLocation.EAST );
|
|
||||||
|
|
||||||
private final int[] channelsOnSide = { 0, 0, 0, 0, 0, 0 };
|
private final int[] channelsOnSide = { 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
private EnumSet<AEPartLocation> connections = EnumSet.noneOf( AEPartLocation.class );
|
private EnumSet<AEPartLocation> connections = EnumSet.noneOf( AEPartLocation.class );
|
||||||
|
|||||||
+5
-2
@@ -45,6 +45,7 @@ public class QuadMatrixTransformer extends QuadTransformer
|
|||||||
|
|
||||||
private final Vector4f storage = new Vector4f();
|
private final Vector4f storage = new Vector4f();
|
||||||
private Matrix4f matrix;
|
private Matrix4f matrix;
|
||||||
|
private boolean identityMatrix;
|
||||||
|
|
||||||
QuadMatrixTransformer()
|
QuadMatrixTransformer()
|
||||||
{
|
{
|
||||||
@@ -55,17 +56,19 @@ public class QuadMatrixTransformer extends QuadTransformer
|
|||||||
{
|
{
|
||||||
super( parent );
|
super( parent );
|
||||||
this.matrix = matrix;
|
this.matrix = matrix;
|
||||||
|
this.identityMatrix = matrix.equals( identity );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMatrix( Matrix4f matrix )
|
public void setMatrix( Matrix4f matrix )
|
||||||
{
|
{
|
||||||
this.matrix = matrix;
|
this.matrix = matrix;
|
||||||
|
this.identityMatrix = matrix.equals( identity );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean transform()
|
public boolean transform()
|
||||||
{
|
{
|
||||||
if( matrix.equals( identity ) )
|
if( identityMatrix )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -77,7 +80,7 @@ public class QuadMatrixTransformer extends QuadTransformer
|
|||||||
vertex.vec[1] = storage.getY();
|
vertex.vec[1] = storage.getY();
|
||||||
vertex.vec[2] = storage.getZ();
|
vertex.vec[2] = storage.getZ();
|
||||||
|
|
||||||
storage.set( vertex.normal[0], vertex.normal[1], vertex.normal[2], 1 );
|
storage.set( vertex.normal[0], vertex.normal[1], vertex.normal[2], 0 );
|
||||||
storage.transform( matrix );
|
storage.transform( matrix );
|
||||||
storage.normalize();
|
storage.normalize();
|
||||||
vertex.normal[0] = storage.getX();
|
vertex.normal[0] = storage.getX();
|
||||||
|
|||||||
Reference in New Issue
Block a user