IvfLight.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfLight_h_
00026 #define _CIvfLight_h_
00027 
00028 #include <ivf/IvfShape.h>
00029 
00030 IvfSmartPointer(CIvfLight);
00031 
00040 class IVF_API CIvfLight : public CIvfShape {
00041 public:
00042         enum TLightType {
00043                 LT_POINT,
00044                 LT_DIRECTIONAL,
00045                 LT_SPOT
00046         };
00047 private:
00048         int m_lightn; 
00049         
00050         GLfloat m_ambient[4];
00051         GLfloat m_diffuse[4];
00052         GLfloat m_specular[4];
00053         GLfloat m_position[4];
00054         GLint m_constatt;
00055         GLint m_linatt;
00056         GLint m_quadatt;
00057 
00058         float m_spotCutoff;
00059         float m_spotDirection[3];
00060         float m_spotExponent;
00061 
00062         TLightType m_lightType;
00063         bool m_enabled;
00064 public:
00065         CIvfLight();
00066         virtual ~CIvfLight();
00067 
00069         void enable();
00070 
00072         void disable();
00073 
00075         bool isEnabled();
00076 
00078         void setNumber(int number);
00079 
00080         IvfClassInfo("CIvfLight",CIvfShape);
00081 
00083         void setAmbientColor( const float r, const float g, 
00084                 const float b, const float a );
00086         void setDiffuseColor( const float r, const float g, 
00087                 const float b, const float a );
00089         void setSpecularColor( const float r, const float g, 
00090                 const float b, const float a );
00091         
00100         void setLightPosition( const float x, const float y, const float z, const float w );
00101         void setLightPosition( const float x, const float y, const float z);
00102         void setDirection( const float x, const float y, const float z);
00103 
00105         void setConstAtt( const int a );
00106         
00108         void setLinAtt( const int a );
00109 
00111         void setQuadAtt( const int a );
00112 
00114         void getAmbientColor( float &r, float &g, float &b, float &a ) const;
00115 
00117         void getDiffuseColor( float &r, float &g, float &b, float &a ) const;
00118 
00120         void getSpecularColor( float &r, float &g, float &b, float &a ) const;
00121         
00123         void getLightPosition( float &x, float &y, float &z, float &w ) const;
00124 
00126         void getConstAtt( int &a ) const;
00127 
00129         void getLinAtt( int &a ) const;
00130 
00132         void getQuadAtt( int &a ) const;
00133 
00135         void setSpotExponent(float exponent);
00136 
00138         float getSpotExponent();
00139 
00141         void setSpotCutoff(float cutoff);
00142 
00144         float getSpotCutoff();
00145 
00147         void setSpotDirection(float ex, float ey, float ez);
00148 
00150         void getSpotDirection(float &ex, float &ey, float &ez);
00151 
00159         void setType(TLightType lightType);
00160 
00162         TLightType getType();
00163 
00164 protected:
00165         virtual void createGeometry();
00166 };
00167 
00168 #endif 

Generated on Fri Sep 1 15:36:45 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO