GL Studio C++ Runtime API
GlsRSOInterfaceImpl Class Reference

#include <gls_rso_interface_impl.h>

Inheritance diagram for GlsRSOInterfaceImpl:
RSOInterface5 GlsPainter RSOInterface4 RSOInterface3 RSOInterface2 RSOInterface1

Public Member Functions

int LiveComponentEventHandlerCb (ComponentBase *, disti::DisplayEvent *ev)
 
void Calculate (double time) override
 The RSO Interface methods. More...
 
RsoImplBaseInterfaceCloneObject () override
 
void DeleteInstance () override
 Safely delete the object. More...
 
void Draw () override
 
bool SetEmittedEventHandler (RsoImplBaseInterface::EmittedEventHandler *handler) override
 
bool GetBoundingSphere (RsoImplBaseInterface::Vector *center, float *radius) override
 
bool GetBoundingBox (RsoImplBaseInterface::Vector *min, RsoImplBaseInterface::Vector *max, const RSOMatrixT *transform=NULL) override
 
bool HandleInput (RsoImplBaseInterface::Event *lci1_ev) override
 
bool HandleMultiTouchInput (RsoImplMultiTouchInterface::MouseMultiTouchEvent *lci3_ev) override
 
bool Pick3D (const RsoImplBaseInterface::Vector &winLoc, const RsoImplBaseInterface::Vector &logicalCoords, float scale, const RsoImplBaseInterface::Vector &directionVector, RsoImplBaseInterface::Vector &collisionWinLoc, const RsoImplBaseInterface::OpenGLMatrices &drawnMatrices) override
 
void PreDraw (const RsoImplBaseInterface::OpenGLMatrices &parentMatrices, RsoImplBaseInterface::Culler &culler) override
 
void SetResource (const char *resourceName, const char *resourceVal) override
 
const char * GetResource (const char *resourceName) override
 
const char * GetResources (RsoImplBaseInterface::ResourceFilter *filter=NULL) override
 
ResourceHandle CreateResourceHandle (const char *resourceName) override
 
void ReleaseResourceHandle (ResourceHandle resourceHandle) override
 
bool IsResourceHandleValid (ResourceHandle resourceHandle) override
 
void SetResource (ResourceHandle resourceHandle, const char *resourceVal) override
 
const char * GetResource (ResourceHandle resourceHandle) override
 
void SetIntResource (const char *resourceName, long resourceVal) override
 
long GetIntResource (const char *resourceName) override
 
void SetIntResource (ResourceHandle resourceHandle, long resourceVal) override
 
long GetIntResource (ResourceHandle resourceHandle) override
 
void SetFloatResource (const char *resourceName, double resourceVal) override
 
double GetFloatResource (const char *resourceName) override
 
void SetFloatResource (ResourceHandle resourceHandle, double resourceVal) override
 
double GetFloatResource (ResourceHandle resourceHandle) override
 
CallbackID RegisterResourceObserver (ResourceHandle resourceHandle, ResourceObserver *obs) override
 
void UnregisterResourceObserver (ResourceHandle resourceHandle, CallbackID id) override
 
void Invalidate () override
 Notify the painter that the scene needs to be redrawn. More...
 
bool IsInvalidated () const override
 
void SetPainter (RSOPainterT *painter) override
 
virtual void SetPainter (RSOPainter *painter)=0
 
virtual CallbackID RegisterResourceObserver (ResourceHandle resourceHandle, ResourceObserver *observer)=0
 
virtual void UnregisterResourceObserver (ResourceHandle resourceHandle, CallbackID id)=0
 
virtual bool HandleMultiTouchInput (MouseMultiTouchEvent *ev)=0
 
- Public Member Functions inherited from RSOInterface2
virtual ResourceHandle CreateResourceHandle (const char *resourceName)=0
 
virtual void ReleaseResourceHandle (ResourceHandle resourceHandle)=0
 
virtual bool IsResourceHandleValid (ResourceHandle resourceHandle)=0
 
