GL Studio C++ Runtime API
gls_rso_wrapper.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsRSOWrapper 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
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 _GLS_RSO_WRAPPER_H
41#define _GLS_RSO_WRAPPER_H
42
43#include "component_base.h"
44
45#ifdef GLES
46# include "rso_interface_es_2.h"
47typedef disti::RSOInterfaceES1 RsoImplBaseInterface; ///< Typedef for the original RSO interface.
48typedef disti::RSOInterfaceES2::RSOPainter RSOPainterT; ///< Typedef for the RSO interface painter type.
49#else
50# include "rso_interface_5.h"
51typedef disti::RSOInterface1 RsoImplBaseInterface; ///< Typedef for the original RSO interface.
52typedef disti::RSOInterface5::RSOPainter RSOPainterT; ///< Typedef for the RSO interface painter type.
53#endif
54
55namespace disti
56{
57class AttributeWrapperMap;
58class EmittedEventHandlerImpl;
59class MouseEvent;
60
61/** The GlsRSOWrapper class wraps an RsoImplBaseInterface object
62 so that it can be inserted into the GL Studio heirarchy.
63 */
65 , virtual public RSOPainterT
66{
67public:
68 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
69 typedef ComponentBase _BaseClass; ///< Deprecated typedef for the base class.
70 typedef ComponentBase BaseClass; ///< Typedef for the base class.
71
72 /// Constructor
73 /// \param rso The RSO to wrap.
74 /// \param RSOVersion The highest RSOInterface the RSO supports (e.g. 1,2,3).
75 GLS_EXPORT GlsRSOWrapper( RsoImplBaseInterface* rso, unsigned int RSOVersion );
76
77 /// Call CreateInstance() and Destroy() instead of new and delete
78 /// in a mixed-library environment to ensure that matching
79 /// new and delete operators are called.
80 /// \param rso The RSO to wrap.
81 /// \param RSOVersion The highest RSOInterface the RSO supports (e.g. 1,2,3).
82 /// \return A pointer to a new GlsRSOWrapper object.
83 static GLS_EXPORT GlsRSOWrapper* CreateInstance( RsoImplBaseInterface* rso, unsigned int RSOVersion );
84
85 /** Destructor
86 * Don't call "delete yourComponent;", instead call "yourComponent->Destroy();"
87 * to ensure that the object is deleted correctly.
88 */
90
91 /** Utility Method: Users should call Destroy() instead.
92 * Safely delete an object that was created using CreateInstance.
93 */
94 virtual GLS_EXPORT void DeleteInstance();
95
96 /** Replace the RSO that the GlsRSOWrapper is wrapping.
97 * \param rso The new RSO to use
98 * \param deleteCurrent Whether to delete the currently referenced rso. If false, then the caller is responsible for deleting it.
99 */
100 GLS_EXPORT void ChangeRSO( RsoImplBaseInterface* rso, bool deleteCurrent = true );
101
102 /// \return The current RSOInterface object.
104
105 /// \return The rso version.
106 unsigned int GetRSOVersion() const
107 {
108 return _rsoVersion;
109 }
110
111 /// Handle an event that was emitted from the RSO.
112 /// \param ev The event to handle.
113 /// \return Non-zero if the event was handled, otherwise zero.
115
116 /// \return The qualified instance name of the initiator of the last
117 /// event that was passed to HandleEmittedEvent or "" if no events
118 /// have been passed to HandleEmittedEvent.
120
121 // DisplayObject overrides
122
125 virtual GLS_EXPORT void AntiAlias( bool alias ) DISTI_METHOD_OVERRIDE;
130 virtual GLS_EXPORT void SetColor( const GlsColor& color ) DISTI_METHOD_OVERRIDE;
131 virtual GLS_EXPORT void CullBackFace( const bool val ) DISTI_METHOD_OVERRIDE;
134 virtual GLS_EXPORT void DepthTest( unsigned char zbuf ) DISTI_METHOD_OVERRIDE;
136 virtual GLS_EXPORT void LightingEnabled( bool lighting ) DISTI_METHOD_OVERRIDE;
142 virtual GLS_EXPORT void LineWidth( float width ) DISTI_METHOD_OVERRIDE;
150 virtual GLS_EXPORT void Shading( const int shading ) DISTI_METHOD_OVERRIDE;
152 virtual GLS_EXPORT void TextureIndex( int textureIndex ) DISTI_METHOD_OVERRIDE;
154 virtual GLS_EXPORT void TextureRepeat( const int rep ) DISTI_METHOD_OVERRIDE;
161
163
164 virtual GLS_EXPORT void Calculate( double time ) DISTI_METHOD_OVERRIDE;
165
167
168 virtual GLS_EXPORT DisplayObject* CloneObject( bool generateNames = false ) DISTI_METHOD_OVERRIDE;
169
171
173
174#ifndef GLES
176
178#endif
180
182
183 virtual GLS_EXPORT void GetExtents( float& x, float& y, float& z, float& x1, float& y1, float& z1 ) DISTI_METHOD_OVERRIDE;
184
185 virtual GLS_EXPORT void GetTransformedExtents( Vector& min, Vector& max, const GlsMatrixType& matrix, bool resetMinMax = true ) DISTI_METHOD_OVERRIDE;
186
188
190
192
194
195 virtual GLS_EXPORT DisplayObject* Pick3D( const Vector& winLoc,
196 const Vector& logicalCoords,
197 float scale,
198 const Vector& directionVector,
199 Vector& collisionWinLoc /*Returned*/,
200 const OpenGLMatrices& drawnMatrices ) DISTI_METHOD_OVERRIDE;
201
202 virtual GLS_EXPORT void PreDraw( const OpenGLMatrices& current, Culler& culler ) DISTI_METHOD_OVERRIDE;
203
204 virtual GLS_EXPORT void GetResources( std::ostream& outstr, GlsResourceFilter* filter = NULL ) DISTI_METHOD_OVERRIDE;
205
207
208 /* Unhides base class implementation. */
209 using ComponentBase::Rotate;
210 using ComponentBase::Scale;
211
213
214 GLS_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
215
218
219protected:
220 /** enum that guides the state machine for multitouch handling for RSO's that don't support multitouch.
221 * An RSO starts in the READY_FOR_INPUT state. When it handles a mouse drag event, it moves to PROCESSING_MOUSE_DRAG
222 * state. It will ignore any other mouse events if they are not for the original cursor_id. Then, once the RSO either receives the
223 * MOUSE_UP event or stops handling the MOUSE_DRAG events, the RSO then transitions to WAITING_FOR_MOUSE_DOWN (i.e. it keeps ignoring other cursors
224 * that might have been dragging on it while it was processing its original cursor event). Once it receives a new mouse down, it transitions back to READY_FOR_INPUT
225 */
227 {
228 READY_FOR_INPUT,
229 PROCESSING_MOUSE_DRAG,
230 WAITING_FOR_MOUSE_DOWN
231 };
232
233 RsoImplBaseInterface* _rsoInterface; ///< The RSO being wrapped by this interface.
234 AttributeWrapperMap* _attributeWrapperMap; ///< A map of attributes that wrap to the attributes within the RSO.
235 EmittedEventHandlerImpl* _rsoEmittedEventHandler; ///< The event handler for the RSO.
236 char* _lastEmittedEventInitiatorName; ///< The name of the last object who emitted an event that made it to the event handler.
237 MultitouchState _multitouchState; ///< The current multitouch input state, \see MultitouchState
238 unsigned int _currentCursor; ///< The cursor id of the current mouse / touch interacting with the RSO.
239 unsigned int _rsoVersion; ///< The interface version of the wrapped RSO.
240
241 /// Set the name of the object who most recently emitted an event that was handled by the event handler.
242 /// \note Not normally called by users.
243 /// \param name The new object name to set.
245
246 /// This function should be called to handle mouse events if the RSO handles multitouch (RSO version 3 or greater).
247 /// \note Not normally called by users.
248 /// \param mev The event to handle.
249 /// \return A pointer to the object that received the event, or NULL.
251};
252
253} // namespace disti
254
255#endif
Definition: component_base.h:68
bool AbsolutePlacement() const
Definition: component_base.h:124
Definition: cull.h:50
Definition: events.h:113
virtual float Scale()
Definition: display_frame.h:134
Definition: display.h:96
Definition: disti_metadata.h:220
Definition: dynamic_array.h:79
Definition: gls_color.h:54
Definition: gls_painter.h:51
Definition: gls_rso_wrapper.h:66
virtual int PolygonMode() override
virtual int TextureMagnificationFilter() override
const char * LastEmittedEventInitiatorName() const
virtual GlsColor GetBlendColor() override
virtual void Calculate(double time) override
virtual DisplayObject * CloneObject(bool generateNames=false) override
unsigned int _currentCursor
The cursor id of the current mouse / touch interacting with the RSO.
Definition: gls_rso_wrapper.h:238
virtual bool TextureRepeat() override
virtual void CreateObjects() override
virtual float LineWidth() override
virtual int TextureMappingTechnique() override
virtual void Rotate(const Vector &orig, float angle, const Vector &axis) override
virtual void GetResources(std::ostream &outstr, GlsResourceFilter *filter=NULL) override
virtual void DeleteInstance()
virtual void Invalidate() override
void LastEmittedEventInitiatorName(const char *name)
virtual GlsColor GetColor() override
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array) override
virtual int LineStippleMultiplier() override
virtual int LineStipplePattern() override
virtual int TextureMinificationFilter() override
virtual void CalculateBoundingBox() override
void SetValue(int spec, va_list &args) override
AttributeWrapperMap * _attributeWrapperMap
A map of attributes that wrap to the attributes within the RSO.
Definition: gls_rso_wrapper.h:234
unsigned int _rsoVersion
The interface version of the wrapped RSO.
Definition: gls_rso_wrapper.h:239
virtual void Initialize() override
MultitouchState
Definition: gls_rso_wrapper.h:227
unsigned int GetRSOVersion() const
Definition: gls_rso_wrapper.h:106
RsoImplBaseInterface * _rsoInterface
The RSO being wrapped by this interface.
Definition: gls_rso_wrapper.h:233
virtual void SetColor(const GlsColor &color) override
virtual DistiAttributeBase & Resource(const char *name) override
virtual void GetExtents(float &x, float &y, float &z, float &x1, float &y1, float &z1) override
virtual DisplayObject * HandleInput(DisplayEvent *ev) override
virtual int TextureIndex() override
virtual void AlphaMode(int mode) override
virtual bool CullBackFace() override
EmittedEventHandlerImpl * _rsoEmittedEventHandler
The event handler for the RSO.
Definition: gls_rso_wrapper.h:235
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) override
virtual bool LightingEnabled() override
virtual void CopyProperties(DisplayObject *src) override
virtual int AlphaMode() override
virtual DisplayObject * Pick3D(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices) override
virtual bool AntiAlias() override
RsoImplBaseInterface * RSOInterface()
MultitouchState _multitouchState
The current multitouch input state,.
Definition: gls_rso_wrapper.h:237
virtual void Draw() override
virtual void SetPainter(GlsPainter *painter) override
virtual int Shading() override
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler) override
char * _lastEmittedEventInitiatorName
The name of the last object who emitted an event that made it to the event handler.
Definition: gls_rso_wrapper.h:236
virtual DisplayObject * handle(DisplayEvent *ev) override
virtual void UpdateBoundingVolume() override
int HandleEmittedEvent(RsoImplBaseInterface::Event *ev)
void ChangeRSO(RsoImplBaseInterface *rso, bool deleteCurrent=true)
virtual int PolygonEnd() override
virtual void Init() override
virtual void GetTransformedExtents(Vector &min, Vector &max, const GlsMatrixType &matrix, bool resetMinMax=true) override
virtual void CopyGeometry(DisplayObject *src) override
virtual int MaterialIndex() override
virtual DisplayObject * HandleMultiTouchInput(MouseEvent *mev)
virtual void SetBlendColor(const GlsColor &color) override
virtual int DepthTest() override
Definition: gls_resources.h:51
Definition: group.h:53
static DisplayObject * CreateInstance()
Definition: events.h:225
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
Definition: rso_interface_1.h:322
Definition: rso_interface_1.h:61
Definition: rso_interface_5.h:66
Definition: vertex.h:85
The disti::ComponentBase class.
#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 GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
disti::RSOInterface5::RSOPainter RSOPainterT
Typedef for the RSO interface painter type.
Definition: gls_rso_wrapper.h:52
disti::RSOInterface1 RsoImplBaseInterface
Typedef for the original RSO interface.
Definition: gls_rso_wrapper.h:51
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47
DistiAttribDict::const_iterator end(const DistiAttribDict &dict)
Definition: disti_metadata.h:959
Defines the RSO interface v5, which extends v4 to add conditional rendering support.