IvfOldLight.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 // Modified by Carl-Johan Lejdfors
00024 //
00025 
00026 #ifndef _CIvfOldLight_h_
00027 #define _CIvfOldLight_h_
00028 
00029 #include <ivf/IvfObject.h>
00030 
00031 IvfSmartPointer(CIvfOldLight);
00032 
00033 static size_t IVF_MAX_LIGHTS = 8;
00034 
00044 class IVF_API CIvfOldLight : public CIvfObject {
00045 public:
00046         enum TLightType {
00047                 LT_POINT,
00048                 LT_DIRECTIONAL,
00049                 LT_SPOT
00050         };
00051 public:
00053         CIvfOldLight();
00054 
00056         virtual ~CIvfOldLight();
00057 
00059         CIvfOldLight& operator = ( const CIvfOldLight& ); 
00060         
00062         operator void*(); 
00063 
00064         IvfClassInfo("CIvfOldLight",CIvfObject);
00065 
00067         void setAmbient( const GLfloat r, const GLfloat g, 
00068                 const GLfloat b, const GLfloat a );
00070         void setDiffuse( const GLfloat r, const GLfloat g, 
00071                 const GLfloat b, const GLfloat a );
00073         void setSpecular( const GLfloat r, const GLfloat g, 
00074                 const GLfloat b, const GLfloat a );
00075         
00084         void setPosition( const GLfloat x, const GLfloat y, const GLfloat z, const GLfloat w );
00085         void setPosition( const GLfloat x, const GLfloat y, const GLfloat z);
00086         void setDirection( const GLfloat x, const GLfloat y, const GLfloat z);
00087 
00089         void setConstAtt( const GLint a );
00090         
00092         void setLinAtt( const GLint a );
00093 
00095         void setQuadAtt( const GLint a );
00096 
00098         void getAmbient( GLfloat &r, GLfloat &g, GLfloat &b, GLfloat &a ) const;
00099 
00101         void getDiffuse( GLfloat &r, GLfloat &g, GLfloat &b, GLfloat &a ) const;
00102 
00104         void getSpecular( GLfloat &r, GLfloat &g, GLfloat &b, GLfloat &a ) const;
00105         
00107         void getPosition( GLfloat &x, GLfloat &y, GLfloat &z, GLfloat &w ) const;
00108 
00110         void getConstAtt( GLint &a ) const;
00111 
00113         void getLinAtt( GLint &a ) const;
00114 
00116         void getQuadAtt( GLint &a ) const;
00117 
00119         void render();
00120 
00122         void setSpotExponent(float exponent);
00123 
00125         float getSpotExponent();
00126 
00128         void setSpotCutoff(float cutoff);
00129 
00131         float getSpotCutoff();
00132 
00134         void setSpotDirection(float ex, float ey, float ez);
00135 
00137         void getSpotDirection(float &ex, float &ey, float &ez);
00138 
00146         void setType(TLightType lightType);
00147 
00149         TLightType getType();
00150 
00157         void activate();
00158 
00165         void deactivate();
00166         
00167 protected:
00168         // disallow copying 
00169         CIvfOldLight( const CIvfOldLight& );
00170         
00171         static long lightmask; //available lights
00172         
00173 private:
00174         int m_lightn; 
00175         
00176         GLfloat m_ambient[4];
00177         GLfloat m_diffuse[4];
00178         GLfloat m_specular[4];
00179         GLfloat m_position[4];
00180         GLint m_constatt;
00181         GLint m_linatt;
00182         GLint m_quadatt;
00183 
00184         GLfloat m_spotCutoff;
00185         GLfloat m_spotDirection[3];
00186         GLfloat m_spotExponent;
00187 
00188         TLightType m_lightType;
00189         bool m_active;
00190 };
00195 #endif /* IvfOldLight_H */

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