The Nebula Device 3: Base::RenderDeviceBase Class Reference

The Nebula Device 3

Base::RenderDeviceBase Class Reference

#include <renderdevicebase.h>

Inheritance diagram for Base::RenderDeviceBase:

Core::RefCounted Direct3D9::D3D9RenderDevice CoreGraphics::RenderDevice

Detailed Description

The central rendering object of the Nebula3 core graphics system. This is basically an encapsulation of the Direct3D device. The render device will presents its backbuffer to the display managed by the CoreGraphics::DisplayDevice singleton.

(C) 2006 Radon Labs GmbH

Public Member Functions

 RenderDeviceBase ()
 constructor
virtual ~RenderDeviceBase ()
 destructor
void SetOverrideDefaultRenderTarget (const Ptr< CoreGraphics::RenderTarget > &rt)
 set an override for the default render target (call before Open()!)
bool Open ()
 open the device
void Close ()
 close the device
bool IsOpen () const
 return true if currently open
void AttachEventHandler (const Ptr< CoreGraphics::RenderEventHandler > &h)
 attach a render event handler
void RemoveEventHandler (const Ptr< CoreGraphics::RenderEventHandler > &h)
 remove a render event handler
const Ptr< CoreGraphics::RenderTarget > & GetDefaultRenderTarget () const
 get default render target
bool HasPassRenderTarget () const
 is a pass rendertarget set?
const Ptr< CoreGraphics::RenderTarget > & GetPassRenderTarget () const
 get current set pass render target
bool BeginFrame ()
 begin complete frame
void BeginPass (const Ptr< CoreGraphics::RenderTarget > &rt, const Ptr< CoreGraphics::ShaderInstance > &passShader)
 begin rendering a frame pass
void BeginPass (const Ptr< CoreGraphics::MultipleRenderTarget > &mrt, const Ptr< CoreGraphics::ShaderInstance > &passShader)
 begin rendering a frame pass with a multiple rendertarget
void BeginBatch (CoreGraphics::BatchType::Code batchType, const Ptr< CoreGraphics::ShaderInstance > &batchShader)
 begin rendering a batch inside
void SetStreamSource (IndexT streamIndex, const Ptr< CoreGraphics::VertexBuffer > &vb, IndexT offsetVertexIndex)
 set the current vertex stream source
const Ptr< CoreGraphics::VertexBuffer > & GetStreamVertexBuffer (IndexT streamIndex) const
 get currently set vertex buffer
IndexT GetStreamVertexOffset (IndexT streamIndex) const
 get currently set vertex stream offset
void SetVertexLayout (const Ptr< CoreGraphics::VertexLayout > &vl)
 set current vertex layout
const Ptr< CoreGraphics::VertexLayout > & GetVertexLayout () const
 get current vertex layout
void SetIndexBuffer (const Ptr< CoreGraphics::IndexBuffer > &ib)
 set current index buffer
const Ptr< CoreGraphics::IndexBuffer > & GetIndexBuffer () const
 get current index buffer
void SetPrimitiveGroup (const CoreGraphics::PrimitiveGroup &pg)
 set current primitive group
const CoreGraphics::PrimitiveGroupGetPrimitiveGroup () const
 get current primitive group
void Draw ()
 draw current primitives
void DrawIndexedInstanced (SizeT numInstances)
 draw indexed, instanced primitives
void EndBatch ()
 end current batch
void EndPass ()
 end current pass
void EndFrame ()
 end current frame
bool IsInBeginFrame () const
 check if inside BeginFrame
void Present ()
 present the rendered scene
CoreGraphics::ImageFileFormat::Code SaveScreenshot (CoreGraphics::ImageFileFormat::Code fmt, const Ptr< IO::Stream > &outStream)
 save a screenshot to the provided stream
bool GetVisualizeMipMaps () const
 get visualization of mipmaps flag
void SetVisualizeMipMaps (bool val)
 set visualization of mipmaps flag
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 bool CanCreate ()
 test if a compatible render device can be created on this machine
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Static Public Attributes

static const IndexT MaxNumVertexStreams = 2
 max number of vertex streams

Protected Member Functions

bool NotifyEventHandlers (const CoreGraphics::RenderEvent &e)
 notify event handlers about an event

Member Function Documentation

bool Base::RenderDeviceBase::CanCreate (  )  [static]

test if a compatible render device can be created on this machine

This static method can be used to check whether a RenderDevice object can be created on this machine before actually instantiating the device object (for instance by checking whether the right Direct3D version is installed). Use this method at application startup to check if the application should run at all.

Reimplemented in Direct3D9::D3D9RenderDevice.

void Base::RenderDeviceBase::SetOverrideDefaultRenderTarget ( const Ptr< CoreGraphics::RenderTarget > &  rt  ) 

set an override for the default render target (call before Open()!)

Override the default render target (which is normally created in Open()) with a render target provided by the application, this is normally only useful for debugging and testing purposes.

void Base::RenderDeviceBase::AttachEventHandler ( const Ptr< CoreGraphics::RenderEventHandler > &  h  ) 

attach a render event handler

Attach an event handler to the render device.

void Base::RenderDeviceBase::RemoveEventHandler ( const Ptr< CoreGraphics::RenderEventHandler > &  h  ) 

remove a render event handler

Remove an event handler from the display device.

bool Base::RenderDeviceBase::NotifyEventHandlers ( const CoreGraphics::RenderEvent e  )  [protected]

notify event handlers about an event

Notify all event handlers about an event.

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.