indexing description: "Objects that ..." author: "" date: "$Date$" revision: "$Revision$" class EM3D_LIGHT_MANAGER inherit EM3D_OBJECT_MANAGER[ EM3D_LIGHT ] EMGL_SETTINGS export {NONE} all undefine is_equal, copy end EM_CONSTANTS export {NONE} all undefine is_equal, copy end EM_SHARED_ERROR_HANDLER export {NONE} all undefine copy, is_equal end create make, make_with_creation_constraint feature -- Access create_new_directional_unnamed: EM3D_DIRECTIONAL_LIGHT is -- Crate a new instance require creation_possible: has_no_creation_constraint or is_creation_of_a_new_instance_possible local i: INTEGER do from i:=0 until object_by_name( default_name+i.out )=void loop i := i + 1 end result := create_new_directional( default_name+i.out ) end create_new_directional (a_name: STRING): EM3D_DIRECTIONAL_LIGHT is -- Crate a new instance require is_valid_name: is_valid_name (a_name) creation_possible: has_no_creation_constraint or is_creation_of_a_new_instance_possible do create Result.make(scene_manager) Result.set_name (a_name) objects.put_last( Result.object_id ) end create_new_point_unnamed: EM3D_POINT_LIGHT is -- Crate a new instance require creation_possible: has_no_creation_constraint or is_creation_of_a_new_instance_possible local i: INTEGER do from i:=0 until object_by_name( default_name+i.out )=void loop i := i + 1 end result := create_new_point( default_name+i.out ) end create_new_point (a_name: STRING): EM3D_POINT_LIGHT is -- Crate a new instance require is_valid_name: is_valid_name (a_name) creation_possible: has_no_creation_constraint or is_creation_of_a_new_instance_possible do create Result.make(scene_manager) Result.set_name (a_name) objects.put_last( Result.object_id ) end create_new_spot_unnamed: EM3D_SPOT_LIGHT is -- Crate a new instance require creation_possible: has_no_creation_constraint or is_creation_of_a_new_instance_possible local i: INTEGER do from i:=0 until object_by_name( default_name+i.out )=void loop i := i + 1 end result := create_new_spot( default_name+i.out ) end create_new_spot (a_name: STRING): EM3D_SPOT_LIGHT is -- Crate a new instance require is_valid_name: is_valid_name (a_name) creation_possible: has_no_creation_constraint or is_creation_of_a_new_instance_possible do create Result.make(scene_manager) Result.set_name (a_name) objects.put_last( Result.object_id ) end feature -- Update render_opengl is -- Update the light local i: INTEGER do from i := em_gl_light0 until i > em_gl_light7 loop emgl_disable( i ) i := i + 1 end max_id := em_gl_light0 do_all ( agent {EM3D_LIGHT}.render_opengl ) if max_id>em_gl_light0 then emgl_enable( em_gl_lighting ) else emgl_disable( em_gl_lighting ) end end feature {NONE} max_id : INTEGER feature {EM3D_LIGHT} new_id: INTEGER is -- Get a new light ID for the current rendering do result := max_id max_id := max_id+1 if max_id>em_gl_light7 then Error_handler.raise_warning (Error_codes.Em_error_em3d_light, ["Not enough OpenGL lights%N"]) end ensure valid_light: em_gl_light0 <= result and result <= em_gl_light7 end end