Browse Source

USDZExporter: Fixed inputs:scale handling.

Mr.doob 2 years ago
parent
commit
cea7a35b35
1 changed files with 7 additions and 1 deletions
  1. 7 1
      examples/jsm/exporters/USDZExporter.js

+ 7 - 1
examples/jsm/exporters/USDZExporter.js

@@ -504,7 +504,7 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
             uniform token info:id = "UsdUVTexture"
             uniform token info:id = "UsdUVTexture"
             asset inputs:file = @textures/Texture_${ id }.png@
             asset inputs:file = @textures/Texture_${ id }.png@
             float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
             float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
-            float4 inputs:scale = (${ color.r }, ${ color.g }, ${ color.b }, 1)
+            ${ color !== undefined ? 'float4 inputs:scale = ' + buildColor4( color ) : '' }
             token inputs:sourceColorSpace = "${ texture.colorSpace === THREE.NoColorSpace ? 'raw' : 'sRGB' }"
             token inputs:sourceColorSpace = "${ texture.colorSpace === THREE.NoColorSpace ? 'raw' : 'sRGB' }"
             token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }"
             token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }"
             token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }"
             token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }"
@@ -646,6 +646,12 @@ function buildColor( color ) {
 
 
 }
 }
 
 
+function buildColor4( color ) {
+
+	return `(${ color.r }, ${ color.g }, ${ color.b }, 1.0)`;
+
+}
+
 function buildVector2( vector ) {
 function buildVector2( vector ) {
 
 
 	return `(${ vector.x }, ${ vector.y })`;
 	return `(${ vector.x }, ${ vector.y })`;