GL Studio C++ Runtime API
gls_dynamic_path.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsDynamicPath class and global enumerations.
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 _GLSDYNAMICPATH_H
41#define _GLSDYNAMICPATH_H
42
44#include "group.h"
45
46/// Provides support for creating DLLs.
47#if( defined( GLSGEN_EXPORT_GLSDYNAMICPATH ) || defined( GLSGEN_IMPORT_GLSDYNAMICPATH ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
48 && defined( _MSC_VER )
49# if defined( GLSGEN_EXPORT_GLSDYNAMICPATH ) || defined( GLS_EXPORT_GENERATED )
50# define GLSGEN_GLSDYNAMICPATH_EXPORT __declspec( dllexport )
51# else
52# define GLSGEN_GLSDYNAMICPATH_EXPORT __declspec( dllimport )
53# endif
54#else
55# define GLSGEN_GLSDYNAMICPATH_EXPORT
56#endif
57///////////////////////////////////////////////////////////////////////////////
58
59/// Automatically link the runtime library plugin (on Windows).
60#define LIB_BASE_NAME "gls_dynamic_path"
61#include "gls_auto_lib.h"
62#undef LIB_BASE_NAME
63
64namespace disti
65{
66// SetValue enumerations
67enum
68{
69 GLS_DYNAMICPATH_FIRST_VALUE = GLS_LAST_INITIALIZER + 1,
70 GLS_DYNAMICPATH_AFFECTS_LOCATION_X,
71 GLS_DYNAMICPATH_AFFECTS_LOCATION_Y,
72 GLS_DYNAMICPATH_AFFECTS_LOCATION_Z,
73 GLS_DYNAMICPATH_AFFECTS_ROTATION_X,
74 GLS_DYNAMICPATH_AFFECTS_ROTATION_Y,
75 GLS_DYNAMICPATH_AFFECTS_ROTATION_Z,
76 GLS_DYNAMICPATH_AFFECTS_SCALE_X,
77 GLS_DYNAMICPATH_AFFECTS_SCALE_Y,
78 GLS_DYNAMICPATH_AFFECTS_SCALE_Z,
79 GLS_DYNAMICPATH_USE_SHORT_ROTATION_PATHS,
80 GLS_DYNAMICPATH_STATE_COUNT,
81 GLS_DYNAMICPATH_STATE
82};
83
84/** Runtime implementation of a GlsDynamicPath */
86{
87 friend class GlsDynamicPathEditor;
88
89private:
92
93public:
94 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
95 typedef DisplayObject _BaseClass; ///< Deprecated typedef for the base class.
96 typedef DisplayObject BaseClass; ///< Typedef for the base class.
97
98 /** Create a new GlsDynamicPath.
99 * \param generateInstanceName Whether or not to generate an instance name
100 * for this inputdevice */
101 GLSGEN_GLSDYNAMICPATH_EXPORT GlsDynamicPath( bool generateInstanceName = false );
102
103 /** The copy constructor for GlsDynamicPath
104 *
105 * \param that The GlsDynamicPath object that is being copied
106 * \param generateNames Whether or not to generate a new instance name
107 */
108 GLSGEN_GLSDYNAMICPATH_EXPORT GlsDynamicPath( const GlsDynamicPath& that, const bool generateNames );
109
110 /** Destructs a GlsDynamicPath object */
112
113 /// \return A pointer to a new GlsDynamicPath object.
115
119
120#ifndef GLES
123#endif
124
128 virtual GLSGEN_GLSDYNAMICPATH_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint ) DISTI_METHOD_OVERRIDE;
129 virtual GLSGEN_GLSDYNAMICPATH_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
132
133 //////////////////////////////////////////////////
134 // GlsDynamicPath specific operations
135 //////////////////////////////////////////////////
136
137 /// Set whether the path will affect the X component of the object's dynamic translation.
138 /// \param value The new component value.
140
141 /// \return Whether the path will affect the X component of the object's dynamic translation.
143
144 /// Set whether the path will affect the Y component of the object's dynamic translation.
145 /// \param value The new component value.
147
148 /// \return Whether the path will affect the Y component of the object's dynamic translation.
150
151 /// Set whether the path will affect the Z component of the object's dynamic translation.
152 /// \param value The new component value.
154
155 /// \return Whether the path will affect the Z component of the object's dynamic translation.
157
158 /// Set whether the path will affect the X component of the object's dynamic rotation.
159 /// \param value The new component value.
161
162 /// \return Whether the path will affect the X component of the object's dynamic rotation.
164
165 /// Set whether the path will affect the Y component of the object's dynamic rotation.
166 /// \param value The new component value.
168
169 /// \return Whether the path will affect the Y component of the object's dynamic rotation.
171
172 /// Set whether the path will affect the Z component of the object's dynamic rotation.
173 /// \param value The new component value.
175
176 /// \return Whether the path will affect the Z component of the object's dynamic rotation.
178
179 /// Set whether the path will affect the X component of the object's dynamic scale.
180 /// \param value The new component value.
182
183 /// \return Whether the path will affect the X component of the object's dynamic scale.
185
186 /// Set whether the path will affect the Y component of the object's dynamic scale.
187 /// \param value The new component value.
189
190 /// \return Whether the path will affect the Y component of the object's dynamic scale.
192
193 /// Set whether the path will affect the Z component of the object's dynamic scale.
194 /// \param value The new component value.
196
197 /// \return Whether the path will affect the Z component of the object's dynamic scale.
199
200 /// If true, the shortest path between rotations is taken (360 degrees = no net rotation). If false, the long path is taken.
201 /// \param value The new rotation behavior.
203
204 /// \return True if the shortest path between rotations is taken (360 degrees = no net rotation), otherwise false.
206
207 /// \details The State class. Contains the data for a state along the path.
208 class State
209 {
210 friend class GlsDynamicPath;
211
212 public:
214
215 /// Copy constructor
217
219
220 /// Assignment operator
221 /// \return The resulting object (this).
223
224 /// Sets up DistiAttributes associated with each member of this class.
226
227 /// \return The attribute dictionary associated with the members of this class.
229 {
230 if( !_attribDict )
232 return *_attribDict;
233 };
234
235 /// Set the location value of this animation state.
236 /// \param value The new location value.
237 void Location( const Vector& value ) { _location = value; }
238
239 /// \deprecated Use the const version instead.
240 /// \return The location value of this animation state.
242
243 /// \return The location value of this animation state.
244 Vector Location() const { return _location; }
245
246 /// Set the rotation value of this animation state.
247 /// \param value The new rotation value.
248 void Rotation( const Vector& value ) { _rotation = value; }
249
250 /// \deprecated Use the const version instead.
251 /// \return The rotation value of this animation state.
253
254 /// \return The rotation value of this animation state.
255 Vector Rotation() const { return _rotation; }
256
257 /// Set the scale value of this animation state.
258 /// \param value The new scale value.
259 void Scale( const Vector& value ) { _scale = value; }
260
261 /// \deprecated Use the const version instead.
262 /// \return The scale value of this animation state.
263 Vector Scale() { return _scale; }
264
265 /// \return The scale value of this animation state.
266 Vector Scale() const { return _scale; }
267
268 /// Set the key value of this animation state
269 /// \param value The new key value.
270 void Value( const float& value ) { _value = value; }
271
272 /// \deprecated Use the const version instead.
273 /// \return The key value of this animation state.
274 float Value() { return _value; }
275
276 /// \return The key value of this animation state.
277 float Value() const { return _value; }
278
279 protected:
280 Vector _location; ///< The location of the animation state.
281 Vector _rotation; ///< The rotation of the animation state.
282 Vector _scale; ///< The scale of the animation state.
283 float _value; ///< The key value of the animation state.
284 DistiAttribDict* _attribDict; ///< Attribute storage for the members of this class.
285 };
286
287 typedef DynamicArray<State> StateArrayType; ///< Typedef for a list of States.
288
289 /// \returns the StateArray associated with this object. Use this array to modify the states that make up the path.
291
292 /// \returns the const StateArray associated with this object.
293 const StateArrayType& StateArray() const { return _stateArray; }
294
295 /// Iterates through the path segments and returns the first one found
296 /// that contains the given value.
297 /// Special cases:
298 /// value is before start of the path: index1 == index2 == 0
299 /// value is past the end of the path: index1 == index2 == (StateArray().Count()-1)
300 /// \param value The value to search for.
301 /// \param index1 Returns the index of the state at the start of the segment or -1 if no segments are found.
302 /// \param index2 Returns the index of the state at the end the segment or -1 if no segments are found.
303 GLSGEN_GLSDYNAMICPATH_EXPORT void FindFirstPathSegmentContainingValue( float value, int* index1, int* index2 );
304
305 /// \return The Value for the first state or 0 if there are no states.
307 {
308 if( _stateArray.Count() )
309 {
310 return _stateArray[ 0 ].Value();
311 }
312 else
313 {
314 return 0;
315 }
316 }
317
318 /// \return The Value for the last state or 0 if there are no states.
320 {
321 if( _stateArray.Count() )
322 {
323 return _stateArray[ _stateArray.Count() - 1 ].Value();
324 }
325 else
326 {
327 return 0;
328 }
329 }
330
331 /// \return The linearly interpolated location along the path for the given value.
332 /// \param value The value used to get the path location.
334
335 /// \return The linearly interpolated rotation along the path for the given value.
336 /// \param value The value used to get the path rotation.
338
339 /// \return The linearly interpolated scale along the path for the given value.
340 /// \param value The value used to get the path scale.
342
343 /** Moves a DisplayObject to the position along the path corresponding with the given value.
344 * \param obj the DisplayObject to move
345 * \param value The value used to position the object on the path
346 */
348
349 /** Sets the object to the position corresponding with the given state.
350 * Which values are applied is controlled by the AffectsLocation* and AffectsRotation* properties.
351 * \param obj Pointer to the object to move.
352 * \param stateNumber The index of the state to set the object to. If this value is outside the range [0,StateArray().Count()-1] nothing is done.
353 */
355
356protected:
357#ifdef GLES
358 /** Set a single attribute from the GLO file.
359 * \param data The attribute to set and its associated data.
360 */
361 virtual GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
362#endif
363
364 bool _affectsLocationX; ///< If true, this path will affect an object's X location.
365 bool _affectsLocationY; ///< If true, this path will affect an object's Y location.
366 bool _affectsLocationZ; ///< If true, this path will affect an object's Z location.
367 bool _affectsRotationX; ///< If true, this path will affect an object's X rotation.
368 bool _affectsRotationY; ///< If true, this path will affect an object's Y rotation.
369 bool _affectsRotationZ; ///< If true, this path will affect an object's Z rotation.
370 bool _affectsScaleX; ///< If true, this path will affect an object's X scale.
371 bool _affectsScaleY; ///< If true, this path will affect an object's Y scale.
372 bool _affectsScaleZ; ///< If true, this path will affect an object's Z scale.
373
374 bool _useShortRotationPaths; ///< If true, this state will rotate in the direction that will reach the desired angle the fastest.
375
376 StateArrayType _stateArray; ///< The list of animation states for this path.
377};
378
379} // namespace disti
380
381#endif
Definition: cull.h:50
Definition: events.h:113
Definition: display.h:96
Definition: disti_metadata.h:734
Definition: disti_metadata.h:220
Definition: dynamic_array.h:79
unsigned Count() const
Definition: dynamic_array.h:218
Definition: gls_dynamic_path.h:209
void Value(const float &value)
Definition: gls_dynamic_path.h:270
void Scale(const Vector &value)
Definition: gls_dynamic_path.h:259
void Location(const Vector &value)
Definition: gls_dynamic_path.h:237
Vector Scale() const
Definition: gls_dynamic_path.h:266
Vector Location()
Definition: gls_dynamic_path.h:241
Vector Rotation() const
Definition: gls_dynamic_path.h:255
float _value
The key value of the animation state.
Definition: gls_dynamic_path.h:283
float Value() const
Definition: gls_dynamic_path.h:277
Vector Scale()
Definition: gls_dynamic_path.h:263
State(const State &)
Copy constructor.
void MakeAttribDict()
Sets up DistiAttributes associated with each member of this class.
Vector _rotation
The rotation of the animation state.
Definition: gls_dynamic_path.h:281
float Value()
Definition: gls_dynamic_path.h:274
Vector Rotation()
Definition: gls_dynamic_path.h:252
Vector Location() const
Definition: gls_dynamic_path.h:244
DistiAttribDict & Attributes()
Definition: gls_dynamic_path.h:228
Vector _scale
The scale of the animation state.
Definition: gls_dynamic_path.h:282
DistiAttribDict * _attribDict
Attribute storage for the members of this class.
Definition: gls_dynamic_path.h:284
const State & operator=(const State &)
Vector _location
The location of the animation state.
Definition: gls_dynamic_path.h:280
void Rotation(const Vector &value)
Definition: gls_dynamic_path.h:248
Definition: gls_dynamic_path.h:86
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
const StateArrayType & StateArray() const
Definition: gls_dynamic_path.h:293
bool AffectsRotationZ() const
Definition: gls_dynamic_path.h:177
DynamicArray< State > StateArrayType
Typedef for a list of States.
Definition: gls_dynamic_path.h:287
bool _affectsScaleZ
If true, this path will affect an object's Z scale.
Definition: gls_dynamic_path.h:372
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
void FindFirstPathSegmentContainingValue(float value, int *index1, int *index2)
virtual void Draw() DISTI_METHOD_OVERRIDE
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
bool AffectsScaleZ() const
Definition: gls_dynamic_path.h:198
bool _affectsLocationY
If true, this path will affect an object's Y location.
Definition: gls_dynamic_path.h:365
bool AffectsLocationY() const
Definition: gls_dynamic_path.h:149
bool AffectsScaleY() const
Definition: gls_dynamic_path.h:191
bool AffectsRotationY() const
Definition: gls_dynamic_path.h:170
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
Vector GetPathRotation(float value)
virtual bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint) DISTI_METHOD_OVERRIDE
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
bool _affectsRotationY
If true, this path will affect an object's Y rotation.
Definition: gls_dynamic_path.h:368
bool _affectsRotationX
If true, this path will affect an object's X rotation.
Definition: gls_dynamic_path.h:367
virtual DisplayObject * handle(DisplayEvent *ev) DISTI_METHOD_OVERRIDE
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
StateArrayType _stateArray
The list of animation states for this path.
Definition: gls_dynamic_path.h:376
virtual void GetResources(std::ostream &outstr, GlsResourceFilter *filter) DISTI_METHOD_OVERRIDE
void AffectsScaleY(const bool &value)
void UseShortRotationPaths(const bool &value)
void MoveObjectToState(DisplayObject *obj, int stateNumber)
bool AffectsRotationX() const
Definition: gls_dynamic_path.h:163
float FirstStateValue()
Definition: gls_dynamic_path.h:306
static DisplayObject * CreateInstance()
void AffectsRotationZ(const bool &value)
bool _useShortRotationPaths
If true, this state will rotate in the direction that will reach the desired angle the fastest.
Definition: gls_dynamic_path.h:374
Vector GetPathLocation(float value)
virtual DistiAttributeBase & Resource(const char *name) DISTI_METHOD_OVERRIDE
bool _affectsRotationZ
If true, this path will affect an object's Z rotation.
Definition: gls_dynamic_path.h:369
bool _affectsLocationZ
If true, this path will affect an object's Z location.
Definition: gls_dynamic_path.h:366
void AffectsRotationX(const bool &value)
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
bool UseShortRotationPaths() const
Definition: gls_dynamic_path.h:205
void MoveObject(DisplayObject *obj, float value)
bool AffectsLocationX() const
Definition: gls_dynamic_path.h:142
Vector GetPathScale(float value)
bool _affectsScaleY
If true, this path will affect an object's Y scale.
Definition: gls_dynamic_path.h:371
bool _affectsLocationX
If true, this path will affect an object's X location.
Definition: gls_dynamic_path.h:364
bool AffectsLocationZ() const
Definition: gls_dynamic_path.h:156
void AffectsRotationY(const bool &value)
void AffectsScaleZ(const bool &value)
void AffectsScaleX(const bool &value)
bool _affectsScaleX
If true, this path will affect an object's X scale.
Definition: gls_dynamic_path.h:370
StateArrayType & StateArray()
Definition: gls_dynamic_path.h:290
void AffectsLocationZ(const bool &value)
float LastStateValue()
Definition: gls_dynamic_path.h:319
bool AffectsScaleX() const
Definition: gls_dynamic_path.h:184
void AffectsLocationY(const bool &value)
Definition: gls_glo_file.h:1243
Definition: gls_resources.h:51
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_GLSDYNAMICPATH_EXPORT
Provides support for creating DLLs.
Definition: gls_dynamic_path.h:55
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
The disti::Group class. Implements groups of objects.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47