Added sun lamp exporting to PsychoBlend.

Psychopath does not yet use this info, however.
This commit is contained in:
Nathan Vegdahl 2017-02-06 16:06:55 -08:00
parent 0e8d708ff0
commit c3f3599c09

View File

@ -198,6 +198,11 @@ class PsychoExporter:
self.w.unindent(); self.w.unindent();
self.w.write("}\n") self.w.write("}\n")
# Infinite light sources
for ob in self.scene.objects:
if ob.type == 'LAMP' and ob.data.type == 'SUN':
self.export_world_distant_disk_lamp(ob, "")
# World section end # World section end
self.w.unindent() self.w.unindent()
self.w.write("}\n") self.w.write("}\n")
@ -433,3 +438,30 @@ class PsychoExporter:
return name return name
def export_world_distant_disk_lamp(self, ob, group_prefix):
name = group_prefix + "__" + escape_name(ob.name)
# Collect data over time
time_dir = []
time_col = []
time_rad = []
for i in range(self.time_samples):
self.set_frame(self.fr, self.shutter_start + (self.shutter_diff*i))
time_dir += [tuple(ob.matrix_world * Vector((0, 0, -1)))]
time_col += [ob.data.color * ob.data.energy]
time_rad += [ob.data.shadow_soft_size]
# Write out sphere light
self.w.write("DistantDiskLight $%s {\n" % name)
self.w.indent()
for direc in time_dir:
self.w.write("Direction [%f %f %f]\n" % (direc[0], direc[1], direc[2]))
for col in time_col:
self.w.write("Color [%f %f %f]\n" % (col[0], col[1], col[2]))
for rad in time_rad:
self.w.write("Radius [%f]\n" % rad)
self.w.unindent()
self.w.write("}\n")
return name