virtual void SetResource (ResourceHandle resourceHandle, const char *resourceVal)=0
 
virtual const char * GetResource (ResourceHandle resourceHandle)=0
 
virtual void SetIntResource (const char *resourceName, long resourceVal)=0
 
virtual long GetIntResource (const char *resourceName)=0
 
virtual void SetIntResource (ResourceHandle handle, long resourceVal)=0
 
virtual long GetIntResource (ResourceHandle resourceHandle)=0
 
virtual void SetFloatResource (const char *resourceName, double resourceVal)=0
 
virtual double GetFloatResource (const char *resourceName)=0
 
virtual void SetFloatResource (ResourceHandle handle, double resourceVal)=0
 
virtual double GetFloatResource (ResourceHandle resourceHandle)=0
 
virtual const char * GetResource (const char *resourceName)=0
 
virtual void SetResource (const char *resourceName, const char *resourceVal)=0
 
virtual void Calculate (double time)=0
 The RSO Interface methods. More...
 
virtual void PreDraw (const OpenGLMatrices &current, Culler &culler)=0
 
virtual void Draw ()=0
 
virtual void SetResource (const char *resourceName, const char *resourceVal)=0
 
virtual const char * GetResource (const char *resourceName)=0
 
virtual const char * GetResources (ResourceFilter *filter=0)=0
 
virtual bool HandleInput (Event *ev)=0
 
virtual bool SetEmittedEventHandler (EmittedEventHandler *handler)=0
 
virtual bool Pick3D (const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices)=0
 
virtual bool GetBoundingSphere (Vector *center, float *radius)=0
 
virtual bool GetBoundingBox (Vector *min, Vector *max, const MatrixD *transform=0)=0
 
virtual RSOInterface1CloneObject ()=0
 
virtual void DeleteInstance ()=0
 Safely delete the object. More...
 
virtual void Invalidate ()=0
 Notify the painter that the scene needs to be redrawn. More...
 
virtual bool IsInvalidated () const =0
 

Static Public Member Functions

static GlsRSOInterfaceImplCreateInstance (ComponentBase *component)
 
- Static Public Member Functions inherited from RSOInterface1
static unsigned int strlen (const char *str)
 
static char * strcpy (char *dest, const char *src)
 

Protected Types

typedef std::map< ResourceHandle, DistiAttributeBase * > ResourceHandleMap
 Typedef to associate external ids (ResourceHandle) with runtime attributes.
 

Protected Member Functions

DistiAttributeBaseGetAttribute (ResourceHandle handle)
 
 GlsRSOInterfaceImpl (ComponentBase *component)
 
- Protected Member Functions inherited from RSOInterface5
virtual ~RSOInterface5 ()
 Protected destructor so it can't be deleted directly.
 
- Protected Member Functions inherited from RSOInterface4
virtual ~RSOInterface4 ()
 Protected destructor so it can't be deleted directly.
 
- Protected Member Functions inherited from RSOInterface3
virtual ~RSOInterface3 ()
 Protected destructor so it can't be deleted directly.
 
- Protected Member Functions inherited from RSOInterface2
virtual ~RSOInterface2 ()
 Protected destructor so it can't be deleted directly.
 
- Protected Member Functions inherited from RSOInterface1
virtual ~RSOInterface1 ()
 Protected destructor so it can't be deleted directly.
 

Protected Attributes

ComponentBase_component
 
RsoImplBaseInterface::EmittedEventHandler_emittedEventHandler
 The container's event handler.
 
std::string _resourcesRetVal
 String to return from Resources methods.
 
ResourceHandleMap _resourceHandleMap
 Mapping of external RSO interface resource ids with runtime attributes.
 
ResourceHandle _nextResourceHandle
 Used to track the highest id, to assign as the next resource handle.
 
bool _firstDraw
 If true, this RSO has not been drawn yet.
 
RSOPainterT_painter
 Painter object that tracks the conditional rendering state.
 
bool _redraw
 If true, this RSO should redraw itself on the next frame.
 

