GL Studio C++ Runtime API
gls_linear_float_controller.h
Go to the documentation of this file.
1/// \file gls_linear_float_controller.h
2/// \brief Implementation of GlsLinearFloatController.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2017 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<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#ifndef GLS_LINEAR_FLOAT_CONTROLLER_H_INCLUDED
40#define GLS_LINEAR_FLOAT_CONTROLLER_H_INCLUDED
41
42#include "display.h"
44
45/// Provides support for creating DLLs.
46#if( defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLSGEN_IMPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
47 && defined( _MSC_VER )
48# if defined( GLSGEN_EXPORT_GLSADVANCEDMESH ) || defined( GLS_EXPORT_GENERATED )
49# define GLSGEN_GlsLinearFloatController_EXPORT __declspec( dllexport )
50# else
51# define GLSGEN_GlsLinearFloatController_EXPORT __declspec( dllimport )
52# endif
53#else
54# define GLSGEN_GlsLinearFloatController_EXPORT
55#endif
56///////////////////////////////////////////////////////////////////////////////
57
58/// Automatically link the runtime library plugin (on Windows).
59#define LIB_BASE_NAME "gls_advanced_mesh"
60#include "gls_auto_lib.h"
61#undef LIB_BASE_NAME
62
63namespace disti
64{
65/// \details IFloatController allows working with all float controllers through a common interface.
67{
68public:
69 /** Destructor */
70 virtual ~IFloatController() {}
71
72 /// Get the output value for a given input.
73 /// \param input The given input value.
74 /// \return The output value for the given input.
75 virtual float GetOutputForInput( float input ) = 0;
76
77 /** The caller may use this method to determine the valid input range for the animation
78 * Note: Some controllers may always return -FLT_MAX
79 * \returns The first input value in the animation */
80 virtual float GetFirstInputValue() = 0;
81
82 /** The caller may use this method to determine the valid input range for the animation
83 * Note: Some controllers may always return FLT_MAX
84 * \returns The last input value in the animation */
85 virtual float GetLastInputValue() = 0;
86};
87
88/// \details The GlsLinearFloatController class. Interpolates incoming values based on its stored keyframes.
90 , public IFloatController
91{
92 friend class GlsLinearFloatControllerEditor;
93
94private:
97
98public:
99 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
100 typedef DisplayObject _BaseClass; ///< Deprecated typedef for the base class.
101 typedef DisplayObject BaseClass; ///< Typedef for the base class.
102
103 /** Create a new GlsLinearFloatController
104 * \param generateInstanceName Whether or not to generate an instance name */
106
107 /// Copy constructor
108 /// \param that The object to copy from.
109 /// \param generateNames Whether or not to generate an instance name.
111
113
114 /// \return A pointer to a new GlsLinearFloatController object.
116
117 // DisplayObject methods
118
122
123#ifndef GLES
126#endif
130 GLSGEN_GlsLinearFloatController_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint ) DISTI_METHOD_OVERRIDE;
131
132 // IFloatController methods
133
137
138 // GlsLinearFloatController methods
139
140 /// \details The KeyData class. Contains a single keyframe of animation.
142 {
143 float _input; ///< The input (key) value.
144 float _output; ///< The output value.
145
146 public:
147 KeyData()
148 : _input( 0 )
149 , _output( 0 )
150 {}
151
152 /// Sets the input (key) value.
153 /// \param value The new value to set.
154 void SetInputValue( float value ) { _input = value; }
155
156 /// \return The input (key) value.
157 float GetInputValue() const { return _input; }
158
159 /// Set the output value.
160 /// \param value The new value to set.
161 void SetOutputValue( float value ) { _output = value; }
162
163 /// \return The output value.
164 float GetOutputValue() const { return _output; }
165 };
166
167 typedef DynamicArray<KeyData> KeyArrayType; ///< Typedef for a list of animation keys.
168
169 /// \return The KeyArray associated with this object. Use this array to modify the keys that make up the animation.
171
172 /// Iterates through the path segments and returns the first one found that contains the given value.
173 /// \param value The value to search for.
174 /// \param index1 Returns the index of the state at the start of the segment or -1 if no segments are found.
175 /// \param index2 Returns the index of the state at the end the segment or -1 if no segments are found.
176 /// Special cases:
177 /// value is before start of the path: index1 == index2 == 0
178 /// value is past the end of the path: index1 == index2 == (KeyArray().Count()-1)
180
181 /// Initialize the key array.
182 /// Used by code generator.
183 /// \param numKeys The number of keys.
184 /// \param keyPairArray Array of numKey*2 values that are used to initialize the keys.
185 GLSGEN_GlsLinearFloatController_EXPORT void InitializeKeys( unsigned int numKeys, const float* keyPairArray );
186
187#ifdef GLES
188 /** Set a single attribute from the GLO file.
189 * \param data The attribute to set and its associated data.
190 */
192#endif
193
194protected:
195 KeyArrayType _keyArray; ///< The list of key values for interpolation.
196};
197
198/// Stream out operator
199/// \param outstr The stream to write to.
200/// \param key The value to write to the stream.
201/// \return The stream in its current state.
203
204/// Stream in operator
205/// \param instr The stream to read from.
206/// \param key The returned value read from the stream.
207/// \return The stream in its current state.
209
210} // namespace disti
211
212#endif
Definition: cull.h:49
Definition: events.h:111
Definition: display.h:95
Definition: dynamic_array.h:79
Definition: gls_glo_file.h:1241
Definition: gls_linear_float_controller.h:142
void SetInputValue(float value)
Definition: gls_linear_float_controller.h:154
float GetInputValue() const
Definition: gls_linear_float_controller.h:157
float GetOutputValue() const
Definition: gls_linear_float_controller.h:164
void SetOutputValue(float value)
Definition: gls_linear_float_controller.h:161
Definition: gls_linear_float_controller.h:91
float GetOutputForInput(float input) DISTI_METHOD_OVERRIDE
DynamicArray< KeyData > KeyArrayType
Typedef for a list of animation keys.
Definition: gls_linear_float_controller.h:167
void FindFirstPathSegmentContainingValue(float value, int *index1, int *index2)
void InitializeKeys(unsigned int numKeys, const float *keyPairArray)
void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
float GetFirstInputValue() DISTI_METHOD_OVERRIDE
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
DisplayObject * handle(DisplayEvent *ev) DISTI_METHOD_OVERRIDE
void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
static DisplayObject * CreateInstance()
void Draw() DISTI_METHOD_OVERRIDE
KeyArrayType _keyArray
The list of key values for interpolation.
Definition: gls_linear_float_controller.h:195
bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint) DISTI_METHOD_OVERRIDE
float GetLastInputValue() DISTI_METHOD_OVERRIDE
KeyArrayType & KeyArray()
Definition: gls_linear_float_controller.h:170
DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
Definition: gls_linear_float_controller.h:67
virtual float GetOutputForInput(float input)=0
virtual float GetFirstInputValue()=0
virtual ~IFloatController()
Definition: gls_linear_float_controller.h:70
virtual float GetLastInputValue()=0
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:540
Definition: vertex.h:84
The disti::DisplayObject class and global enumerations.
The gls_auto_lib.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:487
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:221
#define GLSGEN_GlsLinearFloatController_EXPORT
Provides support for creating DLLs.
Definition: gls_linear_float_controller.h:54
Definition: bmpimage.h:46
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
std::istream & operator>>(std::istream &instr, GlsColor &color)