My Project
Loading...
Searching...
No Matches
CGenericLight.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, 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.3.0
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"
52//------------------------------------------------------------------------------
53
54//------------------------------------------------------------------------------
55namespace chai3d {
56//------------------------------------------------------------------------------
57
58//==============================================================================
65//==============================================================================
66
67//==============================================================================
78//==============================================================================
80{
81 friend class cWorld;
82
83 //--------------------------------------------------------------------------
84 // CONSTRUCTOR & DESTRUCTOR:
85 //--------------------------------------------------------------------------
86
87public:
88
90 cGenericLight(cWorld* a_world);
91
93 virtual ~cGenericLight();
94
95
96 //--------------------------------------------------------------------------
97 // PUBLIC METHODS:
98 //--------------------------------------------------------------------------
99
100public:
101
103 virtual std::string getClassName() { return ("GenericLight"); }
104
106 void setUseTwoSideLightModel(bool a_useTwoSideLightModel);
107
109 bool getUseTwoSideLightModel() const;
110
112 void setDisplayEnabled(bool a_enabled) { m_displayEnabled = a_enabled; }
113
115 bool getDisplayEnabled() const { return (m_displayEnabled); }
116
118 inline void setGLLightNumber(const GLint a_glLightNumber) { m_glLightNumber = a_glLightNumber; }
119
121 inline GLint getGLLightNumber() const { return(m_glLightNumber); }
122
123
124 //-----------------------------------------------------------------------
125 // PUBLIC MEMBERS:
126 //-----------------------------------------------------------------------
127
128public:
129
132
135
138
139
140 //-----------------------------------------------------------------------
141 // VIRTUAL PROTECTED METHODS:
142 //-----------------------------------------------------------------------
143
144protected:
145
147 virtual void renderLightSource(cRenderOptions& a_options){}
148
150 virtual void render(cRenderOptions& a_options){}
151
152
153 //-----------------------------------------------------------------------
154 // PROTECTED MEMBERS:
155 //-----------------------------------------------------------------------
156
157protected:
158
161
164
167
170};
171
172//------------------------------------------------------------------------------
173} // namespace chai3d
174//------------------------------------------------------------------------------
175
176//------------------------------------------------------------------------------
177#endif
178//------------------------------------------------------------------------------
179
Implements color properties.
Implements a base class for all objects.
Implements general math utility functions.
Implements a shadow map.
This class implements a base class for modeling light sources.
Definition CGenericLight.h:80
void setUseTwoSideLightModel(bool a_useTwoSideLightModel)
This method enables or disables the two sided lighting mode.
Definition CGenericLight.cpp:106
cColorf m_ambient
Ambient light component.
Definition CGenericLight.h:131
cColorf m_specular
Specular light component.
Definition CGenericLight.h:137
void setDisplayEnabled(bool a_enabled)
This method enables or disables the graphic representation of light source. (To be used for debugging...
Definition CGenericLight.h:112
bool getDisplayEnabled() const
This method returns true of graphic display representation of the light source is enabled,...
Definition CGenericLight.h:115
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:118
cWorld * m_worldParent
Parent world in which light source is located.
Definition CGenericLight.h:160
GLint m_useTwoSideLightModel
If true then a two sided light source model is used.
Definition CGenericLight.h:166
GLint m_glLightNumber
OpenGL reference number for the current light source. This number ranges from 0 to 7.
Definition CGenericLight.h:163
bool m_displayEnabled
If true then a graphical representation of the light source is rendered.
Definition CGenericLight.h:169
virtual std::string getClassName()
This method returns the name of the object class.
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:147
bool getUseTwoSideLightModel() const
This method returns true if the two sided lighting mode is enabled, false otherwise.
Definition CGenericLight.cpp:126
GLint getGLLightNumber() const
This method returns the OpenGL Light ID number for this light source.
Definition CGenericLight.h:121
cColorf m_diffuse
Diffuse light component.
Definition CGenericLight.h:134
virtual ~cGenericLight()
Destructor of cGenericLight.
Definition CGenericLight.cpp:94
virtual void render(cRenderOptions &a_options)
This method renders a graphical representation (display model) of the light source....
Definition CGenericLight.h:150
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition CGenericObject.h:113
This class implements a virtual world.
Definition CWorld.h:93
Definition CAudioBuffer.cpp:57
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83