[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1988] trunk/py/scripts/addons/ io_scene_x3d/export_x3d.py: minor change for writing lamp directions

Campbell Barton ideasman42 at gmail.com
Tue May 31 09:53:03 CEST 2011


Revision: 1988
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1988
Author:   campbellbarton
Date:     2011-05-31 07:53:03 +0000 (Tue, 31 May 2011)
Log Message:
-----------
minor change for writing lamp directions

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_x3d/export_x3d.py

Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-05-31 07:44:41 UTC (rev 1987)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-05-31 07:53:03 UTC (rev 1988)
@@ -73,7 +73,7 @@
     return tuple([max(min(c, 1.0), 0.0) for c in col])
 
 
-def matrix_direction(mtx):
+def matrix_direction_neg_z(mtx):
     return (mathutils.Vector((0.0, 0.0, -1.0)) * mtx.to_3x3()).normalized()[:]
 
 
@@ -181,7 +181,7 @@
         # beamWidth=((lamp.spotSize*math.pi)/180.0)*.37
         cutOffAngle = beamWidth * 1.3
 
-        dx, dy, dz = matrix_direction(mtx)
+        orientation = matrix_direction_neg_z(mtx)
 
         location = mtx.to_translation()[:]
 
@@ -194,7 +194,7 @@
         fw("color=\"%.4g %.4g %.4g\" " % clamp_color(lamp.color))
         fw("beamWidth=\"%.4g\" " % beamWidth)
         fw("cutOffAngle=\"%.4g\" " % cutOffAngle)
-        fw("direction=\"%.4g %.4g %.4g\" " % (dx, dy, dz))
+        fw("direction=\"%.4g %.4g %.4g\" " % orientation)
         fw("location=\"%.4g %.4g %.4g\" />\n" % location)
 
     def writeDirectionalLight(ident, ob, mtx, lamp, world):
@@ -208,12 +208,14 @@
             amb_intensity = 0.0
 
         intensity = min(lamp.energy / 1.75, 1.0)
-        dx, dy, dz = matrix_direction(mtx)
+
+        orientation = matrix_direction_neg_z(mtx)
+
         fw("%s<DirectionalLight DEF=\"%s\" " % (ident, safeName))
         fw("ambientIntensity=\"%.4g\" " % amb_intensity)
         fw("color=\"%.4g %.4g %.4g\" " % clamp_color(lamp.color))
         fw("intensity=\"%.4g\" " % intensity)
-        fw("direction=\"%.4g %.4g %.4g\" />\n" % (dx, dy, dz))
+        fw("direction=\"%.4g %.4g %.4g\" />\n" % orientation)
 
     def writePointLight(ident, ob, mtx, lamp, world):
 



More information about the Bf-extensions-cvs mailing list