| GL Studio C++ Runtime API

Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
GlsRSOInterfaceImpl Class Reference

`#include <gls_rso_interface_impl.h>`

Inheritance diagram for GlsRSOInterfaceImpl:

## Public Member Functions
int | LiveComponentEventHandlerCb (ComponentBase *, disti::DisplayEvent *ev)
void | Calculate (double time) override
| The RSO Interface methods. More...
RsoImplBaseInterface * | CloneObject () 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 *ev) override
bool | HandleMultiTouchInput (RsoImplMultiTouchInterface::MouseMultiTouchEvent *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 &current, 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 handle, 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 handle, double resourceVal) override
double | GetFloatResource (ResourceHandle resourceHandle) override
CallbackID | RegisterResourceObserver (ResourceHandle resourceHandle, ResourceObserver *observer) override
void | UnregisterResourceObserver (ResourceHandle resourceHandle, CallbackID id) override
unsigned int | GetMaxNumLights ()
void | SetLightData (unsigned int numLights, LightData *lightData)
unsigned int | GetMaxClipPlanes ()
void | SetClipPlaneData (unsigned int numClipPlanes, float **equations)
void | SetMatrix (int type, const float *matrix)
void | SetDefaultOpenGLState ()
| Restores the state manager back to its default state.
void | Invalidate () override
bool | IsInvalidated () const override
void | SetPainter (RSOPainterT *painter) override
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 GlsRSOInterfaceImpl * | CreateInstance (ComponentBase *component)

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

## Protected Member Functions
DistiAttributeBase & | GetAttribute (ResourceHandle handle)
| GlsRSOInterfaceImpl (ComponentBase *component)

## 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.

## Detailed Description

Implementation of RSOInterface.

## Constructor & Destructor Documentation

## ◆ GlsRSOInterfaceImpl()

GlsRSOInterfaceImpl | ( | ComponentBase * | component | ) |
| protected

Protected constructor - Call CreateInstance instead

Parameters

  component | The component object to wrap.

## Member Function Documentation

## ◆ Calculate()

void Calculate | ( | double | time | ) |
| override

The RSO Interface methods.

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

Parameters

  time | The current application time in seconds.

## ◆ CloneObject()

RsoImplBaseInterface * CloneObject | ( |  | ) |
| override

Returns
  A new instance of the RSO that is a clone of this object or NULL if not possible.

## ◆ CreateInstance()

static GlsRSOInterfaceImpl * CreateInstance | ( | ComponentBase * | component | ) |
| static

Returns
  An RSO interface wrapper for the incoming component object.

Parameters

  component | The component object to wrap.

## ◆ CreateResourceHandle()

ResourceHandle CreateResourceHandle | ( | const char * | resourceName | ) |
| override

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

  resourceName | The resource name to create a handle for.

Returns
  A handle to the desired resource.

## ◆ DeleteInstance()

void DeleteInstance | ( |  | ) |
| override

Safely delete the object.

## ◆ Draw()

void Draw | ( |  | ) |
| override

Draw the object via OpenGL Call this after PreDraw()

## ◆ GetAttribute()

DistiAttributeBase & GetAttribute | ( | ResourceHandle | handle | ) |
| protected

Returns
  The runtime attribute associated with the external handle.

Parameters

  handle | The external id for the desired runtime attribute.

## ◆ GetBoundingBox()

bool GetBoundingBox | ( | RsoImplBaseInterface::Vector * | min,
|  | RsoImplBaseInterface::Vector * | max,
|  | const RSOMatrixT * | transform = `NULL`
| ) |  |
| override

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

Parameters

  min | If the method returns true, contains the point corresponding with the 1st corner of the box. If the method returns false, value is undefined.
  max | If the method returns true, contains the point corresponding with the 2nd corner of the box. If the method returns false, value is undefined.
  transform | Transformation 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.

## ◆ GetBoundingSphere()

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

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

Parameters

  center | If the method returns true, contains the center point of the sphere. If the method returns false, value is undefined.
  radius | If 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.

## ◆ GetFloatResource() [1/2]

double GetFloatResource | ( | const char * | resourceName | ) |
| override

