GL Studio C++ Runtime API
gls_path_manager.h
Go to the documentation of this file.
1/// \file gls_path_manager.h
2/// \brief The disti::GlsPathManager class and global enumerations.
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_GLS_PATH_MANAGER_H
40#define INCLUDED_GLS_PATH_MANAGER_H
41
43#include "gls_dynamic_path.h"
44#include "group.h"
45
46// Windows #defines this symbol which we use
47#if defined( WIN32 ) && defined( GetObject )
48# undef GetObject
49#endif
50
51namespace disti
52{
53// SetValue enumerations
54enum
55{
56 GLS_PATHMANAGER_FIRST_VALUE = GLS_LAST_INITIALIZER + 1,
57 GLS_PATHMANAGER_PATHOBJPAIR_COUNT,
58 GLS_PATHMANAGER_PATHOBJPAIR,
59 GLS_PATHMANAGER_STRINGPATHOBJPAIR
60};
61
62/** Runtime implementation of a GlsPathManager */
64{
65 friend class GlsPathManagerEditor;
66
67private:
70
71public:
72 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
73 typedef DisplayObject _BaseClass; ///< Deprecated typedef for the base class.
74 typedef DisplayObject BaseClass; ///< Typedef for the base class.
75
76 /// Constructor
77 /// \param generateInstanceName Whether or not to generate an instance name for this object.
78 GLSGEN_GLSDYNAMICPATH_EXPORT GlsPathManager( bool generateInstanceName = false );
79
80 /// Copy constructor
81 /// \param that The object to copy from.
82 /// \param generateNames Whether or not to generate an instance name for this object.
83 GLSGEN_GLSDYNAMICPATH_EXPORT GlsPathManager( const GlsPathManager& that, const bool generateNames );
84
85 /** Destructs a GlsPathManager object */
87
88 /// \return A pointer to a new GlsPathManager object.
90
94
95#ifndef GLES
98#endif
99
101 GLSGEN_GLSDYNAMICPATH_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint ) DISTI_METHOD_OVERRIDE;
105
106 //////////////////////////////////////////////////
107 // GlsPathManager specific operations
108 //////////////////////////////////////////////////
109
110 /// \details The PathObjectPair class. Contains a dynamic path and the object that path animates.
112 {
113 public:
114 /// Constructor
116
117 /// Copy constructor
119
120 /// Destructor
122
123 /// Copy assignment
124 /// \return The resulting object (this).
126
127 /// Populates the attribute dictionary for this object.
128 /// \note Not normally called by users.
130
131 /// \return A reference to the attribute dictionary for this object.
133 {
134 if( !_attribDict )
135 MakeAttribDict();
136 return *_attribDict;
137 };
138
139 /// Assign a new GlsDynamicPath to this pair by name.
140 /// \param name The name of the new path to set.
141 void SetDynamicPathByName( const std::string& name )
142 {
143 _pathName = name;
144 }
145
146 /// \return The name of the path in this pair.
147 std::string GetDynamicPathName() const
148 {
149 return _path ? _path->InstanceName() : _pathName;
150 }
151
152 /// Assign a new GlsDynamicPath to this pair.
153 /// \param path The new path to set.
155 {
156 _path = path;
157 }
158
159 /// \return The path in this pair.
161 {
162 return _path;
163 }
164
165 /// Set the target object of this pair's animation.
166 /// \param object The new target object to set.
167 void SetObject( DisplayObject* object )
168 {
169 _object = object;
170 }
171
172 /// \return The target object of this pair.
174 {
175 return _object;
176 }
177#if !defined( GLES )
178 /// Assign a new GlsDynamicPath to this pair.
179 /// \deprecated Use single-pointer functions instead.
180 /// \param path The new path to set.
181 DISTI_DEPRECATED( "Use single-pointer functions instead." )
182 void SetDynamicPath( GlsDynamicPath** path )
183 {
184 _path = path ? *path : NULL;
185 }
186
187 /// Set the target object of this pair's animation.
188 /// \deprecated Use single-pointer functions instead.
189 /// \param object The new target object to set.
190 DISTI_DEPRECATED( "Use single-pointer functions instead." )
191 void SetObject( DisplayObject** object )
192 {
193 _object = object ? *object : NULL;
194 }
195#endif
196 /// Set the target object of this pair's animation by name.
197 /// \param name The name of the new target object to set.
198 void SetObjectByName( const std::string& name )
199 {
200 _objectName = name;
201 }
202
203 /// \return The name of the target object.
204 std::string GetObjectName() const
205 {
206 return _object ? _object->InstanceName() : _objectName;
207 }
208
209 protected:
210 // The *'s are for runtime (faster).
211 GlsDynamicPath* _path; ///< The path containing the animation data.
212 DisplayObject* _object; ///< The object to be animated by the path.
213
214 // the std::strings are for the editor (slower)
215 std::string _pathName; ///< The name of the path object.
216 std::string _objectName; ///< The name of the animation target object.
217
218 DistiAttribDict* _attribDict; ///< The attribute dictionary for the members of this object.
219 };
220
221 typedef DynamicArray<PathObjectPair> PathObjectPairArrayType; ///< Shorthand typedef for a list of path pairs.
222
223 /// Use this array to set which path goes with what object.
224 /// \return A modifiable reference to the PathObjectPairArray associated with this object.
226
227 /// \return A const reference to the PathObjectPairArray associated with this object.
229
230 /// Sets the animation value as a ratio of MinAnimationValue, MaxAnimationValue.
231 /// \param pct percent of animation (0.0 -> 1.0).
233
234 /// Move all of the objects in the PathObjectPairArray to the given value on the associated path.
235 /// \param value The value used to position the object on the path (see GlsDynamicPath::MoveObject).
237
238 /// Backwards compatibility method.
239 /// \see SetAnimationValue
240 /// \param value The animation value to set.
241 DISTI_DEPRECATED( "Renamed for clarity, use SetAnimationValue instead." )
242 void CurrentTimeValue( float value ) { SetAnimationValue( value ); }
243
244 /** Causes the MinAnimationValue and MaxAnimationValue to be recalculated using
245 * the paths in the PathObjectPairArray.
246 */
248
249 /** Returns the stored minimum animation value from the PathObjectPairArray.
250 * \see RecalcMinMaxValue
251 * \return The minimum animation value
252 */
254
255 /// Backwards compatibility method.
256 /// \see MinAnimationValue
257 /// \return The minimum animation value.
258 DISTI_DEPRECATED( "Renamed for clarity, use MinAnimationValue instead." )
259 float MinTimeValue() { return MinAnimationValue(); }
260
261 /** Returns the stored maximum animation value from the PathObjectPairArray.
262 * \see RecalcMinMaxValue
263 * \return The maximum animation value
264 */
266
267 /// Backwards compatibility method.
268 /// \see MaxAnimationValue
269 /// \return The maximum animation value.
270 DISTI_DEPRECATED( "Renamed for clarity, use MaxAnimationValue instead." )
271 float MaxTimeValue() { return MaxAnimationValue(); }
272
273protected:
274 PathObjectPairArrayType _pathObjectPairArray; ///< List of animation pairs to manage.
275
276 float _minValue; ///< The minimum animation key value.
277 float _maxValue; ///< The maximum animation key value.
278 bool _recalcValueBounds; ///< If true, _minValue and _maxValue will be recalculated.
279
280 /// Calculate the min and max value based on the animation pairs.
281 /// \note Not normally called by users.
283#ifdef GLES
284 /** Set a single attribute from the GLO file.
285 * \param data The attribute to set and its associated data.
286 */
287 GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
288#endif
289};
290
291} // namespace disti
292
293#endif
Definition: display.h:95
Definition: disti_metadata.h:750
Definition: disti_metadata.h:220
Definition: dynamic_array.h:79
Definition: gls_dynamic_path.h:85
Definition: gls_glo_file.h:1241
Definition: gls_path_manager.h:112
DisplayObject * GetObject() const
Definition: gls_path_manager.h:173
std::string _pathName
The name of the path object.
Definition: gls_path_manager.h:215
std::string GetObjectName() const
Definition: gls_path_manager.h:204
const PathObjectPair & operator=(const PathObjectPair &)
GlsDynamicPath * GetDynamicPath() const
Definition: gls_path_manager.h:160
void SetDynamicPath(GlsDynamicPath *path)
Definition: gls_path_manager.h:154
GlsDynamicPath * _path
The path containing the animation data.
Definition: gls_path_manager.h:211
void SetDynamicPathByName(const std::string &name)
Definition: gls_path_manager.h:141
void SetObject(DisplayObject *object)
Definition: gls_path_manager.h:167
std::string GetDynamicPathName() const
Definition: gls_path_manager.h:147
DisplayObject * _object
The object to be animated by the path.
Definition: gls_path_manager.h:212
PathObjectPair(const PathObjectPair &)
Copy constructor.
DistiAttribDict & Attributes()
Definition: gls_path_manager.h:132
std::string _objectName
The name of the animation target object.
Definition: gls_path_manager.h:216
DistiAttribDict * _attribDict
The attribute dictionary for the members of this object.
Definition: gls_path_manager.h:218
void SetObjectByName(const std::string &name)
Definition: gls_path_manager.h:198
Definition: gls_path_manager.h:64
void CurrentTimeValue(float value)
Definition: gls_path_manager.h:242
void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
DistiAttributeBase & Resource(const char *name) DISTI_METHOD_OVERRIDE
void SetAnimationValue(float value)
float MinTimeValue()
Definition: gls_path_manager.h:259
PathObjectPairArrayType & PathObjectPairArray()
Definition: gls_path_manager.h:225
void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
void GetResources(std::ostream &outstr, GlsResourceFilter *filter) DISTI_METHOD_OVERRIDE
void AnimationPct(double pct)
float _maxValue
The maximum animation key value.
Definition: gls_path_manager.h:277
static DisplayObject * CreateInstance()
void Draw() DISTI_METHOD_OVERRIDE
DynamicArray< PathObjectPair > PathObjectPairArrayType
Shorthand typedef for a list of path pairs.
Definition: gls_path_manager.h:221
float MaxTimeValue()
Definition: gls_path_manager.h:271
bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint) DISTI_METHOD_OVERRIDE
bool _recalcValueBounds
If true, _minValue and _maxValue will be recalculated.
Definition: gls_path_manager.h:278
const PathObjectPairArrayType & PathObjectPairArray() const
Definition: gls_path_manager.h:228
float _minValue
The minimum animation key value.
Definition: gls_path_manager.h:276
DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
PathObjectPairArrayType _pathObjectPairArray
List of animation pairs to manage.
Definition: gls_path_manager.h:274
InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
Definition: gls_resources.h:49
Definition: vertex.h:84
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
The disti::GlsDynamicPath class and global enumerations.
#define GLSGEN_GLSDYNAMICPATH_EXPORT
Provides support for creating DLLs.
Definition: gls_dynamic_path.h:54
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:50
The disti::Group class. Implements groups of objects.
Definition: bmpimage.h:46