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 #define LIB_BASE_NAME "gls_odometer"
60 #include "gls_auto_lib.h"
61 #undef LIB_BASE_NAME
62 
63 namespace disti
64 {
65 enum
66 {
67  GLS_GLSODOMETER_VALUE = GLS_LAST_INITIALIZER + 1,
68  GLS_GLSODOMETER_MIN_VALUE,
69  GLS_GLSODOMETER_MAX_VALUE,
70  GLS_GLSODOMETER_BASE_SYSTEM,
71  GLS_GLSODOMETER_BEHAVIOR_TYPE,
72  GLS_GLSODOMETER_GEOMETRY_TYPE,
73  GLS_GLSODOMETER_TEXTURE_SCALE,
74  GLS_GLSODOMETER_DEGREES_PER_DIGIT
75 };
76 
77 /** Runtime implementation of a GlsOdometer */
78 class GlsOdometer : public Group
79 {
80  friend class GlsOdometerEditor;
81 
82 private:
83  GlsOdometer& operator=( const GlsOdometer& ) DISTI_SPECIAL_MEM_FUN_DELETE;
84  GlsOdometer( const GlsOdometer& ) DISTI_SPECIAL_MEM_FUN_DELETE;
85 
86 public:
87  DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
88  typedef Group _BaseClass;
89  typedef Group BaseClass;
90 
91  /** Create a new GlsOdometer.
92  * \param generateInstance Whether or not to generate an instance name
93  * for this inputdevice */
94  GLSGEN_GLSODOMETER_EXPORT GlsOdometer( bool generateInstance = false );
95 
96  GLSGEN_GLSODOMETER_EXPORT GlsOdometer( const GlsOdometer& that, const bool generateNames );
97 
98  /** Destructs a GlsOdometer object */
99  virtual GLSGEN_GLSODOMETER_EXPORT ~GlsOdometer();
100 
101  static GLSGEN_GLSODOMETER_EXPORT DisplayObject* CreateInstance();
102 
103  virtual GLSGEN_GLSODOMETER_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
104  virtual GLSGEN_GLSODOMETER_EXPORT void CopyProperties( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
105  virtual GLSGEN_GLSODOMETER_EXPORT DisplayObject* CloneObject( bool generateNames = false ) DISTI_METHOD_OVERRIDE;
106 
107 #ifndef GLES
108  virtual GLSGEN_GLSODOMETER_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL ) DISTI_METHOD_OVERRIDE;
109  virtual GLSGEN_GLSODOMETER_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array ) DISTI_METHOD_OVERRIDE;
110 #endif
111 
112  virtual GLSGEN_GLSODOMETER_EXPORT DisplayObject* handle( DisplayEvent* ev ) DISTI_METHOD_OVERRIDE;
113 
114  virtual GLSGEN_GLSODOMETER_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler ) DISTI_METHOD_OVERRIDE;
115  virtual GLSGEN_GLSODOMETER_EXPORT void Draw( void ) DISTI_METHOD_OVERRIDE;
116 
117  virtual GLSGEN_GLSODOMETER_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
118 
119  //////////////////////////////////////////////////
120  // GlsOdometer specific declarations
121  //////////////////////////////////////////////////
122 
123  typedef enum
124  {
125  BEHAVIOR_ANALOG = 0,
126  BEHAVIOR_DIGITAL
127  } GlsOdometerBehaviorType;
128 
129  typedef enum
130  {
131  GEOMETRY_2D = 0,
132  GEOMETRY_3D
133  } GlsOdometerGeometryType;
134 
135  /** Set the maximum displayable value. */
136  GLSGEN_GLSODOMETER_EXPORT void MaxValue( const float& value );
137  /** Get the maximum displayable value. */
138  virtual GLSGEN_GLSODOMETER_EXPORT float MaxValue();
139 
140  /** Set the minimum displayable value. */
141  GLSGEN_GLSODOMETER_EXPORT void MinValue( const float& value );
142  /** Get the minimum displayable value. */
143  virtual GLSGEN_GLSODOMETER_EXPORT float MinValue();
144 
145  /** Set the current value to be displayed by the odometer.
146  * This value is limited by MaxValue() and MinValue(). */
147  GLSGEN_GLSODOMETER_EXPORT void Value( const float& value );
148  /** Get the current value of the odometer.
149  */
150  virtual GLSGEN_GLSODOMETER_EXPORT float Value();
151 
152  /** Set the base number system for this odometer.
153  * The default is base 10. */
154  virtual GLSGEN_GLSODOMETER_EXPORT void BaseSystem( const int& value );
155  /** Get the base number system for this odometer.
156  */
157  virtual GLSGEN_GLSODOMETER_EXPORT int BaseSystem();
158 
159  /** Set the BehaviorType controls the "Rollover" behavior of the odometer.
160  * BEHAVIOR_ANALOG - Wheels will roll between numbers based on the RolloverThreshold
161  * BEHAVIOR_DIGITAL - Wheels will display only whole numbers.
162  */
163  GLSGEN_GLSODOMETER_EXPORT void BehaviorType( const GlsOdometerBehaviorType value );
164  /** Get the BehaviorType controls the "Rollover" behavior of the odometer.
165  */
166  virtual GLSGEN_GLSODOMETER_EXPORT GlsOdometerBehaviorType BehaviorType();
167 
168  /** Set the GeometryType controls the method used to
169  * "move" the wheels.
170  * GEOMETRY_2D - Texture is translated on the object based on the TextureScale.
171  * GEOMETRY_3D - The wheels are rotated about the Y-AXIS of the DCS based on the value of DegreesPerDigit.
172  */
173  GLSGEN_GLSODOMETER_EXPORT void GeometryType( const GlsOdometerGeometryType value );
174  /** Get the GeometryType
175  */
176  virtual GLSGEN_GLSODOMETER_EXPORT GlsOdometerGeometryType GeometryType();
177 
178  /** Set the TextureScale which is the amount that the texture should move
179  * for each digit. The formula to determine this is:
180  * (Pixels per digit)/(Texture height).
181  * This value is only used when
182  * GeometryType == GEOMETRY_2D. */
183  GLSGEN_GLSODOMETER_EXPORT void TextureScale( const float& value );
184  /** Get the TextureScale */
185  virtual GLSGEN_GLSODOMETER_EXPORT float TextureScale();
186 
187  /** Set the DegreesPerDigit which is the number of degrees the wheels
188  * should be rotated for each digit.
189  * This value is only used when
190  * GeometryType == GEOMETRY_3D.*/
191  GLSGEN_GLSODOMETER_EXPORT void DegreesPerDigit( const float& value );
192  /** Get the DegreesPerDigit */
193  virtual GLSGEN_GLSODOMETER_EXPORT float DegreesPerDigit();
194 
195  virtual GLSGEN_GLSODOMETER_EXPORT int OrderOfMagnitude() const;
196  virtual GLSGEN_GLSODOMETER_EXPORT float RolloverThreshold() const;
197 
198 protected:
199  int _orderOfMagnitude;
200  float _textureScale;
201  float _degreesPerDigit;
202  float _rolloverThreshold;
203 
204  float _minValue;
205  float _maxValue;
206  int _baseSystem;
207  float _currentValue;
208  GlsOdometerBehaviorType _behavior;
209  GlsOdometerGeometryType _geometry;
210 
211  // DynamicArray<DynamicArray<Vertex> > _startLoc;
212 
214  {
215  public:
216  Vector v1, v2, v3, v4;
217  };
218 
219  DynamicArray<TexturePoints> _startLoc;
220  bool _textureLocSaved;
221 
222  void OrderOfMagnitude( const int& value );
223 
224  void RolloverThreshold( const float& value );
225 
226  void CalculateOrderOfMagnitude( void );
227  void CalculateRolloverThreshold( void );
228 
229  // Sets the current Texture Coordinates
230  // as the zero position for the wheels.
231  void SaveTextureLoc( void );
232 
233 #ifdef GLES
234  /** Set a single attribute from the GLO file.
235  * \param data The attribute to set and its associated data.
236  */
237  virtual GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
238 #endif
239 };
240 
241 } // namespace disti
242 
243 #endif
Definition: cull.h:49
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual GlsOdometerGeometryType GeometryType()
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:436
virtual int BaseSystem()
Definition: dynamic_array.h:66
The disti::Group class. Implements groups of objects.
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:473
virtual DisplayObject * handle(DisplayEvent *ev) DISTI_METHOD_OVERRIDE
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
virtual GlsOdometerBehaviorType BehaviorType()
Definition: display.h:98
virtual float DegreesPerDigit()
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
Definition: gls_odometer.h:213
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
Definition: gls_glo_file.h:988
virtual float MinValue()
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
virtual ~GlsOdometer()
Definition: gls_odometer.h:78
virtual float TextureScale()
virtual void Draw(void) DISTI_METHOD_OVERRIDE
Definition: events.h:112
The gls_auto_lib.
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
Definition: group.h:52
Definition: vertex.h:84
virtual float MaxValue()
Macros and helper code to determine what subset of C++11/14/17 is available.
Definition: bmpimage.h:46
virtual float Value()