From 42583670378abe9c4bce2f3dbf9fc4cc3e423b4c Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Tue, 16 Aug 2022 20:35:52 +0200 Subject: [PATCH] Fixed glTF2 bounding box calculation if GPU skinning is used --- neo/idlib/MapFile_gltf.cpp | 4 ++-- neo/renderer/Model_gltf.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/neo/idlib/MapFile_gltf.cpp b/neo/idlib/MapFile_gltf.cpp index e0b72323..2f6a9103 100644 --- a/neo/idlib/MapFile_gltf.cpp +++ b/neo/idlib/MapFile_gltf.cpp @@ -239,7 +239,7 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p { uint16_t vec[4]; - assert( sizeof( vec ) == (attrAcc->typeSize * 4) ); + assert( sizeof( vec ) == ( attrAcc->typeSize * 4 ) ); for( int i = 0; i < attrAcc->count; i++ ) { @@ -263,7 +263,7 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p uint8_t vec[4]; for( int i = 0; i < attrAcc->count; i++ ) { - assert( sizeof( vec ) == (attrAcc->typeSize * 4) ); + assert( sizeof( vec ) == ( attrAcc->typeSize * 4 ) ); bin.Read( ( void* )( &vec[0] ), attrAcc->typeSize ); bin.Read( ( void* )( &vec[1] ), attrAcc->typeSize ); diff --git a/neo/renderer/Model_gltf.cpp b/neo/renderer/Model_gltf.cpp index e45df578..2cf6bc6a 100644 --- a/neo/renderer/Model_gltf.cpp +++ b/neo/renderer/Model_gltf.cpp @@ -1261,7 +1261,7 @@ idList TransformVertsAndTangents_GLTF( idDrawVert* targetVerts, const int n for( int j = 0; j < 4; j++ ) { - jointIds.AddUnique( base.color[0] ); + jointIds.AddUnique( base.color[j] ); } const float w0 = base.color2[0] * ( 1.0f / 255.0f ); @@ -1355,7 +1355,7 @@ void idRenderModelGLTF::UpdateSurface( const struct renderEntity_s* ent, const i __m128 maxX = vector_float_negInfinity; __m128 maxY = vector_float_negInfinity; __m128 maxZ = vector_float_negInfinity; - for( int i = 0; i < jointIds.Num(); i++ ) + for( int i = 0; i < md5joints.Num(); i++ ) { const idJointMat& joint = entJoints[i]; __m128 x = _mm_load_ps( joint.ToFloatPtr() + 0 * 4 );