4 def export_light(self, obj):
6 raise ValueError("Object {} is not a light".format(obj.name))
9 from .datafile import Resource, Statement, Token
10 light_res = Resource(light.name+".light", "light")
13 light_res.statements.append(Statement("type", Token("directional")))
14 light_res.statements.append(Statement("direction", *(-obj.matrix_world.col[2])[0:3]))
15 elif light.type=='POINT':
16 light_res.statements.append(Statement("type", Token("point")))
17 pos = obj.matrix_world@mathutils.Vector((0.0, 0.0, 0.0, 1.0))
18 light_res.statements.append(Statement("position", *obj.matrix_world.col[3][0:3]))
19 light_res.statements.append(Statement("attenuation", 1.0, 0.0, 1.0))
21 raise Exception("Can't export light {} of unknown type {}".format(light.name, light.type))
23 c = light.color*light.energy
24 light_res.statements.append(Statement("color", *tuple(c)))