00001 /****************************************************************************** 00002 * SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3 * 00003 * (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS * 00004 * * 00005 * This library is free software; you can redistribute it and/or modify it * 00006 * under the terms of the GNU Lesser General Public License as published by * 00007 * the Free Software Foundation; either version 2.1 of the License, or (at * 00008 * your option) any later version. * 00009 * * 00010 * This library is distributed in the hope that it will be useful, but WITHOUT * 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * 00013 * for more details. * 00014 * * 00015 * You should have received a copy of the GNU Lesser General Public License * 00016 * along with this library; if not, write to the Free Software Foundation, * 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 00018 ******************************************************************************* 00019 * SOFA :: Modules * 00020 * * 00021 * Authors: The SOFA Team and external contributors (see Authors.txt) * 00022 * * 00023 * Contact information: contact@sofa-framework.org * 00024 ******************************************************************************/ 00025 #ifndef SOFA_COMPONENT_LIGHT 00026 #define SOFA_COMPONENT_LIGHT 00027 00028 #include <sofa/core/VisualModel.h> 00029 #include <sofa/core/objectmodel/BaseObject.h> 00030 #include <sofa/defaulttype/Vec3Types.h> 00031 #include <sofa/helper/gl/template.h> 00032 #include <sofa/core/VisualModel.h> 00033 namespace sofa 00034 { 00035 00036 namespace component 00037 { 00038 00039 namespace visualmodel 00040 { 00041 00054 using sofa::defaulttype::Vector3; 00055 00056 class Light : public virtual sofa::core::VisualModel { 00057 protected: 00058 Data<Vector3> color; 00059 GLint lightID; 00060 00061 public: 00062 00063 Light(); 00064 virtual ~Light(); 00065 00066 void setID(const GLint& id); 00067 00068 virtual void initVisual() ; 00069 void init(); 00070 virtual void drawLight(); 00071 void draw() { } ; 00072 virtual void reinit(); 00073 void update() {} ; 00074 }; 00075 00076 class DirectionalLight : public Light { 00077 private: 00078 Data<Vector3> direction; 00079 00080 public: 00081 00082 DirectionalLight(); 00083 virtual ~DirectionalLight(); 00084 virtual void initVisual() ; 00085 virtual void drawLight(); 00086 virtual void reinit(); 00087 00088 00089 }; 00090 00091 class PositionalLight : public Light { 00092 protected: 00093 Data<Vector3> position; 00094 Data<float> attenuation; 00095 00096 public: 00097 00098 PositionalLight(); 00099 virtual ~PositionalLight(); 00100 virtual void initVisual() ; 00101 virtual void drawLight(); 00102 virtual void reinit(); 00103 00104 }; 00105 00106 class SpotLight : public PositionalLight { 00107 protected: 00108 Data<Vector3> direction; 00109 Data<float> cutoff; 00110 Data<float> exponent; 00111 00112 public: 00113 SpotLight(); 00114 virtual ~SpotLight(); 00115 virtual void initVisual() ; 00116 virtual void drawLight(); 00117 virtual void reinit(); 00118 00119 00120 }; 00121 00122 } //namespace visualmodel 00123 00124 } //namespace component 00125 00126 } //namespace sofa 00127 00128 #endif //SOFA_COMPONENT_LIGHT
1.5.7.1