Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
RemoteViz::Rendering::RenderArea Class Reference

RemoteViz More...

#include <RemoteViz/Rendering/RenderArea.h>

Public Member Functions

bool isDisposed () const
 Gets the state of the RenderArea: alive or disposed.
 
const std::string & getId () const
 Gets the renderArea id.
 
std::shared_ptr< ConnectiongetConnection (const std::string &id) const
 Gets an existing Connection to the renderArea.
 
std::shared_ptr< ConnectiongetConnection (unsigned int index) const
 Gets an existing Connection to the renderArea.
 
unsigned int getNumConnections () const
 Gets the number of connections (see Connection) that exist for this renderArea.
 
SoSceneManagergetSceneManager () const
 Gets the Open Inventor scene manager associated with the renderArea.
 
SoTouchManagergetTouchManager () const
 Gets the Open Inventor touch manager associated with the renderArea.
 
SoGLContextgetGLContext () const
 Gets the OpenGL context associated with the renderArea.
 
bool sendMessage (const std::string &message, std::vector< std::shared_ptr< Connection > > excludedConnections={}) const
 Sends a text message to the renderArea connections.
 
bool sendMessage (const std::vector< unsigned char > &buffer, std::vector< std::shared_ptr< Connection > > excludedConnections={}) const
 Sends a binary message to the renderArea connections.
 
unsigned int getWidth () const
 Gets the renderArea width.
 
unsigned int getHeight () const
 Gets the renderArea height.
 
void resize (unsigned int width, unsigned int height)
 Resizes the renderArea at a specific size.
 
void closeConnectionsAndDispose ()
 Closes all connections of the renderArea and disposes it.
 
void addListener (std::shared_ptr< RenderAreaListener > listener)
 Adds a RenderAreaListener to manage the renderArea.
 
void removeListener (std::shared_ptr< RenderAreaListener > listener)
 Removes a RenderAreaListener.
 
void removeAllListeners ()
 Removes all RenderAreaListeners.
 
unsigned int getNumListeners () const
 Gets the number of RenderAreaListener.
 
const std::string & getGpu () const
 Gets the Graphics Processing Unit (GPU) used to render images.
 
void setFrameMessage (const std::string &message)
 Sets the message which will be associate with the next rendered frames.
 

Detailed Description

RemoteViz

Defines the rendering area for Open Inventor rendering. Implement the class RenderAreaListener to receive RenderArea events.

When using ServiceSettings::INVENTOR_SERVICE or ServiceSettings::INVENTOR_APPLICATION service mode, this class provides access to the scene manager and the touch manager to modify the rendering.

A RenderArea object may be created automatically by RemoteViz or created explicitly by the application. When a client requests a connection (see RemoteVizRenderArea::connectTo()), it specifies a render area id. If a render area with that id does not exist, RemoteViz will create one and ServiceListener::onPendingCreateRenderArea() will be called. If a render area with the requested id exists, RemoteViz will use that one and ServiceListener::onPendingShareRenderArea() will be called. An application might want to explicitly create a render area, for example, to preload a default scene graph.

A RenderArea may have zero, one or multiple connections.

A RenderArea allows the application to send text or binary messages to the associated client. A JavaScript client will receive the message using a listener (see RemoteVizRenderArea::addServiceListener). Messages from a client are received using one of the RenderAreaListener::onReceivedMessage() methods.

Definition at line 79 of file RenderArea.h.

Member Function Documentation

◆ addListener()

void RemoteViz::Rendering::RenderArea::addListener ( std::shared_ptr< RenderAreaListener listener)

Adds a RenderAreaListener to manage the renderArea.

Parameters
listener: object that listens to the renderArea events

◆ closeConnectionsAndDispose()

void RemoteViz::Rendering::RenderArea::closeConnectionsAndDispose ( )

Closes all connections of the renderArea and disposes it.

If connections are still open, this method will close them and dispose the renderArea. While executing this method, the listeners ServiceListener::onDisposingRenderArea and ServiceListener::onDisposedRenderArea will be triggered and a DISPOSED disconnect message will be sent to all clients of the renderArea. The listener RenderAreaListener::onClosedConnection will not be triggered after closing connections.

See isDisposed().

◆ getConnection() [1/2]

std::shared_ptr< Connection > RemoteViz::Rendering::RenderArea::getConnection ( const std::string &  id) const

Gets an existing Connection to the renderArea.

Parameters
id: ID identifying the Connection
Returns
the connection object if the id exists, otherwise returns null.

◆ getConnection() [2/2]

std::shared_ptr< Connection > RemoteViz::Rendering::RenderArea::getConnection ( unsigned int  index) const

Gets an existing Connection to the renderArea.

Parameters
index: index identifying the Connection
Returns
the connection object if the index exists, otherwise returns null.

