fix: Use native GLTF material when mappingType is 'uv' to preserve exact original UV mappings and texture orientations
Build and Deploy / build-and-push (push) Successful in 44s
Build and Deploy / build-and-push (push) Successful in 44s
This commit is contained in:
@@ -58,7 +58,7 @@ const MeshMaterialManager = ({ mesh, sceneObj, textureCache }: MeshMaterialManag
|
||||
|
||||
activeMat.triplanarUniforms.uTriplanarScale.value = uvScale;
|
||||
activeMat.triplanarUniforms.uBlendSharpness.value = 5.0; // Default or from props
|
||||
} else {
|
||||
} else if (mappingType !== 'uv') {
|
||||
activeMat = MaterialFactory.getInstance().getStandardUVMaterial(
|
||||
baseParams,
|
||||
mesh.uuid
|
||||
@@ -71,6 +71,9 @@ const MeshMaterialManager = ({ mesh, sceneObj, textureCache }: MeshMaterialManag
|
||||
|
||||
activeMat.uvUniforms.uMappingMode.value = modeIndex;
|
||||
activeMat.updateUVTransform(uvOffset, [uvTiling[0] * uvScale, uvTiling[1] * uvScale], uvRotation * (Math.PI / 180));
|
||||
} else {
|
||||
// Use the native material to preserve exact GLTF UV behavior
|
||||
activeMat = origMat;
|
||||
}
|
||||
|
||||
// Apply basic props
|
||||
@@ -117,6 +120,14 @@ const MeshMaterialManager = ({ mesh, sceneObj, textureCache }: MeshMaterialManag
|
||||
if (mappingType === 'triplanar') activeMat.triplanarUniforms['t' + type.charAt(0).toUpperCase() + type.slice(1).replace('Map', '')].value = null;
|
||||
activeMat.needsUpdate = true;
|
||||
}
|
||||
|
||||
// Native UV mapping transforms
|
||||
if (mappingType === 'uv' && activeMat[type]) {
|
||||
activeMat[type].repeat.set(uvTiling[0] * uvScale, uvTiling[1] * uvScale);
|
||||
activeMat[type].offset.set(uvOffset[0], uvOffset[1]);
|
||||
activeMat[type].rotation = uvRotation * (Math.PI / 180);
|
||||
activeMat[type].needsUpdate = true;
|
||||
}
|
||||
});
|
||||
|
||||
mesh.visible = sceneObj.visible;
|
||||
|
||||
Reference in New Issue
Block a user