CGenericLight.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, CHAI3D.
5  (www.chai3d.org)
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions
11  are met:
12 
13  * Redistributions of source code must retain the above copyright
14  notice, this list of conditions and the following disclaimer.
15 
16  * Redistributions in binary form must reproduce the above
17  copyright notice, this list of conditions and the following
18  disclaimer in the documentation and/or other materials provided
19  with the distribution.
20 
21  * Neither the name of CHAI3D nor the names of its contributors may
22  be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  POSSIBILITY OF SUCH DAMAGE.
37 
38  \author <http://www.chai3d.org>
39  \author Francois Conti
40  \version 3.2.0 $Rev: 2167 $
41 */
42 //==============================================================================
43 
44 //------------------------------------------------------------------------------
45 #ifndef CGenericLightH
46 #define CGenericLightH
47 //------------------------------------------------------------------------------
48 #include "graphics/CColor.h"
49 #include "lighting/CShadowMap.h"
50 #include "math/CMaths.h"
51 #include "world/CGenericObject.h"
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 namespace chai3d {
56 //------------------------------------------------------------------------------
57 
58 //==============================================================================
65 //==============================================================================
66 
67 //==============================================================================
78 //==============================================================================
80 {
81  friend class cWorld;
82 
83  //--------------------------------------------------------------------------
84  // CONSTRUCTOR & DESTRUCTOR:
85  //--------------------------------------------------------------------------
86 
87 public:
88 
90  cGenericLight(cWorld* a_world);
91 
93  virtual ~cGenericLight();
94 
95 
96  //--------------------------------------------------------------------------
97  // PUBLIC METHODS:
98  //--------------------------------------------------------------------------
99 
100 public:
101 
103  void setUseTwoSideLightModel(bool a_useTwoSideLightModel);
104 
106  bool getUseTwoSideLightModel() const;
107 
109  void setDisplayEnabled(bool a_enabled) { m_displayEnabled = a_enabled; }
110 
112  bool getDisplayEnabled() const { return (m_displayEnabled); }
113 
115  inline void setGLLightNumber(const GLint a_glLightNumber) { m_glLightNumber = a_glLightNumber; }
116 
118  inline GLint getGLLightNumber() const { return(m_glLightNumber); }
119 
120 
121  //-----------------------------------------------------------------------
122  // PUBLIC MEMBERS:
123  //-----------------------------------------------------------------------
124 
125 public:
126 
129 
132 
135 
136 
137  //-----------------------------------------------------------------------
138  // VIRTUAL PROTECTED METHODS:
139  //-----------------------------------------------------------------------
140 
141 protected:
142 
144  virtual void renderLightSource(cRenderOptions& a_options){}
145 
147  virtual void render(cRenderOptions& a_options){}
148 
149 
150  //-----------------------------------------------------------------------
151  // PROTECTED MEMBERS:
152  //-----------------------------------------------------------------------
153 
154 protected:
155 
158 
161 
164 
167 };
168 
169 //------------------------------------------------------------------------------
170 } // namespace chai3d
171 //------------------------------------------------------------------------------
172 
173 //------------------------------------------------------------------------------
174 #endif
175 //------------------------------------------------------------------------------
176 
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
Implements general math utility functions.
virtual void renderLightSource(cRenderOptions &a_options)
This method renders the lighting properties of this light source using OpenGL.
Definition: CGenericLight.h:144
cColorf m_ambient
Ambient light component.
Definition: CGenericLight.h:128
cWorld * m_worldParent
Parent world in which light source is located.
Definition: CGenericLight.h:157
cColorf m_diffuse
Diffuse light component.
Definition: CGenericLight.h:131
Implements a shadow map.
GLint getGLLightNumber() const
This method returns the OpenGL Light ID number for this light source.
Definition: CGenericLight.h:118
void setGLLightNumber(const GLint a_glLightNumber)
This method sets the OpenGL Light ID number. Assigning these numbers is normally handled by the world...
Definition: CGenericLight.h:115
This class implements a base class for modeling light sources.
Definition: CGenericLight.h:79
This class implements a virtual world.
Definition: CWorld.h:92
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition: CGenericObject.h:112
Implements a base class for all objects.
cColorf m_specular
Specular light component.
Definition: CGenericLight.h:134
void setUseTwoSideLightModel(bool a_useTwoSideLightModel)
This method enables or disables the two sided lighting mode.
Definition: CGenericLight.cpp:106
GLint m_glLightNumber
OpenGL reference number for the current light source. This number ranges from 0 to 7...
Definition: CGenericLight.h:160
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
Implements color properties.
bool getDisplayEnabled() const
This method returns true of graphic display representation of the light source is enabled...
Definition: CGenericLight.h:112
virtual void render(cRenderOptions &a_options)
This method renders a graphical representation (display model) of the light source. (used for debugging purposes typically).
Definition: CGenericLight.h:147
virtual ~cGenericLight()
Destructor of cGenericLight.
Definition: CGenericLight.cpp:94
bool getUseTwoSideLightModel() const
This method returns true if the two sided lighting mode is enabled, false otherwise.
Definition: CGenericLight.cpp:126
cGenericLight(cWorld *a_world)
Constructor of cGenericLight.
Definition: CGenericLight.cpp:59
void setDisplayEnabled(bool a_enabled)
This method enables or disables the graphic representation of light source. (To be used for debugging...
Definition: CGenericLight.h:109
GLint m_useTwoSideLightModel
If true then a two sided light source model is used.
Definition: CGenericLight.h:163
Definition: CAudioBuffer.cpp:56
bool m_displayEnabled
If true then a graphical representation of the light source is rendered.
Definition: CGenericLight.h:166