Additional Inherited Members

- Public Types inherited from RSOInterface4
typedef unsigned int CallbackID
 Type for unique identifiers.
 
- Public Types inherited from RSOInterface2
typedef unsigned int ResourceHandle
 Typedef for a unique resource identifier.
 

Detailed Description

Implementation of RSOInterface.

Constructor & Destructor Documentation

◆ GlsRSOInterfaceImpl()

GlsRSOInterfaceImpl ( ComponentBase component)
protected

Protected constructor - Call CreateInstance instead

Parameters
componentThe component object to wrap.

Member Function Documentation

◆ Calculate()

void Calculate ( double  time)
overridevirtual

The RSO Interface methods.

Perform component simulation. Any non-drawing activities can be performed here. Call this before PreDraw()

Parameters
timeThe current application time in seconds.

Implements RSOInterface1.

◆ CloneObject()

RsoImplBaseInterface * CloneObject ( )
overridevirtual
Returns
A new instance of the RSO that is a clone of this object or NULL if not possible.

Implements RSOInterface1.

◆ CreateInstance()

static GlsRSOInterfaceImpl * CreateInstance ( ComponentBase component)
static
Returns
An RSO interface wrapper for the incoming component object.
Parameters
componentThe component object to wrap.

◆ CreateResourceHandle()

ResourceHandle CreateResourceHandle ( const char *  resourceName)
overridevirtual

Obtains a resource handle to a given named resource This handle must be disposed of with the ReleaseResourceHandle method once it is no longer needed. If this method fails, the return value will not be a valid handle; this can be determined by calling IsResourceHandleValid.

Parameters
resourceNameThe resource name to create a handle for.
Returns
A handle to the desired resource.

Implements RSOInterface2.

◆ DeleteInstance()

void DeleteInstance ( )
overridevirtual

Safely delete the object.

Implements RSOInterface1.

◆ Draw()

void Draw ( )
overridevirtual

Draw the object via OpenGL Call this after PreDraw()

Implements RSOInterface1.

◆ GetAttribute()

DistiAttributeBase & GetAttribute ( ResourceHandle  handle)
protected
Returns
The runtime attribute associated with the external handle.
Parameters
handleThe external id for the desired runtime attribute.

◆ GetBoundingBox()

bool GetBoundingBox ( RsoImplBaseInterface::Vector min,
RsoImplBaseInterface::Vector max,
const RSOMatrixT transform = NULL 
)
overridevirtual

Get the extents of the component when drawn with the given transformation matrix, as a coordinate system-aligned box

Parameters
minIf the method returns true, contains the point corresponding with the 1st corner of the box. If the method returns false, value is undefined.
maxIf the method returns true, contains the point corresponding with the 2nd corner of the box. If the method returns false, value is undefined.
transformTransformation matrix from A to B where A is the component's coordinate system and B is the coordinate system to compute the bounding box in. (If NULL then identity matrix is assumed)
Returns
true if the extents were calculated, false if the extents could not be calculated.

Implements RSOInterface1.

◆ GetBoundingSphere()

bool GetBoundingSphere ( RsoImplBaseInterface::Vector center,
float *  radius 
)
overridevirtual

Get the bounding sphere for the component in the components coordinate system

Parameters
centerIf the method returns true, contains the center point of the sphere. If the method returns false, value is undefined.
radiusIf the method returns true, contains the radius of the sphere. If the method returns false, value is undefined.
Returns
true if the bounding sphere was returned, false if the bounding sphere is not available.

Implements RSOInterface1.

◆ GetFloatResource() [1/2]

double GetFloatResource ( const char *  resourceName)
overridevirtual
Returns
The value as a float for a given named resource.
Parameters
resourceNameThe name to return the float value for.

Implements RSOInterface2.

◆ GetFloatResource() [2/2]

double GetFloatResource ( ResourceHandle  resourceHandle)
overridevirtual
Returns
The value as a float for a resource specified by handle.
Parameters
resourceHandleThe handle to return the integer value for.

