QuadRotator performance, QaudMatrixTransformer should update orientation

This commit is contained in:
covers1624
2020-06-03 20:53:49 +09:30
parent 1e2e34ac54
commit 64651feb3c
2 changed files with 12 additions and 12 deletions
@@ -51,6 +51,11 @@ public class QuadRotator
{
return quads; // This is the default orientation
}
FacingToRotation rotation = getRotation( newForward, newUp );
if( rotation.isRedundant() )
{
return quads;
}
List<BakedQuad> result = new ArrayList<>( quads.size() );
@@ -63,18 +68,10 @@ public class QuadRotator
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() );
pipeline.prepare( collector );
quad.pipe( pipeline );
result.add( collector.bake() );
}
transformer.setMatrix( rotation.getMat() );
pipeline.prepare( collector );
quad.pipe( pipeline );
result.add( collector.bake() );
}
return result;
@@ -21,6 +21,7 @@ package appeng.thirdparty.codechicken.lib.model.pipeline.transformers;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import appeng.thirdparty.codechicken.lib.model.Quad;
@@ -83,6 +84,8 @@ public class QuadMatrixTransformer extends QuadTransformer
vertex.normal[1] = storage.getY();
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;
}
}