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