QuadRotator performance, QaudMatrixTransformer should update orientation
This commit is contained in:
@@ -51,6 +51,11 @@ public class QuadRotator
|
|||||||
{
|
{
|
||||||
return quads; // This is the default orientation
|
return quads; // This is the default orientation
|
||||||
}
|
}
|
||||||
|
FacingToRotation rotation = getRotation( newForward, newUp );
|
||||||
|
if( rotation.isRedundant() )
|
||||||
|
{
|
||||||
|
return quads;
|
||||||
|
}
|
||||||
|
|
||||||
List<BakedQuad> result = new ArrayList<>( quads.size() );
|
List<BakedQuad> result = new ArrayList<>( quads.size() );
|
||||||
|
|
||||||
@@ -62,20 +67,12 @@ public class QuadRotator
|
|||||||
QuadMatrixTransformer transformer = pipeline.getElement( "transformer", QuadMatrixTransformer.class );
|
QuadMatrixTransformer transformer = pipeline.getElement( "transformer", QuadMatrixTransformer.class );
|
||||||
|
|
||||||
for( BakedQuad quad : quads )
|
for( BakedQuad quad : quads )
|
||||||
{
|
|
||||||
FacingToRotation rotation = getRotation( newForward, newUp );
|
|
||||||
if( rotation.isRedundant() )
|
|
||||||
{
|
|
||||||
result.add( quad );//Redundant rotation, just don't do anything.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
transformer.setMatrix( rotation.getMat() );
|
transformer.setMatrix( rotation.getMat() );
|
||||||
pipeline.prepare( collector );
|
pipeline.prepare( collector );
|
||||||
quad.pipe( pipeline );
|
quad.pipe( pipeline );
|
||||||
result.add( collector.bake() );
|
result.add( collector.bake() );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -21,6 +21,7 @@ package appeng.thirdparty.codechicken.lib.model.pipeline.transformers;
|
|||||||
|
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
import net.minecraft.client.renderer.Matrix4f;
|
||||||
import net.minecraft.client.renderer.Vector4f;
|
import net.minecraft.client.renderer.Vector4f;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||||
|
|
||||||
import appeng.thirdparty.codechicken.lib.model.Quad;
|
import appeng.thirdparty.codechicken.lib.model.Quad;
|
||||||
@@ -83,6 +84,8 @@ public class QuadMatrixTransformer extends QuadTransformer
|
|||||||
vertex.normal[1] = storage.getY();
|
vertex.normal[1] = storage.getY();
|
||||||
vertex.normal[2] = storage.getZ();
|
vertex.normal[2] = storage.getZ();
|
||||||
}
|
}
|
||||||
|
Quad.Vertex v0 = quad.vertices[0];
|
||||||
|
quad.orientation = Direction.getFacingFromVector( v0.normal[0], v0.normal[1], v0.normal[2] );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user