1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-30 09:07:55 +00:00

fix: ModelTransformer return old code, it was wrong get offset length

This commit is contained in:
Nikita Savyolov
2021-10-10 08:41:23 +03:00
parent 1395c877af
commit 9dcb9f9537

View File

@@ -64,24 +64,13 @@ public final class ModelTransformer
{
for( VertexFormatElement element : format.getElements() ) // For each vertex element
{
if( element.isPosition() &&
element.getDataType() == VertexFormatElement.DataType.FLOAT &&
element.getLength() == 3 ) // When we find a position element
int start = offsetBytes / Integer.BYTES;
if( element.getType() == VertexFormatElement.Type.POSITION && element.getDataType() == VertexFormatElement.DataType.FLOAT ) // When we find a position element
{
for ( int j = 0; j < 4; ++j ) // For each corner of the quad
{
int start = offsetBytes + j * format.getVertexSize();
if ( (start % 4) == 0 )
{
start = start / 4;
// Extract the position
Vector4f pos = new Vector4f(
Float.intBitsToFloat( vertexData[start] ),
Vector4f pos = new Vector4f( Float.intBitsToFloat( vertexData[start] ),
Float.intBitsToFloat( vertexData[start + 1] ),
Float.intBitsToFloat( vertexData[start + 2] ),
1
);
1 );
// Transform the position
pos.transform( transform );
@@ -91,9 +80,7 @@ public final class ModelTransformer
vertexData[start + 1] = Float.floatToRawIntBits( pos.getY() );
vertexData[start + 2] = Float.floatToRawIntBits( pos.getZ() );
}
}
}
offsetBytes += element.getLength();
offsetBytes += element.getByteLength();
}
}
return copy;