◆ getGLContext()

SoGLContext * RemoteViz::Rendering::RenderArea::getGLContext ( ) const

Gets the OpenGL context associated with the renderArea.

This object is created automatically by RemoteViz.

In the ServiceSettings::INDEPENDENT_SERVICE mode, this method returns null.

Returns
the OpenGL context

◆ getGpu()

const std::string & RemoteViz::Rendering::RenderArea::getGpu ( ) const

Gets the Graphics Processing Unit (GPU) used to render images.

GPU can be defined in ServiceListener::onPendingCreateRenderArea.

See also
RenderAreaHardware::setGpu
Returns
gpu used to compute the render.

◆ getHeight()

unsigned int RemoteViz::Rendering::RenderArea::getHeight ( ) const

Gets the renderArea height.

Returns
the renderArea height

◆ getId()

const std::string & RemoteViz::Rendering::RenderArea::getId ( ) const

Gets the renderArea id.

Returns
the ID identifying the renderArea

◆ getNumConnections()

unsigned int RemoteViz::Rendering::RenderArea::getNumConnections ( ) const

Gets the number of connections (see Connection) that exist for this renderArea.

Returns
the number of connections

◆ getNumListeners()

unsigned int RemoteViz::Rendering::RenderArea::getNumListeners ( ) const

Gets the number of RenderAreaListener.

Returns
number of RenderAreaListener.

◆ getSceneManager()

SoSceneManager * RemoteViz::Rendering::RenderArea::getSceneManager ( ) const

Gets the Open Inventor scene manager associated with the renderArea.

This object is created automatically by RemoteViz.

In the ServiceSettings::INDEPENDENT_SERVICE mode, this method returns null.

Returns
the sceneManager

◆ getTouchManager()

SoTouchManager * RemoteViz::Rendering::RenderArea::getTouchManager ( ) const

Gets the Open Inventor touch manager associated with the renderArea.

This object is created automatically by RemoteViz.

In the ServiceSettings::INDEPENDENT_SERVICE mode, this method returns null.

Returns
the touchManager

◆ getWidth()

unsigned int RemoteViz::Rendering::RenderArea::getWidth ( ) const

Gets the renderArea width.

Returns
the renderArea width

◆ isDisposed()

bool RemoteViz::Rendering::RenderArea::isDisposed ( ) const

Gets the state of the RenderArea: alive or disposed.

RemoteViz does not keep a reference to the RenderArea object after the object is disposed. If the application kept a reference to the object, this method can be used to query its state.

Note: RemoteViz objects are not reference counted like Open Inventor nodes, but std::shared_ptr provides a similar mechanism.

The state "disposed" will be set just after triggering the listener ServiceListener::onDisposingRenderArea.

Returns
true if the renderArea is disposed or false if the renderArea is alive.

◆ removeAllListeners()

void RemoteViz::Rendering::RenderArea::removeAllListeners ( )

Removes all RenderAreaListeners.

◆ removeListener()

void RemoteViz::Rendering::RenderArea::removeListener ( std::shared_ptr< RenderAreaListener listener)

Removes a RenderAreaListener.

Parameters
listener: object that listens to the renderArea events

◆ resize()

void RemoteViz::Rendering::RenderArea::resize ( unsigned int  width,
unsigned int  height 
)

Resizes the renderArea at a specific size.

After resizing, a notification will be sent to all the renderArea clients. The minimum size is (128, 128) and the maximum size is (3840, 2160). If the size is inferior or superior to the limit, it will be adjusted automatically.

See also
RenderAreaListener::onResize
Parameters
width: new width of the renderArea
height: new height of the renderArea

◆ sendMessage() [1/2]

bool RemoteViz::Rendering::RenderArea::sendMessage ( const std::string &  message,
std::vector< std::shared_ptr< Connection > >  excludedConnections = {} 
) const

Sends a text message to the renderArea connections.

Parameters
message: the message to be sent to all connections of the renderArea
excludedConnections: an excluded connections array
Returns
true if the message has been successfully sent to all connections, otherwise returns false.

◆ sendMessage() [2/2]

bool RemoteViz::Rendering::RenderArea::sendMessage ( const std::vector< unsigned char > &  buffer,
std::vector< std::shared_ptr< Connection > >  excludedConnections = {} 
) const

Sends a binary message to the renderArea connections.

Parameters
buffer: the binary buffer to be sent to all connections of the renderArea
excludedConnections: an excluded connections array
Returns
true if the message has been successfully sent to all connections, otherwise returns false.

◆ setFrameMessage()

void RemoteViz::Rendering::RenderArea::setFrameMessage ( const std::string &  message)

Sets the message which will be associate with the next rendered frames.

This message can be recovered on a EncodedFrame.

See also
EncodedFrame::getMessage
Connection::getLastEncodedFrame

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