Returns
  The value as a float for a given named resource.

Parameters

  resourceName | The name to return the float value for.

## ◆ GetFloatResource() [2/2]

double GetFloatResource | ( | ResourceHandle | resourceHandle | ) |
| override

Returns
  The value as a float for a resource specified by handle.

Parameters

  resourceHandle | The handle to return the integer value for.

## ◆ GetIntResource() [1/2]

long GetIntResource | ( | const char * | resourceName | ) |
| override

Returns
  The value as an integer for a given named resource.

Parameters

  resourceName | The name to return the integer value for.

## ◆ GetIntResource() [2/2]

long GetIntResource | ( | ResourceHandle | resourceHandle | ) |
| override

Returns
  The value as an integer for a resource specified by handle.

Parameters

  resourceHandle | The handle to return the integer value for.

## ◆ GetMaxClipPlanes()

unsigned int GetMaxClipPlanes | ( |  | ) |

Returns
  The maximum number of clip planes supported by the current driver.

## ◆ GetMaxNumLights()

unsigned int GetMaxNumLights | ( |  | ) |

Returns
  The maximum number of possible lights this platform supports.

## ◆ GetResource() [1/2]

const char * GetResource | ( | const char * | resourceName | ) |
| override

Get the string value for the given resource

Parameters

  resourceName | The name of the resource whose value is to be returned.

Returns
  The string value for the given resource, or empty string if not found.

## ◆ GetResource() [2/2]

const char * GetResource | ( | ResourceHandle | resourceHandle | ) |
| override

Returns
  The string value for a resource specified by handle.

Parameters

  resourceHandle | The handle to return the string value for.

## ◆ GetResources()

const char * GetResources | ( | RsoImplBaseInterface::ResourceFilter * | filter = `NULL` | ) |
| override

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

  filter | The filter parameters to use.

Returns
  A string containing the list of resource data that passes the filter.

## ◆ HandleInput()

bool HandleInput | ( | RsoImplBaseInterface::Event * | ev | ) |
| override

Allow the object to handle an event

Parameters

  ev | The event to handle.

Returns
  True if the event was handled by the component.

## ◆ HandleMultiTouchInput()

bool HandleMultiTouchInput | ( | RsoImplMultiTouchInterface::MouseMultiTouchEvent * | ev | ) |
| override

Allow the object to handle a multitouch event.

Parameters

  ev | The event to handle.

Returns
  True if the event was handled by the component.

## ◆ Invalidate()

void Invalidate | ( |  | ) |
| override virtual

Notify the painter that the scene needs to be redrawn

Implements GlsPainter.

## ◆ IsInvalidated()

bool IsInvalidated | ( |  | ) | const
| override virtual

Returns
  Whether or not the painter has already been invalidated.

Implements GlsPainter.

## ◆ IsResourceHandleValid()

bool IsResourceHandleValid | ( | ResourceHandle | resourceHandle | ) |
| override

Checks if a given resource handle is valid.

Parameters

  resourceHandle | The resource handle to check.

Returns
  Whether or not the handle is valid.

## ◆ LiveComponentEventHandlerCb()

int LiveComponentEventHandlerCb | ( | ComponentBase * | ,
|  | disti::DisplayEvent * | ev
| ) |  |

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

Parameters

  ev | The 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
| ) |  |
| override

Pick3D returns true if the RSO was picked.

Parameters

  winLoc | Device coordinates for the mouse click. Z value should be set to 0 to ensure pick ray starts at near clip plane.
  logicalCoords | The start of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
  scale | Current window scale. Affects picking radius of outlines. Initial value should typically be 1.0.
  directionVector | The direction of the pick ray in logical coordinates. Should be calculated from the winLoc using this->WindowToLogical(winLoc, logicalCoords, &directionVector).
  collisionWinLoc | Returns where the pick vector intersects the object that is hit in device coordinates.
  drawnMatrices | The 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.

## ◆ PreDraw()

void PreDraw | ( | const RsoImplBaseInterface::OpenGLMatrices & | current,
|  | RsoImplBaseInterface::Culler & | culler
| ) |  |
| override

