mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-01 10:07:56 +00:00
fix: ModelTransformer return old code, it was wrong get offset length
This commit is contained in:
@@ -64,24 +64,13 @@ public final class ModelTransformer
|
|||||||
{
|
{
|
||||||
for( VertexFormatElement element : format.getElements() ) // For each vertex element
|
for( VertexFormatElement element : format.getElements() ) // For each vertex element
|
||||||
{
|
{
|
||||||
if( element.isPosition() &&
|
int start = offsetBytes / Integer.BYTES;
|
||||||
element.getDataType() == VertexFormatElement.DataType.FLOAT &&
|
if( element.getType() == VertexFormatElement.Type.POSITION && element.getDataType() == VertexFormatElement.DataType.FLOAT ) // When we find a position element
|
||||||
element.getLength() == 3 ) // When we find a position element
|
|
||||||
{
|
{
|
||||||
for ( int j = 0; j < 4; ++j ) // For each corner of the quad
|
Vector4f pos = new Vector4f( Float.intBitsToFloat( vertexData[start] ),
|
||||||
{
|
|
||||||
int start = offsetBytes + j * format.getVertexSize();
|
|
||||||
if ( (start % 4) == 0 )
|
|
||||||
{
|
|
||||||
start = start / 4;
|
|
||||||
|
|
||||||
// Extract the position
|
|
||||||
Vector4f pos = new Vector4f(
|
|
||||||
Float.intBitsToFloat( vertexData[start] ),
|
|
||||||
Float.intBitsToFloat( vertexData[start + 1] ),
|
Float.intBitsToFloat( vertexData[start + 1] ),
|
||||||
Float.intBitsToFloat( vertexData[start + 2] ),
|
Float.intBitsToFloat( vertexData[start + 2] ),
|
||||||
1
|
1 );
|
||||||
);
|
|
||||||
|
|
||||||
// Transform the position
|
// Transform the position
|
||||||
pos.transform( transform );
|
pos.transform( transform );
|
||||||
@@ -91,9 +80,7 @@ public final class ModelTransformer
|
|||||||
vertexData[start + 1] = Float.floatToRawIntBits( pos.getY() );
|
vertexData[start + 1] = Float.floatToRawIntBits( pos.getY() );
|
||||||
vertexData[start + 2] = Float.floatToRawIntBits( pos.getZ() );
|
vertexData[start + 2] = Float.floatToRawIntBits( pos.getZ() );
|
||||||
}
|
}
|
||||||
}
|
offsetBytes += element.getByteLength();
|
||||||
}
|
|
||||||
offsetBytes += element.getLength();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
|
Reference in New Issue
Block a user