- ss = Statement("step", "", "content")
- ss.sub.append(Statement("depth_test", Token("LEQUAL")))
- ss.sub.append(seq_res.create_reference_statement("lighting", resources[scene.name+".lightn"]))
- ss.sub.append(seq_res.create_reference_statement("scene", resources[scene.name+".scene"]))
- seq_res.statements.append(ss)
+ scene_res = resources[scene.name+".scene"]
+ lighting_res = resources[scene.name+".lightn"]
+
+ any_opaque = False
+ any_blended = False
+ s = scene
+ while s:
+ if s.instances:
+ any_opaque = True
+ if s.blended_instances:
+ any_blended = True
+ s = s.background_set
+
+ if any_opaque:
+ ss = Statement("step", "", "content")
+ ss.sub.append(Statement("depth_test", Token("LEQUAL")))
+ ss.sub.append(seq_res.create_reference_statement("lighting", lighting_res))
+ ss.sub.append(seq_res.create_reference_statement("scene", scene_res))
+ seq_res.statements.append(ss)
+
+ if any_blended:
+ ss = Statement("step", "blended", "content")
+ ss.sub.append(Statement("depth_test", Token("LEQUAL")))
+ ss.sub.append(seq_res.create_reference_statement("lighting", lighting_res))
+ ss.sub.append(seq_res.create_reference_statement("scene", scene_res))
+ seq_res.statements.append(ss)