The Nebula Device 3: Graphics::GraphicsInterface Class Reference

The Nebula Device 3

Graphics::GraphicsInterface Class Reference

#include <graphicsinterface.h>

Inheritance diagram for Graphics::GraphicsInterface:

Interface::InterfaceBase Messaging::AsyncPort Core::RefCounted

Detailed Description

Implements the asynchronous interface to the InternalGraphics subsystem. Usually the application doesn't call methods on the GraphicsInterface directly, but instead uses one of the Graphics objects to communicate with the graphics thread.

(C) 2007 Radon Labs GmbH

Public Member Functions

 GraphicsInterface ()
 constructor
virtual ~GraphicsInterface ()
 destructor
virtual void Open ()
 open the interface object
virtual void Close ()
 close the interface object
void SendBatched (const Ptr< Messaging::Message > &msg)
 send a batched messages (call FlushBatchedMessages() to send them to render thread)
void FlushBatchedMessages ()
 flush batched messages, call before WaitForFrameEvent()
void WaitForPendingResources ()
 wait until all pending resources are loaded
void EnterLockStepMode ()
 enter lock-step mode
void LeaveLockStepMode ()
 leave lock-step mode
void GameThreadWaitForFrameSync ()
 call when game thread arrives at frame sync point
virtual void AttachHandler (const Ptr< Messaging::Handler > &h)
 attach a handler to the port (call before open!)
const Util::StringAtomGetCompanyName () const
 get the company name
const Util::StringAtomGetAppName () const
 get the application name
const Util::StringAtomGetRootDirectory () const
 get the root directory
void SetHandlerThread (const Ptr< HandlerThreadBase > &handlerThread)
 set pointer to handler thread object (must be derived from HandlerThreadBase)
const Ptr< HandlerThreadBase > & GetHandlerThread () const
 get pointer to handler thread object
virtual void RemoveHandler (const Ptr< Handler > &h)
 dynamically remove a handler from the port
bool IsOpen () const
 return true if port is open
template<class MESSAGETYPE>
void Send (const Ptr< MESSAGETYPE > &msg)
 send an asynchronous message to the port
template<class MESSAGETYPE>
void SendWait (const Ptr< MESSAGETYPE > &msg)
 send a message and wait for completion
template<class MESSAGETYPE>
void Wait (const Ptr< MESSAGETYPE > &msg)
 wait for a message to be handled
template<class MESSAGETYPE>
bool Peek (const Ptr< MESSAGETYPE > &msg)
 peek a message whether it has been handled
template<class MESSAGETYPE>
void Cancel (const Ptr< MESSAGETYPE > &msg)
 cancel a pending message
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Protected Member Functions

void SignalPendingResourceEvent ()
 signal the resource loaded event, called by GraphicsHandler

Member Function Documentation

void Graphics::GraphicsInterface::SendBatched ( const Ptr< Messaging::Message > &  msg  ) 

send a batched messages (call FlushBatchedMessages() to send them to render thread)

Send a batched message. The message will not be sent to the render thread immediately, but instead will be collected in a batch message for later sending. Use this method to reduce communication overhead between the main and render thread by sending only one batch message instead of many messages. This method may only be called from the main thread!

void Graphics::GraphicsInterface::FlushBatchedMessages (  ) 

flush batched messages, call before WaitForFrameEvent()

Send off the batched messages to the render thread. This reduces thread synchronization overhead dramatically if many messages must be sent per-frame. Only the main thread may call this method.

void Graphics::GraphicsInterface::WaitForPendingResources (  ) 

wait until all pending resources are loaded

This method will wait until the graphics handler signals that all pending resources have been loaded.

void Messaging::AsyncPort::RemoveHandler ( const Ptr< Handler > &  h  )  [virtual, inherited]

dynamically remove a handler from the port

Dynamically remove a message handler.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.