needs a lot of cleaning but lights are OK
[carveJwlIkooP6JGAAIwe30JlM.git] / blender_export.py
index ccad7bfcb04d001d45f56c083d8dc2f8b8d6262e..b60b2e02fc8cf14550c3f2ace276c11545c48bec 100644 (file)
@@ -807,22 +807,36 @@ class classtype_audio(Structure):
 
 # Classtype 200
 # 
-#  Purpose: point light
+#  Purpose: world light
 #
-class classtype_point_light(Structure):
+class classtype_world_light( Structure ):
 #{
    _pack_ = 1
-   _fields_ = [("colour",c_float*4)]
+   _fields_ = [("type",c_uint32),
+               ("colour",c_float*4),
+               ("angle",c_float)]
 
    def encode_obj(_, node, node_def):
    #{
       node.classtype = 200
 
-      data = node_def['obj'].data
+      obj  = node_def['obj']
+      data = obj.data
       _.colour[0] = data.color[0]
       _.colour[1] = data.color[1]
       _.colour[2] = data.color[2]
       _.colour[3] = data.energy
+
+      if obj.data.type == 'POINT':
+      #{
+         _.type = 0
+         _.angle = 0.0
+      #}
+      elif obj.data.type == 'SPOT':
+      #{
+         _.type = 1
+         _.angle = math.cos(data.spot_size*0.5)
+      #}
    #}
 
    @staticmethod
@@ -1907,8 +1921,7 @@ def encoder_process_definition( node_def ):
          obj_classtype = 'classtype_skeleton'
       elif obj_type == 'LIGHT':
       #{
-         if obj.data.type == 'POINT':
-            obj_classtype = 'classtype_point_light'
+         obj_classtype = 'classtype_world_light'
       #}
       else:
       #{