Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-31 11:53:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-31 11:53:03 +0400
commit49752195b705d006188a5608b957d3f47c789af1 (patch)
tree56e7de7652131220372c8c5ec31433f04b873117 /io_scene_x3d
parent31a9b97f60d10ba1787b344cf9a743af282c29b7 (diff)
minor change for writing lamp directions
Diffstat (limited to 'io_scene_x3d')
-rw-r--r--io_scene_x3d/export_x3d.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 8fe47cff..abb50b84 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -73,7 +73,7 @@ def clamp_color(col):
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 @@ def export(file,
# 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 @@ def export(file,
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 @@ def export(file,
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):