GL Studio C++ Runtime API
component_light_mgr.h
Go to the documentation of this file.
1/// \file component_light_mgr.h
2/// \brief The disti::ComponentLightMgr class.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2017 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<br>
9/// USA<br>
10/// <br>
11/// All rights reserved.<br>
12///
13/// This Software contains proprietary trade secrets of DiSTI and may not be
14/// reproduced, in whole or part, in any form, or by any means of electronic,
15/// mechanical, or otherwise, without the written permission of DiSTI. Said
16/// permission may be derived through the purchase of applicable DiSTI product
17/// licenses which detail the distribution rights of this content and any
18/// Derivative Works based on this or other copyrighted DiSTI Software.
19///
20/// NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21/// AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22/// PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23/// AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24/// IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25/// PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26///
27/// LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28/// IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29/// INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30/// DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31/// INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32/// INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33/// OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34/// EXCEED FIVE DOLLARS (US$5.00).
35///
36/// The aforementioned terms and restrictions are governed by the laws of the
37/// State of Florida and the United States of America.
38
39#ifndef INCLUDED_DISTI_COMPONENT_LIGHT_MGR_H
40#define INCLUDED_DISTI_COMPONENT_LIGHT_MGR_H
41
42#include "dynamic_array.h"
43#include "gls_include.h"
44
45namespace disti
46{
47class GlsLightSource;
48class GlsEyePoint;
49class DisplayObject;
50
51/** This class is responsible for keeping track of the lights in a component
52 * and setting up lighting for the objects of the component.
53 */
55{
56protected:
57 /** List of active lights in the component. This list is reset and populated during the PreDraw() traversal */
59
60 /** If UseParentsLighting is true, the component will add
61 * its lights to those already set by it's parent.
62 * If false, the component will only use it's own lights.*/
64
66
67public:
68 /// \return A pointer to a new ComponentLightMgr instance.
70
72
73 /** Accessor method to set whether or not to inherit lighting from the component's parent
74 * \param useParentsLighting Whether or not to inherit lighting from the component's parent
75 */
76 void GLS_EXPORT UseParentsLighting( bool useParentsLighting );
77
78 /** Accessor method to get whether or not to inherit lighting from the component's parent
79 * \return Whether or not to inherit lighting from the component's parent
80 */
82
83 /** Sets whether GL_NORMALIZE is enabled. Default value is true.
84 * \param enableNormalize Set GL_NORMALIZE to true or false
85 */
86 void GLS_EXPORT EnableNormalize( bool enableNormalize );
87
88 /// Accessor method to get whether or not GL_NORMALIZE is enabled
89 /// \return Whether or not GL_NORMALIZE is enabled.
91
92 /** Any light source in the component that wants to be enabled
93 * must call this during PreDraw().
94 * \param light The light to be enabled
95 */
97
98 /** Called before PreDraw() to clear the light list
99 */
101
102 /** Called by the the parent of the component to initialize lighting prior to drawing the component
103 */
105
106 /** Called by the the parent of the component to restore lighting after drawing the component
107 */
109
110 /** Detemine the OpenGL lighting state for this component and push it
111 * onto the global lighting stack (called from DisplayFrame::Draw())
112 */
114
115 /** Called at the end of DisplayFrame::Draw() to restore the original lighting state
116 */
118
119 /** Called by lit objects to setup lights
120 * \param object The object to setup lighting for
121 */
123
124 /// Called to force all lights to be reapplied based on
125 /// the modelview specified by the eyePoint.
126 /// A value of NULL, reapplies the lights with their original modelview.
127 /// \param eyePoint The new GlsEyePoint to use, or NULL.
129
130 /** Sets a flag to cause the lights to be reapplied when the next lit object
131 * draws. This may be necessary for special cases where the OpenGL matrices
132 * have changed during a traversel. This can
133 * happen when drawing multiple views of the same
134 * geometry.
135 */
137
138 /** Get a boolean mask of the active lights
139 * \return A boolean array with a bitmask of the currently active lights
140 */
142
143 /** Get a bitmask of the active lights
144 * \return An unsigned integer with each bit representing a light turned on/off
145 */
147
148 /** Get the number of active lights for this component. Will include parent lights.
149 * Really is the max index(+1) of lights that you need to cycle through to have
150 * taken all of them into account (in case of holes in the list created by an
151 * outside party).
152 * \return An integer representing the number of currently active lights
153 */
155};
156
157} // namespace disti
158
159#endif
Definition: component_light_mgr.h:55
void EnableNormalize(bool enableNormalize)
DynamicArray< GlsLightSource * > _registeredLights
Definition: component_light_mgr.h:58
unsigned int GetNumActiveLights()
static ComponentLightMgr * CreateInstance()
void SetupLighting(DisplayObject *object)
void ReapplyLightsForEyePoint(GlsEyePoint *eyePoint)
bool _useParentsLighting
Definition: component_light_mgr.h:63
void UseParentsLighting(bool useParentsLighting)
unsigned int GetActiveLightsBitMask()
void RegisterLight(GlsLightSource *light)
Definition: display.h:95
Definition: gls_eyepoint.h:116
Definition: gls_light_source.h:83
The disti::DynamicArray class. A templated array of objects capable of dynamically growing.
A file for all GL Studio files to include.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:50
Definition: bmpimage.h:46