light.h

Go to the documentation of this file.
00001 //=============================================================================
00016 #ifndef __LIGHT_H_INCLUDED__
00017 #define __LIGHT_H_INCLUDED__
00018 
00019 #include "vector.h"
00020 
00021 
00022 //=============================================================================
00023 //  CLight
00024 //=============================================================================
00025 
00041 class CLight
00042 {
00043 public:
00048     CLight( void )
00049     {
00050         m_enabled = false;
00051         m_lockedToCamera = false;
00052         m_autoRotate = false;
00053     }
00054 
00055     // enabled
00056     bool    getEnabled( void ) const { return m_enabled; } 
00057     void    setEnabled( bool en ) { m_enabled = en; } 
00058 
00059     // lock to camera or world
00060     bool    getLockedToCamera( void ) const { return m_lockedToCamera; } 
00061     void    setLockedToCamera( bool locked ) { m_lockedToCamera = locked; } 
00062 
00063     // auto-rotate
00064     bool    getAutoRotate( void ) const { return m_autoRotate; } 
00065     void    setAutoRotate( bool enable ) { m_autoRotate = enable; } 
00066 
00067     // position
00068     vec4_t  getPosition( void ) const { return m_position; } 
00069     void    setPosition( const vec4_t & v ) { m_position = v; } 
00070 
00071     // ambient
00072     vec4_t  getAmbient ( void ) const { return m_ambient; } 
00073     void    setAmbient ( const vec4_t & v ) { m_ambient = v; } 
00074 
00075     // diffuse
00076     vec4_t  getDiffuse ( void ) const { return m_diffuse; } 
00077     void    setDiffuse ( const vec4_t & v ) { m_diffuse = v; } 
00078 
00079     // specular
00080     vec4_t  getSpecular( void ) const { return m_specular; } 
00081     void    setSpecular( const vec4_t & v ) { m_specular = v; } 
00082 
00083 private:
00084     bool        m_enabled;
00085     bool        m_lockedToCamera;
00086     bool        m_autoRotate;
00087     vec4_t      m_position;
00088     vec4_t      m_ambient;
00089     vec4_t      m_diffuse;
00090     vec4_t      m_specular;
00091 };
00092 
00093 
00094 //=============================================================================
00095 //  CMaterial - stores material parameters
00096 //=============================================================================
00097 
00109 class CMaterial
00110 {
00111 public:
00116     CMaterial( void )
00117     {
00118         m_useVertexColor = false;
00119         m_specularExponent = 0.0f;
00120     }
00121 
00122     // emission
00123     vec4_t  getEmission( void ) const { return m_emission; } 
00124     void    setEmission( const vec4_t & v ) { m_emission = v; } 
00125 
00126     // ambient
00127     vec4_t  getAmbient( void ) const { return m_ambient; } 
00128     void    setAmbient( const vec4_t & v ) { m_ambient = v; } 
00129 
00130     // diffuse
00131     vec4_t  getDiffuse( void ) const { return m_diffuse; } 
00132     void    setDiffuse( const vec4_t & v ) { m_diffuse = v; } 
00133 
00134     // specular
00135     vec4_t  getSpecular( void ) const { return m_specular; } 
00136     void    setSpecular( const vec4_t & v ) { m_specular = v; } 
00137 
00138     // specular exponent
00139     float   getSpecularExponent( void ) const { return m_specularExponent; } 
00140     void    setSpecularExponent( float f ) { m_specularExponent = f; } 
00141 
00142     // color material flag
00143     bool    getUseVertexColor( void ) const { return m_useVertexColor; } 
00144     void    setUseVertexColor( bool enable ) { m_useVertexColor = enable; } 
00145 
00146 private:
00147     vec4_t  m_emission;
00148     vec4_t  m_ambient;
00149     vec4_t  m_diffuse;
00150     vec4_t  m_specular;
00151     float   m_specularExponent;
00152     bool    m_useVertexColor; // as diffuse
00153 };
00154 
00155 
00156 //=============================================================================
00157 //  ILightingState - stores lighting state
00158 //=============================================================================
00159 
00174 class ILightingState
00175 {
00176 public:
00178     virtual ~ILightingState( void ) {}
00179 
00185     enum { MAX_LIGHTS = 8 };
00186 
00190     virtual void setShowLights( bool enable ) = 0;
00191 
00196     virtual void setLight( int index, const CLight & l ) = 0;
00197 
00201     virtual void setMaterial( const CMaterial & m ) = 0;
00202 
00208     virtual void setLightingEnabled( bool enable ) = 0;
00209 
00217     virtual bool getLight( int index, CLight & l ) const = 0;
00218 
00222     virtual void getMaterial( CMaterial & m ) const = 0;
00223 
00227     virtual bool getLightingEnabled( void ) const = 0;
00228 };
00229 
00230 
00231 #endif  // __LIGHT_H_INCLUDED__

Generated on Sun Mar 2 17:12:31 2008 for Shader Maker by  doxygen 1.5.4