@@ -1365,22 +1365,22 @@ void* UnityPrepareRendererResources::prepareInMainThread(
13651365 *pModelMetadata);
13661366 }
13671367 }
1368-
1369- if (tilesetComponent.generateTangents ()) {
1370- for (size_t i = 0 ; i < meshes.Length (); ++i) {
1371- const UnityEngine::Mesh& mesh = meshes[i];
1372- if (mesh.tangents ().Length () == 0 ) {
1373- const bool useTempVertexNormals = mesh.normals ().Length () == 0 ;
1374- if (useTempVertexNormals) {
1375- mesh.RecalculateNormals ();
1376- }
1377- mesh.RecalculateTangents ();
1378- if (useTempVertexNormals) {
1379- mesh.normals (System::Array1<::DotNet::UnityEngine::Vector3>(nullptr ));
1380- }
1381- }
1382- }
1383- }
1368+ //
1369+ // if (tilesetComponent.generateTangents()) {
1370+ // for (size_t i = 0; i < meshes.Length(); ++i) {
1371+ // const UnityEngine::Mesh& mesh = meshes[i];
1372+ // if (mesh.tangents().Length() == 0) {
1373+ // const bool useTempVertexNormals = mesh.normals().Length() == 0;
1374+ // if (useTempVertexNormals) {
1375+ // mesh.RecalculateNormals();
1376+ // }
1377+ // mesh.RecalculateTangents();
1378+ // if (useTempVertexNormals) {
1379+ // mesh.normals(System::Array1<::DotNet::UnityEngine::Vector3>(nullptr));
1380+ // }
1381+ // }
1382+ // }
1383+ // }
13841384
13851385 model.forEachPrimitiveInScene (
13861386 -1 ,
@@ -1456,6 +1456,21 @@ void* UnityPrepareRendererResources::prepareInMainThread(
14561456 primitiveGameObject.AddComponent <UnityEngine::MeshRenderer>();
14571457
14581458
1459+ if (tilesetComponent.generateTangents ()) {
1460+ for (size_t i = 0 ; i < meshes.Length (); ++i) {
1461+ if (unityMesh.tangents ().Length () == 0 ) {
1462+ const bool useTempVertexNormals = unityMesh.normals ().Length () == 0 ;
1463+ if (useTempVertexNormals) {
1464+ unityMesh.RecalculateNormals ();
1465+ }
1466+ unityMesh.RecalculateTangents ();
1467+ if (useTempVertexNormals) {
1468+ unityMesh.normals (System::Array1<::DotNet::UnityEngine::Vector3>(nullptr ));
1469+ }
1470+ }
1471+ }
1472+ }
1473+
14591474 const Material* pMaterial =
14601475 Model::getSafe (&gltf.materials , primitive.material );
14611476
0 commit comments