Calculate transformations and perform culling Call this before Draw()

Parameters

  current | The current state of the OpenGL matrices.
  culler | The current culler state.

## ◆ RegisterResourceObserver()

CallbackID RegisterResourceObserver | ( | ResourceHandle | resourceHandle,
|  | ResourceObserver * | observer
| ) |  |
| override

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

Parameters

  resourceHandle | the resource handle
  observer | the 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

## ◆ ReleaseResourceHandle()

void ReleaseResourceHandle | ( | ResourceHandle | resourceHandle | ) |
| override

Disposes of a resource handle.

Parameters

  resourceHandle | The resource handle to release.

## ◆ SetClipPlaneData()

void SetClipPlaneData | ( | unsigned int | numClipPlanes,
|  | float ** | equations
| ) |  |

Activates and updates the clip planes in the state manager.

Parameters

  [in] | numClipPlanes | Determines how many planes are defined in the equations array.
  [in] | equations | An array of floats that define each plane where each equation is defined by four floats. equations[numClipPlanes][4].

## ◆ SetEmittedEventHandler()

bool SetEmittedEventHandler | ( | RsoImplBaseInterface::EmittedEventHandler * | handler | ) |
| override

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

Parameters

  handler | pointer 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.

## ◆ SetFloatResource() [1/2]

void SetFloatResource | ( | const char * | resourceName,
|  | double | resourceVal
| ) |  |
| override

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

Parameters

  resourceName | The name of the resource to set.
  resourceVal | The new float value to set.

## ◆ SetFloatResource() [2/2]

void SetFloatResource | ( | ResourceHandle | handle,
|  | double | resourceVal
| ) |  |
| override

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

Parameters

  handle | The handle of the resource to set.
  resourceVal | The new float value to set.

## ◆ SetIntResource() [1/2]

void SetIntResource | ( | const char * | resourceName,
|  | long | resourceVal
| ) |  |
| override

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

Parameters

  resourceName | The name of the resource to set.
  resourceVal | The new integer value to set.

## ◆ SetIntResource() [2/2]

void SetIntResource | ( | ResourceHandle | handle,
|  | long | resourceVal
| ) |  |
| override

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

Parameters

  handle | The handle of the resource to set.
  resourceVal | The new integer value to set.

## ◆ SetLightData()

void SetLightData | ( | unsigned int | numLights,
|  | LightData * | lightData
| ) |  |

Updates the state manager to set various light parameters.

Parameters

  numLights | The number of lights within the lightData.
  lightData | An array of data where each element contains a collection of light properties.

## ◆ SetMatrix()

void SetMatrix | ( | int | type,
|  | const float * | matrix
| ) |  |

Updates the state manager's top matrix based on the type.

Parameters

  [in] | type | If it's equal to RSO_MODELVIEW_MATRIX, it'll load the model view matrix. If it's RSO_PROJECTION_MATRIX, then it'll retrieve the ProjectionMatrix instead.
  [in] | matrix | The matrix to push to the top of the stack.

## ◆ SetPainter()

void SetPainter | ( | RSOPainterT * | painter | ) |
| override

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

Parameters

  painter | The new painter to set, or NULL for no painter.

## ◆ SetResource() [1/2]

void SetResource | ( | const char * | resourceName,
|  | const char * | resourceVal
| ) |  |
| override

Set the string value for a given named resource.

Parameters

  resourceName | The name of the resource to set.
  resourceVal | The new string value to set for the resource.

## ◆ SetResource() [2/2]

void SetResource | ( | ResourceHandle | resourceHandle,
|  | const char * | resourceVal
| ) |  |
| override

Set the string value for a resource specified by handle

Parameters

  resourceHandle | The handle of the resource to set.
  resourceVal | The new string value to set.

## ◆ UnregisterResourceObserver()

void UnregisterResourceObserver | ( | ResourceHandle | resourceHandle,
|  | CallbackID | id
| ) |  |
| override

Unregister a resource observer

Parameters

  resourceHandle | the resource handle used to register the observer
  id | the id used to register the resource observer

## 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:

- gls_rso_interface_impl.h