indexing description: "[ A Material. ]" date: "$Date$" revision: "$Revision$" class EM3D_MATERIAL inherit EMGL_MATERIAL export {NONE} all redefine default_create end EMGL_SETTINGS export {NONE} all redefine default_create end EM_CONSTANTS export {NONE} all redefine default_create end EM3D_RESOURCE export {NONE} all redefine default_create end feature -- Initialization default_create is -- Set the default material values do ambient := [0.2, 0.2, 0.2, 1.0 ] diffuse := [0.8, 0.8, 0.8, 1.0 ] specular := [0.0, 0.0, 0.0, 1.0 ] emission := [0.0, 0.0, 0.0, 1.0 ] shininess := 0 end feature -- Status face: INTEGER is once result := em_gl_front_and_back end ambient, diffuse, specular, emission: EM_VECTOR4F shininess: REAL set_ambient( a_value: like ambient ) is -- Specify the ambient color do ambient := a_value end set_diffuse( a_value: like diffuse ) is -- Specify the diffuse color do diffuse := a_value end set_specular( a_value: like specular ) is -- Specify the specular color do specular := a_value end set_emission( a_value: like emission ) is -- Specify the emission color do emission := a_value end set_shininess( a_value: like shininess ) is -- Specify the shininess do shininess := a_value end texture: EM3D_TEXTURE_2D[ EMGL_FORMAT_RGBA ] set_texture( a_texture: like texture ) is -- Specify the texture do texture := a_texture end feature -- Status setting render_opengl is -- Set the opengl_material do emgl_materialfv( face, em_gl_ambient, ambient ) emgl_materialfv( face, em_gl_diffuse, diffuse ) emgl_materialfv( face, em_gl_specular, specular ) emgl_materialfv( face, em_gl_emission, emission ) emgl_materialf( face, em_gl_shininess, shininess ) if texture/=void then emgl_enable( em_gl_texture_2d ) texture.bind else emgl_disable( em_gl_texture_2d ) end end end