GL Studio C++ Runtime API
gls_odometer.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsOdometer 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 _GLSODOMETER_H
41#define _GLSODOMETER_H
42
44#include "group.h"
45
46/// Provides support for creating DLLs.
47#if( defined( GLSGEN_EXPORT_GLSODOMETER ) || defined( GLSGEN_IMPORT_GLSODOMETER ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
48 && defined( _MSC_VER )
49# if defined( GLSGEN_EXPORT_GLSODOMETER ) || defined( GLS_EXPORT_GENERATED )
50# define GLSGEN_GLSODOMETER_EXPORT __declspec( dllexport )
51# else
52# define GLSGEN_GLSODOMETER_EXPORT __declspec( dllimport )
53# endif
54#else
55# define GLSGEN_GLSODOMETER_EXPORT
56#endif
57///////////////////////////////////////////////////////////////////////////////
58
59/// Automatically link the runtime library plugin (on Windows).
60#define LIB_BASE_NAME "gls_odometer"
61#include "gls_auto_lib.h"
62#undef LIB_BASE_NAME
63
64namespace disti
65{
66enum
67{
68 GLS_GLSODOMETER_VALUE = GLS_LAST_INITIALIZER + 1,
69 GLS_GLSODOMETER_MIN_VALUE,
70 GLS_GLSODOMETER_MAX_VALUE,
71 GLS_GLSODOMETER_BASE_SYSTEM,
72 GLS_GLSODOMETER_BEHAVIOR_TYPE,
73 GLS_GLSODOMETER_GEOMETRY_TYPE,
74 GLS_GLSODOMETER_TEXTURE_SCALE,
75 GLS_GLSODOMETER_DEGREES_PER_DIGIT
76};
77
78/** Runtime implementation of a GlsOdometer */
79class GlsOdometer : public Group
80{
81 friend class GlsOdometerEditor;
82
83private:
86
87public:
88 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
89 typedef Group _BaseClass; ///< Deprecated typedef for the base class.
90 typedef Group BaseClass; ///< Typedef for the base class.
91
92 /// Constructor
93 /// \param generateInstance Whether or not to generate an instance name for this object.
94 GLSGEN_GLSODOMETER_EXPORT GlsOdometer( bool generateInstance = false );
95
96 /// Copy constructor
97 /// \param that The object to copy from.
98 /// \param generateNames Whether or not to generate an instance name for this object.
99 GLSGEN_GLSODOMETER_EXPORT GlsOdometer( const GlsOdometer& that, const bool generateNames );
100
101 /** Destructs a GlsOdometer object */
103
104 /// \return A pointer to a new GlsOdometer object.
106
110
111#ifndef GLES
114#endif
115
117 virtual GLSGEN_GLSODOMETER_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler ) DISTI_METHOD_OVERRIDE;
119 virtual GLSGEN_GLSODOMETER_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
120
121 //////////////////////////////////////////////////
122 // GlsOdometer specific declarations
123 //////////////////////////////////////////////////
124
125 /// \details The GlsOdometerBehaviorType enumeration. Controls the scroll behavior of the odometer texture.
126 typedef enum
127 {
128 BEHAVIOR_ANALOG = 0,
129 BEHAVIOR_DIGITAL
131
132 /// \details The GlsOdometerGeometryType enumeration. Controls the whether the odometer should scroll a texture, or rotate geometry.
133 typedef enum
134 {
135 GEOMETRY_2D = 0,
136 GEOMETRY_3D
138
139 /// Set the maximum displayable value.
140 /// \param value The new maximum value to set.
141 GLSGEN_GLSODOMETER_EXPORT void MaxValue( const float& value );
142
143 /// \return The maximum displayable value.
145
146 /// Set the minimum displayable value.
147 /// \param value The new minimum value to set.
148 GLSGEN_GLSODOMETER_EXPORT void MinValue( const float& value );
149
150 /// \return The minimum displayable value.
152
153 /// Set the current value to be displayed by the odometer.
154 /// This value is limited by MaxValue() and MinValue().
155 /// \param value The new value to set.
156 GLSGEN_GLSODOMETER_EXPORT void Value( const float& value );
157
158 /// \return The current value of the odometer.
160
161 /// Set the base number system for this odometer.
162 /// The default is base 10.
163 /// \param value The new base system to set.
164 virtual GLSGEN_GLSODOMETER_EXPORT void BaseSystem( const int& value );
165
166 /// \return The base number system for this odometer.
168
169 /// Set the BehaviorType controls the "Rollover" behavior of the odometer.
170 /// BEHAVIOR_ANALOG - Wheels will roll between numbers based on the RolloverThreshold
171 /// BEHAVIOR_DIGITAL - Wheels will display only whole numbers.
172 /// \param value The new rollover behavior to set.
174
175 /// \return The BehaviorType controls the "Rollover" behavior of the odometer.
177
178 /// Set the GeometryType controls the method used to "move" the wheels.
179 /// GEOMETRY_2D - Texture is translated on the object based on the TextureScale.
180 /// GEOMETRY_3D - The wheels are rotated about the Y-AXIS of the DCS based on the value of DegreesPerDigit.
181 /// \param value The new "movement" behavior to set.
183
184 /// \return The GeometryType method used to "move" the wheels.
186
187 /// Set the TextureScale which is the amount that the texture should move for each digit.
188 /// The formula to determine this is: (Pixels per digit)/(Texture height).
189 /// This value is only used when GeometryType == GEOMETRY_2D.
190 /// \param value The new texture movement amount to set.
191 GLSGEN_GLSODOMETER_EXPORT void TextureScale( const float& value );
192
193 /// \return The TextureScale, the amount that the texture should move for each digit.
195
196 /// Set the DegreesPerDigit which is the number of degrees the wheels should be rotated for each digit.
197 /// This value is only used when GeometryType == GEOMETRY_3D.
198 /// \param value The new geometry rotation amount to set.
199 GLSGEN_GLSODOMETER_EXPORT void DegreesPerDigit( const float& value );
200
201 /// \return The DegreesPerDigit, the number of degrees the wheels should be rotated for each digit.
203
204 /// \return The order of magnitude (number of digits) the odometer can have.
206
207 /// \return The amount required to make the first digit roll over by one.
209
210protected:
211 int _orderOfMagnitude; ///< The number of digits (zeroes) the odometer can have.
212 float _textureScale; ///< The amount in texture coordinates to move for each digit. GeometryType == GEOMETRY_2D
213 float _degreesPerDigit; ///< The amount to rotate the geometry for each digit. GeometryType == GEOMETRY_3D
214 float _rolloverThreshold; ///< The amount required to make the first digit roll over by one.
215
216 float _minValue; ///< The minimum value that can be represented on the wheels.
217 float _maxValue; ///< The maximum value that can be represented on the wheels.
218 int _baseSystem; ///< The base system represented, e.g. base 10.
219 float _currentValue; ///< The current value displayed on the wheels.
220 GlsOdometerBehaviorType _behavior; ///< The "rollover" behavior in use.
221 GlsOdometerGeometryType _geometry; ///< The "movement" behavior in use.
222
223 /// \details The TexturePoints class. Used for storing the initial texture position of the GlsOdometer.
225 {
226 public:
227 Vector v1; ///< The bottom left corner.
228 Vector v2; ///< The bottom right corner.
229 Vector v3; ///< The top right corner.
230 Vector v4; ///< The top left corner.
231 };
232
233 DynamicArray<TexturePoints> _startLoc; ///< A list of start texture locations, one for each wheel.
234 bool _textureLocSaved; ///< True denotes that the texture locations have been saved off.
235
236 /// Sets the current order of magnitude (number of zeroes)
237 /// \note Not normally called by users.
238 /// \param value The new magnitude value to set.
239 void OrderOfMagnitude( const int& value );
240
241 /// Sets the rollover threshold (amount needed to move the first wheel by one)
242 /// \note Not normally called by users.
243 /// \param value The new rollover value to set.
244 void RolloverThreshold( const float& value );
245
246 /// Helper function that recalculates _orderOfMagnitude.
247 /// \note Not normally called by users.
249
250 /// Helper function that recalculates _rolloverThreshold.
251 /// \note Not normally called by users.
253
254 /// Sets the current texture coordinates as the zero position for the wheels.
255 /// \note Not normally called by users.
257
258#ifdef GLES
259 /** Set a single attribute from the GLO file.
260 * \param data The attribute to set and its associated data.
261 */
262 virtual GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
263#endif
264};
265
266} // namespace disti
267
268#endif
Definition: cull.h:50
Definition: events.h:113
Definition: display.h:96
Definition: dynamic_array.h:79
Definition: gls_glo_file.h:1243
Definition: gls_odometer.h:225
Vector v4
The top left corner.
Definition: gls_odometer.h:230
Vector v2
The bottom right corner.
Definition: gls_odometer.h:228
Vector v3
The top right corner.
Definition: gls_odometer.h:229
Vector v1
The bottom left corner.
Definition: gls_odometer.h:227
Definition: gls_odometer.h:80
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
float _rolloverThreshold
The amount required to make the first digit roll over by one.
Definition: gls_odometer.h:214
virtual void BaseSystem(const int &value)
void CalculateRolloverThreshold()
void Value(const float &value)
float _degreesPerDigit
The amount to rotate the geometry for each digit. GeometryType == GEOMETRY_3D.
Definition: gls_odometer.h:213
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
GlsOdometerGeometryType
Definition: gls_odometer.h:134
virtual void Draw() DISTI_METHOD_OVERRIDE
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
virtual float DegreesPerDigit()
virtual float Value()
GlsOdometerBehaviorType _behavior
The "rollover" behavior in use.
Definition: gls_odometer.h:220
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
virtual GlsOdometerGeometryType GeometryType()
void RolloverThreshold(const float &value)
void GeometryType(const GlsOdometerGeometryType value)
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
void OrderOfMagnitude(const int &value)
virtual float MaxValue()
GlsOdometerBehaviorType
Definition: gls_odometer.h:127
virtual DisplayObject * handle(DisplayEvent *ev) DISTI_METHOD_OVERRIDE
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
void MaxValue(const float &value)
void BehaviorType(const GlsOdometerBehaviorType value)
int _orderOfMagnitude
The number of digits (zeroes) the odometer can have.
Definition: gls_odometer.h:211
virtual GlsOdometerBehaviorType BehaviorType()
float _maxValue
The maximum value that can be represented on the wheels.
Definition: gls_odometer.h:217
float _textureScale
The amount in texture coordinates to move for each digit. GeometryType == GEOMETRY_2D.
Definition: gls_odometer.h:212
virtual float MinValue()
static DisplayObject * CreateInstance()
DynamicArray< TexturePoints > _startLoc
A list of start texture locations, one for each wheel.
Definition: gls_odometer.h:233
void MinValue(const float &value)
void DegreesPerDigit(const float &value)
virtual float TextureScale()
virtual float RolloverThreshold() const
virtual int OrderOfMagnitude() const
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
float _minValue
The minimum value that can be represented on the wheels.
Definition: gls_odometer.h:216
bool _textureLocSaved
True denotes that the texture locations have been saved off.
Definition: gls_odometer.h:234
float _currentValue
The current value displayed on the wheels.
Definition: gls_odometer.h:219
int _baseSystem
The base system represented, e.g. base 10.
Definition: gls_odometer.h:218
GlsOdometerGeometryType _geometry
The "movement" behavior in use.
Definition: gls_odometer.h:221
void TextureScale(const float &value)
virtual int BaseSystem()
void CalculateOrderOfMagnitude()
Definition: group.h:53
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 GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
#define GLSGEN_GLSODOMETER_EXPORT
Provides support for creating DLLs.
Definition: gls_odometer.h:55
The disti::Group class. Implements groups of objects.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47