Sfoglia il codice sorgente

Fixed ambient material term in Blender exporter.

alteredq 13 anni fa
parent
commit
345d252d98

+ 1 - 1
examples/obj/blenderscene/scene.Cube.js

@@ -21,7 +21,7 @@
 	"DbgIndex" : 0,
 	"DbgName" : "Material",
 	"blending" : "NormalBlending",
-	"colorAmbient" : [0.800000011920929, 0.12723851203918457, 0.15780764818191528],
+	"colorAmbient" : [0.6400000190734865, 0.10179081114814892, 0.126246120426746],
 	"colorDiffuse" : [0.6400000190734865, 0.10179081114814892, 0.126246120426746],
 	"colorSpecular" : [0.5, 0.5, 0.5],
 	"depthTest" : true,

+ 1 - 1
examples/obj/blenderscene/scene.Monkey.js

@@ -21,7 +21,7 @@
 	"DbgIndex" : 0,
 	"DbgName" : "Material.002",
 	"blending" : "NormalBlending",
-	"colorAmbient" : [0.800000011920929, 0.5512810349464417, 0.18124137818813324],
+	"colorAmbient" : [0.6400000190734865, 0.44102483452893537, 0.14499310471107218],
 	"colorDiffuse" : [0.6400000190734865, 0.44102483452893537, 0.14499310471107218],
 	"colorSpecular" : [0.5, 0.5, 0.5],
 	"depthTest" : true,

+ 1 - 1
examples/obj/blenderscene/scene.Plane.js

@@ -21,7 +21,7 @@
 	"DbgIndex" : 0,
 	"DbgName" : "Material.001",
 	"blending" : "NormalBlending",
-	"colorAmbient" : [0.18078184127807617, 0.800000011920929, 0.3067648708820343],
+	"colorAmbient" : [0.14462547517754842, 0.6400000190734865, 0.24541190036254967],
 	"colorDiffuse" : [0.14462547517754842, 0.6400000190734865, 0.24541190036254967],
 	"colorSpecular" : [0.5, 0.5, 0.5],
 	"depthTest" : true,

+ 6 - 6
utils/exporters/blender/2.63/scripts/addons/io_mesh_threejs/export_threejs.py

@@ -1127,9 +1127,9 @@ def extract_materials(mesh, scene, option_colors, option_copy_textures, filepath
                                          m.specular_intensity * m.specular_color[1],
                                          m.specular_intensity * m.specular_color[2]]
 
-            material['colorAmbient'] = [m.ambient * m.diffuse_color[0],
-                                        m.ambient * m.diffuse_color[1],
-                                        m.ambient * m.diffuse_color[2]]
+            material['colorAmbient'] = [m.ambient * material['colorDiffuse'][0],
+                                        m.ambient * material['colorDiffuse'][1],
+                                        m.ambient * material['colorDiffuse'][2]]
 
             material['transparency'] = m.alpha
 
@@ -1806,9 +1806,9 @@ def extract_material_data(m, option_colors):
                                  m.specular_intensity * m.specular_color[1],
                                  m.specular_intensity * m.specular_color[2]]
 
-    material['colorAmbient'] = [m.ambient * m.diffuse_color[0],
-                                m.ambient * m.diffuse_color[1],
-                                m.ambient * m.diffuse_color[2]]
+    material['colorAmbient'] = [m.ambient * material['colorDiffuse'][0],
+                                m.ambient * material['colorDiffuse'][1],
+                                m.ambient * material['colorDiffuse'][2]]
 
     material['transparency'] = m.alpha