Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

gllight.h

00001 /***************************************************************************
00002                           gllight.h  -  description
00003                              -------------------
00004     begin                : Fri Apr 25 2003
00005     copyright            : (C) 2003 by Jacques Gasselin De Richebourg
00006     email                : jgasseli@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef GLLIGHT_H
00019 #define GLLIGHT_H
00020 
00021 #include <GL/gl.h>
00022 #include "glscene.h"
00023 
00029 namespace GLScene
00030 {
00031   
00032 class GLLight:  public GLRenderState
00033 {
00034    //spotlight features
00035    bool spotLight;
00036    GLfloat spot_direction[3];
00037    GLfloat spot_exponent;
00038    GLfloat spot_cutoff;
00039    //attenuation
00040    GLfloat constant_attenuation;
00041    GLfloat linear_attenuation;
00042    GLfloat quadratic_attenuation;
00043    //color
00044    GLfloat specular[4];
00045    GLfloat diffuse[4];
00046    GLfloat ambient[4];
00047    //position
00048    GLfloat position[4];
00049      
00050 public:
00051    SML_TAG(light);
00052 
00053 /*  static char startTag[20];
00054   static char endTag[20];
00055 
00056   TYPE_NAME(Light);
00057 */  
00058    GLLight();
00059    virtual ~GLLight();
00060 
00061    //spotlight methods
00062    void enableSpotLight();
00063    void disableSpotLight();
00064    void setSpotDirection(GLfloat x, GLfloat y, GLfloat z);
00065    void setSpotExponent(GLfloat x);
00066    void setSpotCutoff(GLfloat c);
00067 
00068    bool getSpotLight() { return spotLight; }
00069    const GLfloat* getSpotDirection() {return spot_direction; }
00070    GLfloat getSpotExponent() { return spot_exponent; }
00071    GLfloat getSpotCutoff() { return spot_cutoff; }
00072    
00073    //attenuation
00074    void setConstantAttenuation(GLfloat a);
00075    void setLinearAttenuation(GLfloat a);
00076    void setQuadraticAttenuation(GLfloat a);
00077 
00078    GLfloat getConstantAttenuation() { return constant_attenuation; }
00079    GLfloat getLinearAttenuation() { return linear_attenuation; }
00080    GLfloat getQuadraticAttenuation() { return quadratic_attenuation; }
00081 
00082    //color
00083    void setSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00084    void setDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00085    void setAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00086 
00087    const GLfloat* getSpecular() { return specular; }
00088    const GLfloat* getDiffuse() { return diffuse; }
00089    const GLfloat* getAmbient() { return ambient; }
00090 
00091    //position
00092    void setPos(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
00093    const GLfloat* getPos() { return position; }
00094 
00095    void render();
00096    //usage
00097    void use(GLenum light);
00098 
00099    /*
00100    void loadFromStream(std::istream&);
00101    void saveToStream(std::ostream&);
00102    */
00103   
00104 };
00105 
00106 };
00107 #endif

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3