mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Merge remote-tracking branch 'RB/679-gltf-map-support2' into 679-gltf-map-support2
This commit is contained in:
commit
39bdcba4ba
2 changed files with 14 additions and 22 deletions
|
@ -160,16 +160,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 );
|
||||
}
|
||||
|
@ -209,16 +204,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 );
|
||||
|
@ -300,16 +290,10 @@ void ProcessSceneNode( idMapEntity* newEntity, gltfNode* node, idMat4 trans, glt
|
|||
}
|
||||
#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( );
|
||||
|
@ -496,6 +480,9 @@ void idRenderModelGLTF::ProcessNode( gltfNode* modelNode, idMat4 trans, gltfData
|
|||
{
|
||||
ProcessNode( nodeList[child], curTrans, data );
|
||||
}
|
||||
|
||||
// derive mikktspace tangents from normals
|
||||
FinishSurfaces( true );
|
||||
}
|
||||
|
||||
//constructs a renderModel from a gltfScene node found in the "models" scene of the given gltfFile.
|
||||
|
@ -551,7 +538,6 @@ void idRenderModelGLTF::InitFromFile( const char* fileName )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if( surfaces.Num( ) <= 0 )
|
||||
{
|
||||
common->Warning( "Couldn't load model: '%s'", name.c_str( ) );
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue