Merge branch 'RobertBeckebans:679-gltf-map-support2' into 679-gltf-map-support2

This commit is contained in:
HarrievG 2022-06-20 22:38:50 +02:00 committed by GitHub
commit e3d37473da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 22 deletions

View file

@ -159,16 +159,11 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p
}
idVec3 normal;
#if GLTF_YUP
// RB: proper glTF2 convention, requires Y-up export option ticked on in Blender
normal.x = vec.z;
normal.y = vec.x;
normal.z = vec.y;
#else
normal.x = vec.x;
normal.y = vec.y;
normal.z = vec.z;
#endif
normal *= axisTransform;
mesh->verts[i].SetNormal( normal );
}
@ -208,16 +203,11 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p
}
idVec3 tangent;
#if GLTF_YUP
// RB: proper glTF2 convention, requires Y-up export option ticked on in Blender
tangent.x = vec.z;
tangent.y = vec.x;
tangent.z = vec.y;
#else
tangent.x = vec.x;
tangent.y = vec.y;
tangent.z = vec.z;
#endif
tangent *= axisTransform;
mesh->verts[i].SetTangent( tangent );
@ -299,16 +289,10 @@ void ProcessSceneNode( idMapEntity* newEntity, gltfNode* node, idMat4& trans, gl
}
#endif
idVec3 origin;
#if GLTF_YUP
// RB: proper glTF2 convention, requires Y-up export option ticked on in Blender
origin.x = node->translation.z;
origin.y = node->translation.x;
origin.z = node->translation.y;
#else
origin.x = node->translation.x;
origin.y = node->translation.y;
origin.z = node->translation.z;
#endif
// files import as y-up. Use this transform to change the model to z-up.
idMat3 rotation = idAngles( 0.0f, 0.0f, 90.0f ).ToMat3( );
@ -551,7 +535,6 @@ void idRenderModelGLTF::InitFromFile( const char* fileName )
}
}
if( surfaces.Num( ) <= 0 )
{
common->Warning( "Couldn't load model: '%s'", name.c_str( ) );

View file

@ -125,6 +125,12 @@ objModel_t* OBJ_Parse( const char* fileName, const char* objFileBuffer, int leng
idStr line;
src.ReadRestOfLine( line );
}
else if( token == "l" )
{
// We don't support lines
idStr line;
src.ReadRestOfLine( line );
}
else if( token == "o" || token == "g" )
{
idStr line;