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