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