| 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
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*/
40#ifndef _GLSODOMETER_H
41#define _GLSODOMETER_H
42
43#include "gls_cpp_lang_support.h"
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
64 namespace disti
65{
66 enum
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 */
79 class GlsOdometer : public Group
80{
81 friend class GlsOdometerEditor;
82
83 private:
84 GlsOdometer& operator=( const GlsOdometer& ) DISTI_SPECIAL_MEM_FUN_DELETE;
85 GlsOdometer( const GlsOdometer& ) DISTI_SPECIAL_MEM_FUN_DELETE;
86
87 public:
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 */
102 virtual GLSGEN_GLSODOMETER_EXPORT ~GlsOdometer();
103
104 /// \return A pointer to a new GlsOdometer object.
105 static GLSGEN_GLSODOMETER_EXPORT DisplayObject* CreateInstance();
106
107 virtual GLSGEN_GLSODOMETER_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
108 virtual GLSGEN_GLSODOMETER_EXPORT void CopyProperties( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
109 virtual GLSGEN_GLSODOMETER_EXPORT DisplayObject* CloneObject( bool generateNames = false ) DISTI_METHOD_OVERRIDE;
110
111#ifndef GLES
112 virtual GLSGEN_GLSODOMETER_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL ) DISTI_METHOD_OVERRIDE;
113 virtual GLSGEN_GLSODOMETER_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array ) DISTI_METHOD_OVERRIDE;
114#endif
115
116 virtual GLSGEN_GLSODOMETER_EXPORT DisplayObject* handle( DisplayEvent* ev ) DISTI_METHOD_OVERRIDE;
117 virtual GLSGEN_GLSODOMETER_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler ) DISTI_METHOD_OVERRIDE;
118 virtual GLSGEN_GLSODOMETER_EXPORT void Draw() 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
130 } GlsOdometerBehaviorType;
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
137 } GlsOdometerGeometryType;
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.
144 virtual GLSGEN_GLSODOMETER_EXPORT float MaxValue();
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.
151 virtual GLSGEN_GLSODOMETER_EXPORT float MinValue();
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.
159 virtual GLSGEN_GLSODOMETER_EXPORT float Value();
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.
167 virtual GLSGEN_GLSODOMETER_EXPORT int BaseSystem();
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.
173 GLSGEN_GLSODOMETER_EXPORT void BehaviorType( const GlsOdometerBehaviorType value );
174
175 /// \return The BehaviorType controls the "Rollover" behavior of the odometer.
176 virtual GLSGEN_GLSODOMETER_EXPORT GlsOdometerBehaviorType BehaviorType();
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.
182 GLSGEN_GLSODOMETER_EXPORT void GeometryType( const GlsOdometerGeometryType value );
183
184 /// \return The GeometryType method used to "move" the wheels.
185 virtual GLSGEN_GLSODOMETER_EXPORT GlsOdometerGeometryType GeometryType();
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.
194 virtual GLSGEN_GLSODOMETER_EXPORT float TextureScale();
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.
202 virtual GLSGEN_GLSODOMETER_EXPORT float DegreesPerDigit();
203
204 /// \return The order of magnitude (number of digits) the odometer can have.
205 virtual GLSGEN_GLSODOMETER_EXPORT int OrderOfMagnitude() const;
206
207 /// \return The amount required to make the first digit roll over by one.
208 virtual GLSGEN_GLSODOMETER_EXPORT float RolloverThreshold() const;
209
210 protected:
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.
224 class TexturePoints
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.
248 void CalculateOrderOfMagnitude();
249
250 /// Helper function that recalculates _rolloverThreshold.
251 /// \note Not normally called by users.
252 void CalculateRolloverThreshold();
253
254 /// Sets the current texture coordinates as the zero position for the wheels.
255 /// \note Not normally called by users.
256 void SaveTextureLoc();
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
disti::Culler
Definition: cull.h:50
disti::DisplayEvent
Definition: events.h:113
disti::DisplayObject
Definition: display.h:96
disti::DynamicArray
Definition: dynamic_array.h:79
disti::GlsGloFileAttribute
Definition: gls_glo_file.h:1243
disti::GlsOdometer::TexturePoints
Definition: gls_odometer.h:225
disti::GlsOdometer::TexturePoints::v4
Vector v4
The top left corner.
Definition: gls_odometer.h:230
disti::GlsOdometer::TexturePoints::v2
Vector v2
The bottom right corner.
Definition: gls_odometer.h:228
disti::GlsOdometer::TexturePoints::v3
Vector v3
The top right corner.
Definition: gls_odometer.h:229
disti::GlsOdometer::TexturePoints::v1
Vector v1
The bottom left corner.
Definition: gls_odometer.h:227
disti::GlsOdometer
Definition: gls_odometer.h:80
disti::GlsOdometer::_rolloverThreshold
float _rolloverThreshold
The amount required to make the first digit roll over by one.
Definition: gls_odometer.h:214
disti::GlsOdometer::BaseSystem
virtual void BaseSystem(const int &value)
disti::GlsOdometer::CalculateRolloverThreshold
void CalculateRolloverThreshold()
disti::GlsOdometer::Value
void Value(const float &value)
disti::GlsOdometer::_degreesPerDigit
float _degreesPerDigit
The amount to rotate the geometry for each digit. GeometryType == GEOMETRY_3D.
Definition: gls_odometer.h:213
disti::GlsOdometer::SetAvailableAttributes
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
disti::GlsOdometer::GlsOdometerGeometryType
GlsOdometerGeometryType
Definition: gls_odometer.h:134
disti::GlsOdometer::Draw
virtual void Draw() DISTI_METHOD_OVERRIDE
disti::GlsOdometer::DegreesPerDigit
virtual float DegreesPerDigit()
disti::GlsOdometer::Value
virtual float Value()
disti::GlsOdometer::_behavior
GlsOdometerBehaviorType _behavior
The "rollover" behavior in use.
Definition: gls_odometer.h:220
disti::GlsOdometer::CloneObject
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
disti::GlsOdometer::GeometryType
virtual GlsOdometerGeometryType GeometryType()
disti::GlsOdometer::SetFromGloData
virtual GLS_EXPORT void SetFromGloData(GlsGloFileAttribute &data) DISTI_METHOD_OVERRIDE
disti::GlsOdometer::RolloverThreshold
void RolloverThreshold(const float &value)
disti::GlsOdometer::GeometryType
void GeometryType(const GlsOdometerGeometryType value)
disti::GlsOdometer::PreDraw
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
disti::GlsOdometer::OrderOfMagnitude
void OrderOfMagnitude(const int &value)
disti::GlsOdometer::MaxValue
virtual float MaxValue()
disti::GlsOdometer::GlsOdometerBehaviorType
GlsOdometerBehaviorType
Definition: gls_odometer.h:127
disti::GlsOdometer::handle
virtual DisplayObject * handle(DisplayEvent *ev) DISTI_METHOD_OVERRIDE
disti::GlsOdometer::SetValue
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
disti::GlsOdometer::MaxValue
void MaxValue(const float &value)
disti::GlsOdometer::BehaviorType
void BehaviorType(const GlsOdometerBehaviorType value)
disti::GlsOdometer::_orderOfMagnitude
int _orderOfMagnitude
The number of digits (zeroes) the odometer can have.
Definition: gls_odometer.h:211
disti::GlsOdometer::BehaviorType
virtual GlsOdometerBehaviorType BehaviorType()
disti::GlsOdometer::_maxValue
float _maxValue
The maximum value that can be represented on the wheels.
Definition: gls_odometer.h:217
disti::GlsOdometer::_textureScale
float _textureScale
The amount in texture coordinates to move for each digit. GeometryType == GEOMETRY_2D.
Definition: gls_odometer.h:212
disti::GlsOdometer::MinValue
virtual float MinValue()
disti::GlsOdometer::CreateInstance
static DisplayObject * CreateInstance()
disti::GlsOdometer::_startLoc
DynamicArray< TexturePoints > _startLoc
A list of start texture locations, one for each wheel.
Definition: gls_odometer.h:233
disti::GlsOdometer::MinValue
void MinValue(const float &value)
disti::GlsOdometer::DegreesPerDigit
void DegreesPerDigit(const float &value)
disti::GlsOdometer::TextureScale
virtual float TextureScale()
disti::GlsOdometer::SaveTextureLoc
void SaveTextureLoc()
disti::GlsOdometer::RolloverThreshold
virtual float RolloverThreshold() const
disti::GlsOdometer::OrderOfMagnitude
virtual int OrderOfMagnitude() const
disti::GlsOdometer::CopyProperties
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
disti::GlsOdometer::_minValue
float _minValue
The minimum value that can be represented on the wheels.
Definition: gls_odometer.h:216
disti::GlsOdometer::_textureLocSaved
bool _textureLocSaved
True denotes that the texture locations have been saved off.
Definition: gls_odometer.h:234
disti::GlsOdometer::_currentValue
float _currentValue
The current value displayed on the wheels.
Definition: gls_odometer.h:219
disti::GlsOdometer::_baseSystem
int _baseSystem
The base system represented, e.g. base 10.
Definition: gls_odometer.h:218
disti::GlsOdometer::_geometry
GlsOdometerGeometryType _geometry
The "movement" behavior in use.
Definition: gls_odometer.h:221
disti::GlsOdometer::TextureScale
void TextureScale(const float &value)
disti::GlsOdometer::BaseSystem
virtual int BaseSystem()
disti::GlsOdometer::CalculateOrderOfMagnitude
void CalculateOrderOfMagnitude()
disti::Group
Definition: group.h:53
disti::OpenGLMatrices
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
disti::VertexNoColor
Definition: vertex.h:85
gls_auto_lib.h
The gls_auto_lib.
gls_cpp_lang_support.h
Macros and helper code to determine what subset of C++11/14/17 is available.
DISTI_SPECIAL_MEM_FUN_DELETE
#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:246
DISTI_DEPRECATED
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:488
DISTI_METHOD_OVERRIDE
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:222
GLS_EXPORT
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
GLSGEN_GLSODOMETER_EXPORT
#define GLSGEN_GLSODOMETER_EXPORT
Provides support for creating DLLs.
Definition: gls_odometer.h:55
group.h
The disti::Group class. Implements groups of objects.
disti
Definition: bmpimage.h:47