The Nebula Device 3: Win360::D3D9StreamMeshLoader Class Reference

The Nebula Device 3

Win360::D3D9StreamMeshLoader Class Reference

#include <d3d9streammeshloader.h>

Inheritance diagram for Win360::D3D9StreamMeshLoader:

Resources::StreamResourceLoader Resources::ResourceLoader Core::RefCounted CoreGraphics::StreamMeshLoader

Detailed Description

Setup a Mesh object from a stream. Supports the following file formats:

  • nvx2 (Nebula2 binary mesh file format)
  • nvx3 (Nebula3 binary mesh file format)
  • n3d3 (Nebula3 ascii mesh file format)

Todo:
: document file formats
(C) 2007 Radon Labs GmbH

Public Member Functions

 D3D9StreamMeshLoader ()
 constructor
void SetUsage (Base::ResourceBase::Usage usage)
 set the intended resource usage (default is UsageImmutable)
Base::ResourceBase::Usage GetUsage () const
 get resource usage
void SetAccess (Base::ResourceBase::Access access)
 set the intended resource access (default is AccessNone)
Base::ResourceBase::Access GetAccess () const
 get the resource access
virtual bool CanLoadAsync () const
 override in subclass: return true if asynchronous loading is supported (default is true)
virtual bool OnLoadRequested ()
 called by resource when a load is requested
virtual void OnLoadCancelled ()
 called by resource to cancel a pending load
virtual bool OnPending ()
 call frequently while after OnLoadRequested() to put Resource into loaded state
virtual void OnAttachToResource (const Ptr< Resource > &res)
 called when the resource loader is attached to its resource
virtual void OnRemoveFromResource ()
 called when the resource loader is removed from its resource
bool IsAttachedToResource () const
 return true if attached to resource
const Ptr< Resource > & GetResource () const
 get pointer to resource
Resource::State GetState () const
 return current state
virtual void Reset ()
 resets loader-stats e.g. state
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 SetState (Resource::State s)
 set current state

Member Function Documentation

bool Resources::StreamResourceLoader::CanLoadAsync (  )  const [virtual, inherited]

override in subclass: return true if asynchronous loading is supported (default is true)

Indicate whether this resource loader supports asynchronous loading. The default is true. Override this method in a subclass and return false otherwise.

Reimplemented from Resources::ResourceLoader.

Reimplemented in Direct3D9::D3D9StreamShaderLoader.

bool Resources::StreamResourceLoader::OnLoadRequested (  )  [virtual, inherited]

called by resource when a load is requested

Handle the generic load request. In the asynchronous case, this method will fire a ReadStream message and go into pending state. The client will then call OnPending() periodically which checks whether the ReadStream message has been handled and continue accordingly. In the synchronous state the method will create an IO::Stream object and call the SetupResourceFromStream() method directly.

Reimplemented from Resources::ResourceLoader.

Reimplemented in Resources::D3D9TextureStreamer.

void Resources::StreamResourceLoader::OnLoadCancelled (  )  [virtual, inherited]

called by resource to cancel a pending load

This method is called when the currently pending asynchronous load request should be cancelled.

Reimplemented from Resources::ResourceLoader.

bool Resources::StreamResourceLoader::OnPending (  )  [virtual, inherited]

call frequently while after OnLoadRequested() to put Resource into loaded state

This method is called periodically by the client when the resource is in pending state. The pending ReadStream message will be checked, and if it has been handled successfully the SetupResourceFromStream() method will be called and the Resource will go into Loaded state. If anything goes wrong, the resource will go into Failed state.

Reimplemented from Resources::ResourceLoader.

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.