The Nebula Device 3: CoreGraphics::Mesh Class Reference

The Nebula Device 3

CoreGraphics::Mesh Class Reference

#include <mesh.h>

Inheritance diagram for CoreGraphics::Mesh:

Base::MeshBase Resources::Resource Core::RefCounted


Detailed Description

A mesh contains a vertex buffer, an optional index buffer and a number of PrimitiveGroup objects. Meshes can be loaded directly from a mesh resource file.

(C) 2007 Radon Labs GmbH

Public Types

enum  State
 resource states (DO NOT CHANGE ORDER!)

Public Member Functions

virtual void Unload ()
 unload mesh resource
bool HasVertexBuffer () const
 return true if the mesh has a vertex buffer
const Ptr
< CoreGraphics::VertexBuffer > & 
GetVertexBuffer () const
 get the vertex buffer object
bool HasIndexBuffer () const
 return true if the mesh has an index buffer
const Ptr
< CoreGraphics::IndexBuffer > & 
GetIndexBuffer () const
 get the index buffer object
SizeT GetNumPrimitiveGroups () const
 get the number of primitive groups in the mesh
const
CoreGraphics::PrimitiveGroup
GetPrimitiveGroupAtIndex (IndexT i) const
 get primitive group at index
virtual void ApplyPrimitives (IndexT primGroupIndex)
 apply any nesseccary mesh data in renderdevice
void SetPrimitiveGroups (const Util::Array< CoreGraphics::PrimitiveGroup > &groups)
 set primitive groups
void SetAsyncEnabled (bool b)
 request synchronous/asynchronous resource loading
bool IsAsyncEnabled () const
 return true if asynchronous resource loading is enabled
void SetResourceId (const ResourceId &id)
 set the resource identifier
const ResourceIdGetResourceId () const
 get the resource identifier
void SetLoader (const Ptr< ResourceLoader > &loader)
 set optional resource loader
const Ptr
< ResourceLoader > & 
GetLoader () const
 get optional resource loader
void SetSaver (const Ptr< ResourceSaver > &saver)
 set optional resource saver
const Ptr
< ResourceSaver > & 
GetSaver () const
 get optional resource saver
SizeT GetUseCount () const
 get current use count
virtual State Load ()
 load the resource
State GetState () const
 get current state
bool IsLoaded () const
 return true if current state is Loaded
bool IsPending () const
 return true if current state is Pending
bool LoadFailed () const
 return true if current state is Failed
virtual bool Save ()
 save the resource
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 SetVertexBuffer (const Ptr< CoreGraphics::VertexBuffer > &vb)
 set the vertex buffer object
void SetIndexBuffer (const Ptr< CoreGraphics::IndexBuffer > &ib)
 set the index buffer object
void SetState (State s)
 set current state
void IncrUseCount ()
 increment use count
void DecrUseCount ()
 decrement use count

Member Function Documentation

Resource::State Resources::Resource::Load (  )  [virtual, inherited]

load the resource

This loads the resource through the attached resource loader. Depending on the resource loader, the resource may happen synchronously or asynchronously. If the resource is loaded asynchronously, the IsPending() method will return true as long as the load is in progress, and IsLoaded() will become true when the loading process has finished. If the load has failed, IsPending() will switch to false and IsLoaded() will not be true.

bool Resources::Resource::Save (  )  [virtual, inherited]

save the resource

This will save the resource. A resource saver must be attached to the resource and the resource must be loaded for the method to succeed. Saving will always be performed synchronously.

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.