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