Implements RSOInterface2.

◆ GetIntResource() [1/2]

long GetIntResource ( const char *  resourceName)
overridevirtual
Returns
The value as an integer for a given named resource.
Parameters
resourceNameThe name to return the integer value for.

Implements RSOInterface2.

◆ GetIntResource() [2/2]

long GetIntResource ( ResourceHandle  resourceHandle)
overridevirtual
Returns
The value as an integer for a resource specified by handle.
Parameters
resourceHandleThe handle to return the integer value for.

Implements RSOInterface2.

◆ GetResource() [1/2]

const char * GetResource ( const char *  resourceName)
overridevirtual

Get the string value for the given resource

Parameters
resourceNameThe name of the resource whose value is to be returned.
Returns
The string value for the given resource, or empty string if not found.

Implements RSOInterface1.

◆ GetResource() [2/2]

const char * GetResource ( ResourceHandle  resourceHandle)
overridevirtual
Returns
The string value for a resource specified by handle.
Parameters
resourceHandleThe handle to return the string value for.

Implements RSOInterface2.

◆ GetResources()

const char * GetResources ( RsoImplBaseInterface::ResourceFilter filter = NULL)
overridevirtual

Get a list of the resources for the component. Each resource is separated by a newline ('
') with the output controlled by filter. filter may be NULL in which case the default values are used.

Parameters
filterThe filter parameters to use.
Returns
A string containing the list of resource data that passes the filter.

Implements RSOInterface1.

◆ HandleInput()

bool HandleInput ( RsoImplBaseInterface::Event ev)
overridevirtual

Allow the object to handle an event

Parameters
evThe event to handle.
Returns
True if the event was handled by the component.

Implements RSOInterface1.

◆ HandleMultiTouchInput()

bool HandleMultiTouchInput ( RsoImplMultiTouchInterface::MouseMultiTouchEvent ev)
overridevirtual

Allow the object to handle a multitouch event.

Parameters
evThe event to handle.
Returns
True if the event was handled by the component.

Implements RSOInterface3.

◆ Invalidate()

void Invalidate ( )
overridevirtual

Notify the painter that the scene needs to be redrawn.

Implements GlsPainter.

◆ IsInvalidated()

bool IsInvalidated ( ) const
overridevirtual
Returns
Whether or not the painter has already been invalidated.

Implements GlsPainter.

◆ IsResourceHandleValid()

bool IsResourceHandleValid ( ResourceHandle  resourceHandle)
overridevirtual

Checks if a given resource handle is valid.

Parameters
resourceHandleThe resource handle to check.
Returns
Whether or not the handle is valid.

Implements RSOInterface2.

◆ LiveComponentEventHandlerCb()

int LiveComponentEventHandlerCb ( ComponentBase ,
disti::DisplayEvent ev 
)

Pass an event that was emitted from the component to the container.

Parameters
evThe event to pass into the container.
Returns
Zero if the event was not handled, otherwise not zero.

◆ Pick3D()

bool Pick3D ( const RsoImplBaseInterface::Vector winLoc,
const RsoImplBaseInterface::Vector logicalCoords,
float  scale,
const RsoImplBaseInterface::Vector directionVector,
RsoImplBaseInterface::Vector collisionWinLoc,
const RsoImplBaseInterface::OpenGLMatrices drawnMatrices 
)
overridevirtual

Pick3D returns true if the RSO was picked.

Parameters
winLocDevice coordinates for the mouse click. Z value should be set to 0 to ensure pick ray starts at near clip plane.
logicalCoordsThe start of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
scaleCurrent window scale. Affects picking radius of outlines. Initial value should typically be 1.0.
directionVectorThe direction of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
collisionWinLocReturns where the pick vector intersects the object that is hit in device coordinates.
drawnMatricesThe matrices used to draw the object, including matrices set by parents that may have dynamically rotated, translated or scaled this object. Initial value should typically be a default OpenGLMatrices() object.
Returns
True if the object was picked.

Implements RSOInterface1.

◆ PreDraw()

void PreDraw ( const RsoImplBaseInterface::OpenGLMatrices current,
RsoImplBaseInterface::Culler culler 
)
overridevirtual

Calculate transformations and perform culling Call this before Draw()

Parameters
currentThe current state of the OpenGL matrices.
cullerThe current culler state.

Implements RSOInterface1.

◆ RegisterResourceObserver()

CallbackID RegisterResourceObserver ( ResourceHandle  resourceHandle,
ResourceObserver observer 
)
overridevirtual

Register a resource observer to be notified when a resource changes *

Parameters
resourceHandlethe resource handle
observerthe observer to be notified. The RSO takes ownership of the observer and will call Destroy to delete it when needed.
Returns
the id used to unregister the observer in combination with the original resourceHandle

Implements RSOInterface4.

◆ ReleaseResourceHandle()

void ReleaseResourceHandle ( ResourceHandle  resourceHandle)
overridevirtual

Disposes of a resource handle.

Parameters
resourceHandleThe resource handle to release.

Implements RSOInterface2.

◆ SetEmittedEventHandler()

bool SetEmittedEventHandler ( RsoImplBaseInterface::EmittedEventHandler handler)
overridevirtual

Allow for handling events from inside the object. The emitted event handler will be passed events that are from inside the component

Parameters
handlerpointer to the EmittedEventHandler object to use or NULL to remove the current event handler.
Returns
true if this component may emit events, false if this component will never emit events.

Implements RSOInterface1.

◆ SetFloatResource() [1/2]

void SetFloatResource ( const char *  resourceName,
double  resourceVal 
)
overridevirtual

Set the value as a float for a given named resource.

Parameters
resourceNameThe name of the resource to set.
resourceValThe new float value to set.

Implements RSOInterface2.

◆ SetFloatResource() [2/2]

void SetFloatResource ( ResourceHandle  handle,
double  resourceVal 
)
overridevirtual

Set the value as a float for a resource specified by handle.

Parameters
handleThe handle of the resource to set.
resourceValThe new float value to set.

Implements RSOInterface2.

◆ SetIntResource() [1/2]

void SetIntResource ( const char *  resourceName,
long  resourceVal 
)
overridevirtual

Set the value as an integer for a given named resource.

Parameters
resourceNameThe name of the resource to set.
resourceValThe new integer value to set.

Implements RSOInterface2.

◆ SetIntResource() [2/2]

void SetIntResource ( ResourceHandle  handle,
long  resourceVal 
)
overridevirtual

Set the value as an integer for a resource specified by handle.

Parameters
handleThe handle of the resource to set.
resourceValThe new integer value to set.

Implements RSOInterface2.

◆ SetPainter()

void SetPainter ( RSOPainterT painter)
overridevirtual

Set the painter for this object, it will manage when this object should be redrawn.

Parameters
painterThe new painter to set, or NULL for no painter.

Implements RSOInterface5.

◆ SetResource() [1/2]

void SetResource ( const char *  resourceName,
const char *  resourceVal 
)
overridevirtual

Set the string value for a given named resource.

Parameters
resourceNameThe name of the resource to set.
resourceValThe new string value to set for the resource.

Implements RSOInterface1.

◆ SetResource() [2/2]

void SetResource ( ResourceHandle  resourceHandle,
const char *  resourceVal 
)
overridevirtual

Set the string value for a resource specified by handle

Parameters
resourceHandleThe handle of the resource to set.
resourceValThe new string value to set.

Implements RSOInterface2.

◆ UnregisterResourceObserver()

void UnregisterResourceObserver ( ResourceHandle  resourceHandle,
CallbackID  id 
)
overridevirtual

Unregister a resource observer

Parameters
resourceHandlethe resource handle used to register the observer
idthe id used to register the resource observer

Implements RSOInterface4.

Member Data Documentation

◆ _component

ComponentBase* _component
protected

Reference to the component being wrapped. GlsRSOInterface1Impl will delete this object.


The documentation for this class was generated from the following file: