GL Studio C++ Runtime API
gls_rso_interface_impl.h
Go to the documentation of this file.
1/*! \file
2 \brief Standard GL Studio implementation of the safe interface to version 2 RSOs (component side).
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
14reproduced, in whole or part, in any form, or by any means of electronic,
15mechanical, or otherwise, without the written permission of DiSTI. Said
16permission may be derived through the purchase of applicable DiSTI product
17licenses which detail the distribution rights of this content and any
18Derivative Works based on this or other copyrighted DiSTI Software.
19
20 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26
27 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34EXCEED FIVE DOLLARS (US$5.00).
35
36 The aforementioned terms and restrictions are governed by the laws of the
37State of Florida and the United States of America.
38
39*/
40#ifndef INCLUDED_GLS_RSO_INTERFACE_IMPL_H
41#define INCLUDED_GLS_RSO_INTERFACE_IMPL_H
42
43#include "events.h"
44#include "gls_include.h"
45#include "gls_resources.h"
46#ifdef GLES
47# include "rso_interface_es_2.h"
48typedef disti::RSOInterfaceES2 RsoImplBaseClass; ///< Typedef for the current RSO interface.
49typedef disti::RSOInterfaceES1 RsoImplBaseInterface; ///< Typedef for the original RSO interface.
50typedef disti::RSOInterfaceES1 RsoImplMultiTouchInterface; ///< Typedef for the RSO interface version that introduced multitouch support.
51typedef disti::RSOInterfaceES1::MatrixF RSOMatrixT; ///< Typedef for the RSO interface matrix type.
52typedef disti::RSOInterfaceES2::RSOPainter RSOPainterT; ///< Typedef for the RSO interface painter type.
53#else
54# include "rso_interface_5.h"
55typedef disti::RSOInterface5 RsoImplBaseClass; ///< Typedef for the current RSO interface.
56typedef disti::RSOInterface1 RsoImplBaseInterface; ///< Typedef for the original RSO interface.
57typedef disti::RSOInterface3 RsoImplMultiTouchInterface; ///< Typedef for the RSO interface version that introduced multitouch support.
58typedef disti::RSOInterface1::MatrixD RSOMatrixT; ///< Typedef for the RSO interface matrix type.
59typedef disti::RSOInterface5::RSOPainter RSOPainterT; ///< Typedef for the RSO interface painter type.
60#endif
61
62namespace disti
63{
64class ComponentBase;
65
66/** Wraps a GlsResourceFilter so it can be passed to the RSO Interface's GetResources call */
68{
69private:
70 GlsResourceFilter* _filter; ///< The underlying (runtime) filter wrapped by this interface.
71
72public:
73 /// Constructor
74 /// \param filter The filter to wrap.
75 GLS_EDITOR RSOResourceFilterImpl( GlsResourceFilter* filter ) { _filter = filter; }
76
78
79 /// \return The current qualification level.
80 int LevelsUp() const DISTI_METHOD_OVERRIDE { return _filter->LevelsUp(); }
81
82 /// How many levels of qualification to show in the name.
83 /// -1 means full qualification.
84 /// Default: -1
85 /// \param value The new qualification level to set.
86 void LevelsUp( int value ) DISTI_METHOD_OVERRIDE { _filter->LevelsUp( value ); }
87
88 /// \return The current levels of children to show.
89 int GroupLevelsDown() const DISTI_METHOD_OVERRIDE { return _filter->GroupLevelsDown(); }
90
91 /// How many levels of children to show.
92 /// 0 means don't show any children properties
93 /// -1 means all the way down.
94 /// Default: -1
95 /// \param value The new levels of children to show.
96 void GroupLevelsDown( int value ) DISTI_METHOD_OVERRIDE { _filter->GroupLevelsDown( value ); }
97
98 /// \return Whether or not names, or names and values should be returned.
99 bool NamesOnly() const DISTI_METHOD_OVERRIDE { return _filter->NamesOnly(); }
100
101 /// If true, only a list of names will be returned.
102 /// Values will not be returned.
103 /// The format changes to not include the ":".
104 /// Default: false
105 /// \param value The new name display flag to set.
106 void NamesOnly( bool value ) DISTI_METHOD_OVERRIDE { _filter->NamesOnly( value ); }
107
108 /// Manage the list of excluded attributes. Takes precedence over includes.
109 /// \param str The new name to add to the exclude list.
110 void AddExclude( const char* str ) DISTI_METHOD_OVERRIDE { _filter->AddExclude( str ); }
111
112 /// Default: 0
113 /// \return The number of entries in the exclude list.
114 int ExcludeCount() const DISTI_METHOD_OVERRIDE { return _filter->ExcludeCount(); }
115
116 /// \note Returns NULL if index >= ExcludeCount() or index < -1.
117 /// \return The exclude name associated with the incoming index.
118 /// \param index The index of the exclusion item to return.
119 const char* GetExclude( int index ) const DISTI_METHOD_OVERRIDE { return _filter->GetExclude( index ); }
120
121 /// Manage the list of included attributes.
122 /// \param str The new name to add to the include list.
123 void AddInclude( const char* str ) DISTI_METHOD_OVERRIDE { _filter->AddInclude( str ); }
124
125 /// Default: 0
126 /// \return The number of entries in the include list.
127 int IncludeCount() const DISTI_METHOD_OVERRIDE { return _filter->IncludeCount(); }
128
129 /// \note Returns NULL if index >= IncludeCount() or index < -1
130 /// \return The include name associated with the incoming index.
131 /// \param index The index of the inclusion item to return.
132 const char* GetInclude( int index ) const DISTI_METHOD_OVERRIDE { return _filter->GetInclude( index ); }
133
134 /// Check a name against the filters.
135 /// Exclude list takes precedence.
136 /// \param name The name of the item to test.
137 /// \return Whether or not the name passes the filter (to be included in the returned results).
138 bool PassFilter( const char* name ) const DISTI_METHOD_OVERRIDE { return _filter->PassFilter( name ); }
139
140 /// Manage the stack of parent object names.
141 /// \param parent The name of the item to add to the stack.
142 void PushParentName( const char* parent ) { _filter->PushParentName( parent ); }
143
144 /// Pop the parent object name stack.
145 void PopParentName() { _filter->PopParentName(); }
146
147 /// \return The number of entries in the parent name stack.
148 unsigned int ParentNameCount() const { return _filter->ParentNameCount(); }
149
150 /// \note Returns NULL if index >= ParentNameCount() or index < -1.
151 /// \return The parent name associated with the incoming index.
152 /// \param index The index of the parent name to return.
153 const char* GetParentName( unsigned int index ) const { return _filter->GetParentName( index ); }
154};
155
156/** Implementation of RSOInterface. */
158 , virtual public GlsPainter
159{
160protected:
161 /// Reference to the component being wrapped.
162 /// GlsRSOInterface1Impl will delete this object.
164
165 /// The container's event handler.
167
168 /// String to return from Resources methods.
169 std::string _resourcesRetVal;
170
171 // RSOInterface2 implementation
172
173 typedef std::map<ResourceHandle, DistiAttributeBase*> ResourceHandleMap; ///< Typedef to associate external ids (ResourceHandle) with runtime attributes.
174
175 ResourceHandleMap _resourceHandleMap; ///< Mapping of external RSO interface resource ids with runtime attributes.
176 ResourceHandle _nextResourceHandle; ///< Used to track the highest id, to assign as the next resource handle.
177 bool _firstDraw; ///< If true, this RSO has not been drawn yet.
178
179 RSOPainterT* _painter; ///< Painter object that tracks the conditional rendering state.
180 bool _redraw; ///< If true, this RSO should redraw itself on the next frame.
181
182 /// \return The runtime attribute associated with the external handle.
183 /// \param handle The external id for the desired runtime attribute.
185
186 /// Protected constructor - Call CreateInstance instead
187 /// \param component The component object to wrap.
189
190 // Protected destructor - Call DeleteInstance instead
192
193public:
194 /// \return An RSO interface wrapper for the incoming component object.
195 /// \param component The component object to wrap.
197
198 /// Pass an event that was emitted from the component to the container.
199 /// \param ev The event to pass into the container.
200 /// \return Zero if the event was not handled, otherwise not zero.
202
203 // RSOInterface1 overrides
204
214
216 const RsoImplBaseInterface::Vector& logicalCoords,
217 float scale,
218 const RsoImplBaseInterface::Vector& directionVector,
219 RsoImplBaseInterface::Vector& collisionWinLoc,
221
223 GLS_EXPORT void SetResource( const char* resourceName, const char* resourceVal ) DISTI_METHOD_OVERRIDE;
224 GLS_EXPORT const char* GetResource( const char* resourceName ) DISTI_METHOD_OVERRIDE;
226
227 // RSOInterface2 implementation
228
232 void SetResource( ResourceHandle resourceHandle, const char* resourceVal ) DISTI_METHOD_OVERRIDE;
233 const char* GetResource( ResourceHandle resourceHandle ) DISTI_METHOD_OVERRIDE;
234 void SetIntResource( const char* resourceName, long resourceVal ) DISTI_METHOD_OVERRIDE;
235 long GetIntResource( const char* resourceName ) DISTI_METHOD_OVERRIDE;
236 void SetIntResource( ResourceHandle resourceHandle, long resourceVal ) DISTI_METHOD_OVERRIDE;
238 void SetFloatResource( const char* resourceName, double resourceVal ) DISTI_METHOD_OVERRIDE;
239 double GetFloatResource( const char* resourceName ) DISTI_METHOD_OVERRIDE;
240 void SetFloatResource( ResourceHandle resourceHandle, double resourceVal ) DISTI_METHOD_OVERRIDE;
244
245#ifdef GLES
246 unsigned int GetMaxNumLights() DISTI_METHOD_OVERRIDE;
247 void SetLightData( unsigned int numLights, LightData* lightData ) DISTI_METHOD_OVERRIDE;
248 unsigned int GetMaxClipPlanes() DISTI_METHOD_OVERRIDE;
249 void SetClipPlaneData( unsigned int numClipPlanes, float** equations ) DISTI_METHOD_OVERRIDE;
250 void SetMatrix( int type, const float* matrix ) DISTI_METHOD_OVERRIDE;
251 void SetDefaultOpenGLState() DISTI_METHOD_OVERRIDE;
252#endif
253
257};
258
259} // end namespace disti
260
261#endif
Definition: component_base.h:68
Definition: events.h:113
Definition: disti_metadata.h:220
Definition: gls_painter.h:51
Definition: gls_rso_interface_impl.h:159
static GlsRSOInterfaceImpl * CreateInstance(ComponentBase *component)
DistiAttributeBase & GetAttribute(ResourceHandle handle)
void UnregisterResourceObserver(ResourceHandle resourceHandle, CallbackID id) override
bool GetBoundingSphere(RsoImplBaseInterface::Vector *center, float *radius) override
ResourceHandleMap _resourceHandleMap
Mapping of external RSO interface resource ids with runtime attributes.
Definition: gls_rso_interface_impl.h:175
void SetPainter(RSOPainterT *painter) override
bool GetBoundingBox(RsoImplBaseInterface::Vector *min, RsoImplBaseInterface::Vector *max, const RSOMatrixT *transform=NULL) override
RsoImplBaseInterface::EmittedEventHandler * _emittedEventHandler
The container's event handler.
Definition: gls_rso_interface_impl.h:166
RSOPainterT * _painter
Painter object that tracks the conditional rendering state.
Definition: gls_rso_interface_impl.h:179
void Invalidate() override
Notify the painter that the scene needs to be redrawn.
bool IsInvalidated() const override
void SetIntResource(const char *resourceName, long resourceVal) override
bool _redraw
If true, this RSO should redraw itself on the next frame.
Definition: gls_rso_interface_impl.h:180
bool Pick3D(const RsoImplBaseInterface::Vector &winLoc, const RsoImplBaseInterface::Vector &logicalCoords, float scale, const RsoImplBaseInterface::Vector &directionVector, RsoImplBaseInterface::Vector &collisionWinLoc, const RsoImplBaseInterface::OpenGLMatrices &drawnMatrices) override
ResourceHandle CreateResourceHandle(const char *resourceName) override
bool HandleMultiTouchInput(RsoImplMultiTouchInterface::MouseMultiTouchEvent *lci3_ev) override
std::map< ResourceHandle, DistiAttributeBase * > ResourceHandleMap
Typedef to associate external ids (ResourceHandle) with runtime attributes.
Definition: gls_rso_interface_impl.h:173
bool _firstDraw
If true, this RSO has not been drawn yet.
Definition: gls_rso_interface_impl.h:177
GlsRSOInterfaceImpl(ComponentBase *component)
double GetFloatResource(const char *resourceName) override
bool SetEmittedEventHandler(RsoImplBaseInterface::EmittedEventHandler *handler) override
const char * GetResource(const char *resourceName) override
void SetResource(const char *resourceName, const char *resourceVal) override
void DeleteInstance() override
Safely delete the object.
void Calculate(double time) override
The RSO Interface methods.
bool IsResourceHandleValid(ResourceHandle resourceHandle) override
void ReleaseResourceHandle(ResourceHandle resourceHandle) override
const char * GetResources(RsoImplBaseInterface::ResourceFilter *filter=NULL) override
void SetFloatResource(const char *resourceName, double resourceVal) override
long GetIntResource(const char *resourceName) override
ResourceHandle _nextResourceHandle
Used to track the highest id, to assign as the next resource handle.
Definition: gls_rso_interface_impl.h:176
CallbackID RegisterResourceObserver(ResourceHandle resourceHandle, ResourceObserver *obs) override
std::string _resourcesRetVal
String to return from Resources methods.
Definition: gls_rso_interface_impl.h:169
bool HandleInput(RsoImplBaseInterface::Event *lci1_ev) override
void PreDraw(const RsoImplBaseInterface::OpenGLMatrices &parentMatrices, RsoImplBaseInterface::Culler &culler) override
RsoImplBaseInterface * CloneObject() override
ComponentBase * _component
Definition: gls_rso_interface_impl.h:163
int LiveComponentEventHandlerCb(ComponentBase *, disti::DisplayEvent *ev)
Definition: gls_resources.h:51
void LevelsUp(int value)
Definition: gls_resources.h:84
unsigned int IncludeCount() const
void PopParentName()
Removes the top entry on the parent name stack.
const char * GetInclude(unsigned int index) const
void PushParentName(const char *parent)
unsigned int ExcludeCount() const
const char * GetExclude(unsigned int index) const
void NamesOnly(bool value)
Definition: gls_resources.h:112
void AddInclude(const char *name)
unsigned int ParentNameCount() const
virtual bool PassFilter(const char *name)
const char * GetParentName(unsigned int index) const
void AddExclude(const char *name)
void GroupLevelsDown(int value)
Definition: gls_resources.h:103
Definition: rso_interface_1.h:310
Definition: rso_interface_1.h:636
Definition: rso_interface_1.h:322
Definition: rso_interface_1.h:210
Definition: rso_interface_1.h:243
Definition: rso_interface_1.h:650
Definition: rso_interface_1.h:175
Definition: rso_interface_1.h:61
unsigned int ResourceHandle
Typedef for a unique resource identifier.
Definition: rso_interface_2.h:65
Definition: rso_interface_3.h:65
Definition: rso_interface_3.h:61
Definition: rso_interface_4.h:64
unsigned int CallbackID
Type for unique identifiers.
Definition: rso_interface_4.h:79
Definition: rso_interface_5.h:66
Definition: rso_interface_5.h:62
Definition: gls_rso_interface_impl.h:68
const char * GetInclude(int index) const override
Definition: gls_rso_interface_impl.h:132
void PopParentName()
Pop the parent object name stack.
Definition: gls_rso_interface_impl.h:145
int ExcludeCount() const override
Definition: gls_rso_interface_impl.h:114
const char * GetExclude(int index) const override
Definition: gls_rso_interface_impl.h:119
bool NamesOnly() const override
Definition: gls_rso_interface_impl.h:99
void PushParentName(const char *parent)
Definition: gls_rso_interface_impl.h:142
void GroupLevelsDown(int value) override
Definition: gls_rso_interface_impl.h:96
RSOResourceFilterImpl(GlsResourceFilter *filter)
Definition: gls_rso_interface_impl.h:75
void LevelsUp(int value) override
Definition: gls_rso_interface_impl.h:86
void AddExclude(const char *str) override
Definition: gls_rso_interface_impl.h:110
bool PassFilter(const char *name) const override
Definition: gls_rso_interface_impl.h:138
int LevelsUp() const override
Definition: gls_rso_interface_impl.h:80
void AddInclude(const char *str) override
Definition: gls_rso_interface_impl.h:123
unsigned int ParentNameCount() const
Definition: gls_rso_interface_impl.h:148
int GroupLevelsDown() const override
Definition: gls_rso_interface_impl.h:89
int IncludeCount() const override
Definition: gls_rso_interface_impl.h:127
const char * GetParentName(unsigned int index) const
Definition: gls_rso_interface_impl.h:153
void NamesOnly(bool value) override
Definition: gls_rso_interface_impl.h:106
The standard Mouse and keyboard events and event structures.
#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
A file for all GL Studio files to include.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
#define GLS_EDITOR
Macro denoting which functions should be visible from the editor.
Definition: gls_include.h:63
disti::GlsResourceFilter classes and methods.
disti::RSOInterface3 RsoImplMultiTouchInterface
Typedef for the RSO interface version that introduced multitouch support.
Definition: gls_rso_interface_impl.h:57
disti::RSOInterface5::RSOPainter RSOPainterT
Typedef for the RSO interface painter type.
Definition: gls_rso_interface_impl.h:59
disti::RSOInterface1 RsoImplBaseInterface
Typedef for the original RSO interface.
Definition: gls_rso_interface_impl.h:56
disti::RSOInterface1::MatrixD RSOMatrixT
Typedef for the RSO interface matrix type.
Definition: gls_rso_interface_impl.h:58
disti::RSOInterface5 RsoImplBaseClass
Typedef for the current RSO interface.
Definition: gls_rso_interface_impl.h:55
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47
Defines the RSO interface v5, which extends v4 to add conditional rendering support.