Added support for exit portals default tip
authorMimmo Briganti
Sat Jun 04 18:53:36 2011 +0200 (11 months ago)
changeset 11301b211b80c2b
parent 112 20915fc1ab9c
Added support for exit portals
su2lux.rb
su2lux/LuxrenderExport.rb
su2lux/MaterialEditor.html
     1.1 --- a/su2lux.rb	Tue May 24 19:17:53 2011 +0200
     1.2 +++ b/su2lux.rb	Sat Jun 04 18:53:36 2011 +0200
     1.3 @@ -141,20 +141,7 @@
     1.4  
     1.5  		le=LuxrenderExport.new(@export_file_path,@os_separator)
     1.6  		le.reset
     1.7 -		out = File.new(@export_file_path,"w")
     1.8 -		le.export_global_settings(out)
     1.9 -		le.export_camera(model.active_view, out)
    1.10 -		le.export_film(out)
    1.11 -		le.export_render_settings(out)
    1.12 -		entity_list=model.entities
    1.13 -		out.puts 'WorldBegin'
    1.14 -		le.export_light(out)
    1.15 -		
    1.16  		file_basename = File.basename(@export_file_path, SCENE_EXTENSION)
    1.17 -		out.puts "Include \"" + file_basename + SUFFIX_MATERIAL + "\"\n\n"
    1.18 -		out.puts "Include \"" + file_basename + SUFFIX_OBJECT + "\"\n\n"
    1.19 -		out.puts 'WorldEnd'
    1.20 -		out.close
    1.21  		
    1.22  		file_dirname = File.dirname(@export_file_path)
    1.23  		file_fullname = file_dirname + @os_separator + file_basename
    1.24 @@ -169,6 +156,20 @@
    1.25  		le.export_used_materials(materials, out_mat)
    1.26  		# le.export_textures(out_mat)
    1.27  		out_mat.close
    1.28 +
    1.29 +		out = File.new(@export_file_path,"w")
    1.30 +		le.export_global_settings(out)
    1.31 +		le.export_camera(model.active_view, out)
    1.32 +		le.export_film(out)
    1.33 +		le.export_render_settings(out)
    1.34 +		entity_list=model.entities
    1.35 +		out.puts 'WorldBegin'
    1.36 +		
    1.37 +		out.puts "Include \"" + file_basename + SUFFIX_MATERIAL + "\"\n\n"
    1.38 +		out.puts "Include \"" + file_basename + SUFFIX_OBJECT + "\"\n\n"
    1.39 +		le.export_light(out)
    1.40 +		out.puts 'WorldEnd'
    1.41 +		out.close
    1.42  		le.write_textures
    1.43  		@count_tri = le.count_tri
    1.44  	end # END export
     2.1 --- a/su2lux/LuxrenderExport.rb	Tue May 24 19:17:53 2011 +0200
     2.2 +++ b/su2lux/LuxrenderExport.rb	Sat Jun 04 18:53:36 2011 +0200
     2.3 @@ -12,9 +12,11 @@
     2.4  		@os_separator=os_separator
     2.5  
     2.6  		@path_textures=File.dirname(@export_file_path)
     2.7 +		@has_portals = false
     2.8  	end # END initialize
     2.9  
    2.10  	def reset
    2.11 +		@has_portals = false
    2.12  		@materials = {}
    2.13  		@fm_materials = {}
    2.14  		@count_faces = 0
    2.15 @@ -700,12 +702,16 @@
    2.16  				out.puts "\t\"float gain\" [#{"%.6f" %(@lrs.environment_sky_gain)}]"
    2.17  				out.puts "\t\"float turbidity\" [#{"%.6f" %(@lrs.environment_sky_turbidity)}]"
    2.18  				out.puts "\t\"vector sundir\" [#{"%.6f" %(sun_direction.x)} #{"%.6f" %(sun_direction.y)} #{"%.6f" %(sun_direction.z)}]"
    2.19 +				out.puts "\tPortalInstance \"Portal_Shape\"" if @has_portals == true
    2.20 +				out.puts "AttributeEnd" + "\n"
    2.21 +				out.puts "AttributeBegin"
    2.22  				out.puts "\tLightGroup \"#{@lrs.environment_sun_lightgroup}\""
    2.23  				out.puts "\tLightSource \"sun\""
    2.24  				out.puts "\t\"float gain\" [#{"%.6f" %(@lrs.environment_sun_gain)}]"
    2.25  				out.puts "\t\"float relsize\" [#{"%.6f" %(@lrs.environment_sun_relsize)}]"
    2.26  				out.puts "\t\"float turbidity\" [#{"%.6f" %(@lrs.environment_sun_turbidity)}]"
    2.27  				out.puts "\t\"vector sundir\" [#{"%.6f" %(sun_direction.x)} #{"%.6f" %(sun_direction.y)} #{"%.6f" %(sun_direction.z)}]"
    2.28 +				out.puts "\tPortalInstance \"Portal_Shape\"" if @has_portals == true
    2.29  			when 'infinite'
    2.30  				out.puts "\tLightGroup \"#{@lrs.environment_infinite_lightgroup}\""
    2.31  				out.puts "\tLightSource \"infinitesample\""
    2.32 @@ -725,6 +731,7 @@
    2.33  					out.puts "\t\"float relsize\" [#{"%.6f" %(@lrs.environment_infinite_sun_relsize)}]"
    2.34  					out.puts "\t\"float turbidity\" [#{"%.6f" %(@lrs.environment_infinite_sun_turbidity)}]"
    2.35  					out.puts "\t\"vector sundir\" [#{"%.6f" %(sun_direction.x)} #{"%.6f" %(sun_direction.y)} #{"%.6f" %(sun_direction.z)}]"
    2.36 +					out.puts "\tPortalInstance \"Portal_Shape\"" if @has_portals == true
    2.37  				end
    2.38  		end
    2.39  		out.puts "AttributeEnd"
    2.40 @@ -899,7 +906,8 @@
    2.41  		 # "float power" [100.000000]
    2.42  		 # "float efficacy" [17.000000]
    2.43  		 # "float gain" [1.000000]
    2.44 -			case luxrender_mat.type
    2.45 +		mesh_type = 'Shape "trianglemesh" "integer indices" ['	
    2.46 +		 case luxrender_mat.type
    2.47  				# when "matte", "glass"
    2.48  					# out.puts "NamedMaterial \""+luxrender_mat.name+"\""
    2.49  				when "light"
    2.50 @@ -908,13 +916,18 @@
    2.51  					out.puts "\"float power\" [#{"%.6f" %(luxrender_mat.light_power)}]"
    2.52  					out.puts "\"float efficacy\" [#{"%.6f" %(luxrender_mat.light_efficacy)}]"
    2.53  					out.puts "\"float gain\" [#{"%.6f" %(luxrender_mat.light_gain)}]"
    2.54 +				when "portal"
    2.55 +					# mesh_type = 'PortalShape "trianglemesh" "integer indices" ['	
    2.56 +					out.puts "ObjectBegin \"Portal_Shape\""
    2.57 +					@has_portals = true
    2.58 +					SU2LUX.dbg_p mesh_type
    2.59  				else
    2.60  					out.puts "NamedMaterial \""+luxrender_mat.name+"\""
    2.61  					SU2LUX.dbg_p "NAME: " + luxrender_mat.name
    2.62  			end
    2.63  		# end
    2.64  		
    2.65 -		out.puts 'Shape "trianglemesh" "integer indices" ['
    2.66 +		out.puts mesh_type
    2.67  		for mesh in meshes
    2.68  				mirrored_tmp = mirrored[i]
    2.69  			mat_dir_tmp = mat_dir[i]
    2.70 @@ -971,6 +984,10 @@
    2.71  		end
    2.72  		out.puts ']'
    2.73  		
    2.74 +		if luxrender_mat.type == "portal"
    2.75 +			out.puts "ObjectEnd"
    2.76 +		end
    2.77 +		
    2.78  		@exp_default_uvs=true
    2.79  		no_texture_uvs=(!has_texture and @exp_default_uvs==true)
    2.80  		
    2.81 @@ -1031,7 +1048,7 @@
    2.82  		materials.each { |mat|
    2.83  				luxrender_mat = LuxrenderMaterial.new(mat)
    2.84  				SU2LUX.dbg_p luxrender_mat.name
    2.85 -				export_mat(luxrender_mat, out)
    2.86 +				export_mat(luxrender_mat, out) unless luxrender_mat.type == "portal"
    2.87  		}
    2.88  	end # END export_used_materials
    2.89  
     3.1 --- a/su2lux/MaterialEditor.html	Tue May 24 19:17:53 2011 +0200
     3.2 +++ b/su2lux/MaterialEditor.html	Sat Jun 04 18:53:36 2011 +0200
     3.3 @@ -39,6 +39,7 @@
     3.4  				<option value="mattetranslucent">Matte Translucent</option>
     3.5  				<option value="glossytranslucent">Glossy Translucent</option>
     3.6  				<option value="light">Light</option>
     3.7 +				<option value="portal">Portal</option>
     3.8  			</select>
     3.9  			<div id="diffuse" class="matte glossy glossytranslucent">
    3.10  				<p class="header2">Diffuse</p>