GL Studio C++ Runtime API
gls_mutex_group.h
Go to the documentation of this file.
1/// \file gls_mutex_group.h
2/// \brief The disti::GlsMutexGroup 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 DISTI_INCLUDED_GLS_MUTEX_GROUP_H
40#define DISTI_INCLUDED_GLS_MUTEX_GROUP_H
41
43#include "group.h"
44
45/// Provides support for creating DLLs.
46#if( defined( GLSGEN_EXPORT_GLSMUTEXGROUP ) || defined( GLSGEN_IMPORT_GLSMUTEXGROUP ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
47 && defined( _MSC_VER )
48# if defined( GLSGEN_EXPORT_GLSMUTEXGROUP ) || defined( GLS_EXPORT_GENERATED )
49# define GLSGEN_GLSMUTEXGROUP_EXPORT __declspec( dllexport )
50# else
51# define GLSGEN_GLSMUTEXGROUP_EXPORT __declspec( dllimport )
52# endif
53#else
54# define GLSGEN_GLSMUTEXGROUP_EXPORT
55#endif
56///////////////////////////////////////////////////////////////////////////////
57
58/// Automatically link the runtime library plugin (on Windows).
59#define LIB_BASE_NAME "gls_mutex_group"
60#include "gls_auto_lib.h"
61#undef LIB_BASE_NAME
62
63namespace disti
64{
65// These are specific to GlsMutexGroup
66static AttributeName MetaMutexState( "MutexState" );
67static AttributeName MetaState( "State" );
68static AttributeName MetaCalculateInvisibleStates( "CalculateInvisibleStates" );
69static AttributeName MetaPickInvisibleStates( "PickInvisibleStates" );
70static AttributeName MetaPredrawInvisibleStates( "PreDrawInvisibleStates" );
71static AttributeName MetaInputDeviceBehavior( "InputDeviceBehavior" );
72
73// SetValue enumerations
74enum
75{
76 GLS_MUTEX_GROUP_STATE = GLS_LAST_INITIALIZER + 1,
77 GLS_MUTEX_GROUP_CALC_INVISIBLE_STATES,
78 GLS_MUTEX_GROUP_PICK_INVISIBLE_STATES,
79 GLS_MUTEX_GROUP_PREDRAW_INVISIBLE_STATES,
80 GLS_MUTEX_GROUP_INPUT_DEVICE_BEHAVIOR
81};
82
83#ifdef GLES
84class GlsGloFileAttribute;
85#endif
86
87/** Runtime implementation of a GlsMutexGroup */
88class GlsMutexGroup : public Group
89{
90private:
93
94public:
95 friend class GlsMutexGroupEditor;
96 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
97 typedef Group _BaseClass; ///< Deprecated typedef for the base class.
98 typedef Group BaseClass; ///< Typedef for the base class.
99
100 /** Create a new GlsMutexGroup.
101 * \param generateInstance Whether or not to generate an instance name
102 * for this mutex group */
103 GLSGEN_GLSMUTEXGROUP_EXPORT GlsMutexGroup( bool generateInstance = false );
104
105 /// Copy constructor
106 /// \param that The object to copy from.
107 /// \param generateNames Whether or not to generate an instance name.
108 GLSGEN_GLSMUTEXGROUP_EXPORT GlsMutexGroup( const GlsMutexGroup& that, const bool generateNames );
109
110 /** Destructs a GlsMutexGroup object */
112
113 /// \return A pointer to a new GlsMutexGroup object.
115
119
120#ifndef GLES
123#endif
124
128
130 const Vector& logicalCoords,
131 float scale,
132 const Vector& directionVector,
133 Vector& collisionWinLoc /*Returned*/,
134 const OpenGLMatrices& drawnMatrices ) DISTI_METHOD_OVERRIDE;
135
138
139 //////////////////////////////////////////////////
140 // GlsMutexGroup specific operations
141 //////////////////////////////////////////////////
142
143 /** \return The mutex state of this group, -1 = none */
144 int MutexState() const { return _state; }
145
146 /** Sets the mutex state of this group, -1 = none
147 * \param state The new mutex state
148 */
150
151 // For legacy InputDevices
152 /** \return The InputDevice state of this group, 1 to N */
153 int State() { return _state; }
154
155 // For legacy InputDevices
156 /** Sets the InputDevice state of this group, 1 to N.
157 * \param state The new InputDevice state
158 */
160
161 /** \return The calculate option of this group, true = calculate all objects, false = calculate active object only */
163
164 /** Sets the calculate option of this group
165 * \param value The new calculate option, true = calculate all objects, false = calculate active object only
166 */
168
169 /** \return The picking option of this group, true = pick all objects, false = pick active object only */
171
172 /** Sets the picking option of this group
173 * \param value The new picking option, true = pick all objects, false = pick active object only
174 */
176
177 /** \return The predraw option of this group, true = predraw all objects, false = predraw active object only */
179
180 /** Sets the predraw option of this group
181 * \param value The new predraw option, true = predraw all objects, false = predraw active object only
182 */
184
185 /** \return Simulate the legacy InputDevice behavior, where state 0 is always shown and the state is one-based. */
187
188 /** Sets the simulation of legacy InputDevice behavior, where state 0 is always shown
189 * \param value True = InputDevice, False = MutexGroup
190 */
192
193protected:
194 /// \return True if the incoming state index is valid for this mutex group.
195 /// \param state The index to test.
196 bool ValidMutexState( const int state ) const
197 {
198 return ( state >= 0 && state < (int)( _objects.Count() ) );
199 }
200
201 /// \return True if the incoming legacy input device state index is valid for this mutex group.
202 /// \param state The index to test.
203 bool ValidInputDeviceState( const int state ) const
204 {
205 // 0 is not a valid state
206 return ( state > 0 && state < (int)( _objects.Count() ) );
207 }
208
209 /// Helper routine for Pick3D, \see Pick3D
210 /// \note Not normally called by users.
211 /// \param winLoc Device coordinates for the mouse click. Z value should be set to 0 to ensure pick ray starts at near clip plane.
212 /// \param logicalCoords The start of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
213 /// \param scale Current window scale. Affects picking radius of outlines. Initial value should typically be 1.0.
214 /// \param directionVector The direction of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
215 /// \param collisionWinLoc Returns where the pick vector intersects the object that is hit in device coordinates.
216 /// \param drawnMatrices The matrices used to draw the object, including matrices set by parents that may have
217 /// dynamically rotated, translated or scaled this object. Initial value should typically be a default OpenGLMatrices() object.
218 /// \return The object that was hit, or NULL if no object hit.
220 const Vector& logicalCoords,
221 float scale,
222 const Vector& directionVector,
223 Vector& collisionWinLoc /*Returned*/,
224 const OpenGLMatrices& drawnMatrices );
225
226#ifdef GLES
227 /** Set a single attribute from the GLO file.
228 * \param data The attribute to set and its associated data.
229 */
231#endif
232
233 bool _inputDevice; ///< True = InputDevice functionality (state 0 always showing)
234 ///< False = MutexGroup functionality
235
236 int _state; ///< The index of the currently active object in the group, 0 to N, anything else = none
237
238 bool _calculateInvisibleStates; ///< Whether or not to call calculate on invisible states.
239 bool _pickInvisibleStates; ///< Whether or not to call pick on invisible states.
240 bool _predrawInvisibleStates; ///< Whether or not to call predraw on invisible states.
241};
242
243} // namespace disti
244
245#endif
Definition: cull.h:49
Definition: display.h:95
Definition: dynamic_array.h:79
unsigned Count() const
Definition: dynamic_array.h:218
Definition: gls_glo_file.h:1241
Definition: gls_mutex_group.h:89
bool InputDeviceBehavior()
Definition: gls_mutex_group.h:186
bool _predrawInvisibleStates
Whether or not to call predraw on invisible states.
Definition: gls_mutex_group.h:240
void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
DisplayObject * Pick3DUtil(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices)
bool PickInvisibleStates()
Definition: gls_mutex_group.h:170
void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
void State(int state)
int _state
The index of the currently active object in the group, 0 to N, anything else = none.
Definition: gls_mutex_group.h:236
void PickInvisibleStates(bool value)
bool ValidInputDeviceState(const int state) const
Definition: gls_mutex_group.h:203
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
void MutexState(int state)
bool CalculateInvisibleStates()
Definition: gls_mutex_group.h:162
int MutexState() const
Definition: gls_mutex_group.h:144
bool _calculateInvisibleStates
Whether or not to call calculate on invisible states.
Definition: gls_mutex_group.h:238
void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
static DisplayObject * CreateInstance()
void Draw() DISTI_METHOD_OVERRIDE
void PreDrawInvisibleStates(bool value)
bool IsVisibleInScene(const DisplayObject *obj=NULL) const DISTI_METHOD_OVERRIDE
bool ValidMutexState(const int state) const
Definition: gls_mutex_group.h:196
virtual DisplayObject * Pick3D(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices) DISTI_METHOD_OVERRIDE
bool _inputDevice
Definition: gls_mutex_group.h:233
int State()
Definition: gls_mutex_group.h:153
void Calculate(double time) DISTI_METHOD_OVERRIDE
DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
void CalculateInvisibleStates(bool value)
InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
bool _pickInvisibleStates
Whether or not to call pick on invisible states.
Definition: gls_mutex_group.h:239
void InputDeviceBehavior(bool value)
bool PreDrawInvisibleStates()
Definition: gls_mutex_group.h:178
Definition: group.h:52
DisplayObjectArray _objects
The objects contained in this group.
Definition: group.h:80
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:540
Definition: vertex.h:84
The gls_auto_lib.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:245
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:487
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:221
#define GLSGEN_GLSMUTEXGROUP_EXPORT
Provides support for creating DLLs.
Definition: gls_mutex_group.h:54
The disti::Group class. Implements groups of objects.
Definition: bmpimage.h:46