CHAI3D  3.0.0
CGenericLight.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2015, 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.0.0 $Rev: 1649 $
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  inline void setEnabled(const bool a_enabled) { m_enabled = a_enabled; }
104 
106  inline bool getEnabled() const { return (m_enabled); }
107 
109  void setUseTwoSideLightModel(bool a_useTwoSideLightModel);
110 
112  bool getUseTwoSideLightModel() const;
113 
115  void setDisplayEnabled(bool a_enabled) { m_displayEnabled = a_enabled; }
116 
118  bool getDisplayEnabled() const { return (m_displayEnabled); }
119 
121  inline void setGLLightNumber(const GLint a_glLightNumber) { m_glLightNumber = a_glLightNumber; }
122 
124  inline GLint getGLLightNumber() const { return(m_glLightNumber); }
125 
126 
127  //-----------------------------------------------------------------------
128  // PUBLIC MEMBERS:
129  //-----------------------------------------------------------------------
130 
131 public:
132 
135 
138 
141 
142 
143  //-----------------------------------------------------------------------
144  // VIRTUAL PROTECTED METHODS:
145  //-----------------------------------------------------------------------
146 
147 protected:
148 
150  virtual void renderLightSource(cRenderOptions& a_options){}
151 
153  virtual void render(cRenderOptions& a_options){}
154 
155 
156  //-----------------------------------------------------------------------
157  // PROTECTED MEMBERS:
158  //-----------------------------------------------------------------------
159 
160 protected:
161 
164 
166  bool m_enabled;
167 
170 
173 
176 };
177 
178 //------------------------------------------------------------------------------
179 } // namespace chai3d
180 //------------------------------------------------------------------------------
181 
182 //------------------------------------------------------------------------------
183 #endif
184 //------------------------------------------------------------------------------
185 
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
Implements general math utility functions.
void setEnabled(const bool a_enabled)
This method enables or disables this light source.
Definition: CGenericLight.h:103
virtual void renderLightSource(cRenderOptions &a_options)
This method renders the lighting properties of this light source using OpenGL.
Definition: CGenericLight.h:150
cColorf m_ambient
Ambient light component.
Definition: CGenericLight.h:134
cWorld * m_worldParent
Parent world in which light source is located.
Definition: CGenericLight.h:163
bool m_enabled
Enable light source (ON/OFF).
Definition: CGenericLight.h:166
cColorf m_diffuse
Diffuse light component.
Definition: CGenericLight.h:137
Implements a shadow map.
GLint getGLLightNumber() const
This method returns the OpenGL Light ID number for this light source.
Definition: CGenericLight.h:124
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:121
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:140
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:169
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:118
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:153
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:115
GLint m_useTwoSideLightModel
If true then a two sided light source model is used.
Definition: CGenericLight.h:172
Definition: CAudioBuffer.cpp:56
bool m_displayEnabled
If true then a graphical representation of the light source is rendered.
Definition: CGenericLight.h:175
bool getEnabled() const
This method returns true if the light source is enabled, false otherwise.
Definition: CGenericLight.h:106

CHAI3D 3.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2015 - CHAI3D
All Rights Reserved.