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