Nebula
|
#include <nvx3streamreader.h>
Inherits IO::StreamReader.
Public Member Functions | |
Nvx3StreamReader () | |
contructor | |
virtual | ~Nvx3StreamReader () |
destructor | |
void | SetRawMode (bool b) |
enable/disable raw mode (raw mode does not setup vertex/index buffers), default is false | |
bool | IsRawMode () const |
get raw mode flag | |
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 | Open () |
begin reading from the stream, read entire data | |
virtual void | Close () |
end reading from the stream, destroys loaded objects | |
const Ptr< Base::VertexBufferBase > & | GetVertexBuffer () const |
get vertex buffer (not valid in raw mode) | |
const Ptr< Base::IndexBufferBase > & | GetIndexBuffer () const |
get index buffer (not valid in raw mode) | |
const Util::Array< CoreGraphics::PrimitiveGroup > & | GetPrimitiveGroups () const |
get primitive groups | |
float * | GetVertexData () const |
get pointer to raw vertex data | |
ushort * | GetIndexData () const |
get pointer to raw index data | |
SizeT | GetNumVertices () const |
get number of vertices | |
SizeT | GetNumIndices () const |
get number of indices | |
SizeT | GetVertexWidth () const |
get vertex width | |
const Util::Array< CoreGraphics::VertexComponent > & | GetVertexComponents () const |
get vertex components | |
void | SetVertexBuffer (const Ptr< Base::VertexBufferBase > &vBuf) |
set the specialized vertex buffer | |
void | SetVertexBufferLoader (const Ptr< Base::MemoryVertexBufferLoaderBase > &vBufLoader) |
set the specialized vertex buffer reader | |
Public Member Functions inherited from IO::StreamReader | |
StreamReader () | |
constructor | |
virtual | ~StreamReader () |
destructor | |
void | SetStream (const Ptr< Stream > &s) |
set stream to read from | |
const Ptr< Stream > & | GetStream () const |
get currently set stream | |
bool | HasStream () const |
return true if a stream is set | |
bool | Eof () const |
return true if the stream has reached EOF | |
bool | IsOpen () const |
return true if currently open | |
Public Member Functions inherited from Core::RefCounted | |
RefCounted () | |
constructor | |
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::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Static Public Member Functions | |
static void | ConvertVertexBufferEndianess (void *vertexPtr, SizeT numVertices, const Util::Array< CoreGraphics::VertexComponent > &vertexComps) |
helper method to convert vertex buffer endianess | |
Static Public Member Functions inherited from Core::RefCounted | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Private Types | |
enum | N3VertexComponent { N3Coord = (1<<0) , N3Normal = (1<<1) , N3NormalUB4N = (1<<2) , N3Uv0 = (1<<3) , N3Uv0S2 = (1<<4) , N3Uv1 = (1<<5) , N3Uv1S2 = (1<<6) , N3Uv2 = (1<<7) , N3Uv2S2 = (1<<8) , N3Uv3 = (1<<9) , N3Uv3S2 = (1<<10) , N3Color = (1<<11) , N3ColorUB4N = (1<<12) , N3Tangent = (1<<13) , N3TangentUB4N = (1<<14) , N3Binormal = (1<<15) , N3BinormalUB4N = (1<<16) , N3Weights = (1<<17) , N3WeightsUB4N = (1<<18) , N3JIndices = (1<<19) , N3JIndicesUB4 = (1<<20) , N3NumVertexComponents = 21 , N3AllComponents = ((1<<N3NumVertexComponents) - 1) } |
Nebula vertex components, see Nebula's class for details. More... | |
Private Member Functions | |
__DeclareClass (Nvx3StreamReader) | |
void | ReadHeaderData () |
read header data from stream | |
void | ReadPrimitiveGroups () |
read primitive groups from stream | |
void | SetupVertexComponents () |
setup vertex components array | |
void | UpdateGroupBoundingBoxes () |
update primitive group bounding boxes | |
void | SetupVertexBuffer () |
setup the vertex buffer object (not called in raw mode) | |
void | SetupIndexBuffer () |
setup the index buffer object (not called in raw mode) | |
Private Attributes | |
Base::ResourceBase::Usage | usage |
Base::ResourceBase::Access | access |
bool | rawMode |
Ptr< Base::VertexBufferBase > | vertexBuffer |
Ptr< Base::IndexBufferBase > | indexBuffer |
Ptr< Base::MemoryVertexBufferLoaderBase > | vertexBufferLoader |
Ptr< Base::MemoryIndexBufferLoaderBase > | indexBufferLoader |
Util::Array< CoreGraphics::PrimitiveGroup > | primGroups |
void * | mapPtr |
void * | groupDataPtr |
void * | vertexDataPtr |
void * | indexDataPtr |
SizeT | groupDataSize |
SizeT | vertexDataSize |
SizeT | indexDataSize |
uint | numGroups |
uint | numVertices |
uint | vertexWidth |
uint | numIndices |
uint | vertexComponentMask |
Util::Array< CoreGraphics::VertexComponent > | vertexComponents |
Additional Inherited Members | |
Protected Member Functions inherited from Core::RefCounted | |
virtual | ~RefCounted () |
destructor (called when refcount reaches zero) | |
Protected Attributes inherited from IO::StreamReader | |
Ptr< Stream > | stream |
bool | isOpen |
bool | streamWasOpen |
|
private |
Nebula vertex components, see Nebula's class for details.
CoreGraphics::Nvx3StreamReader::Nvx3StreamReader | ( | ) |
contructor
|
virtual |
destructor
|
private |
|
virtual |
end reading from the stream, destroys loaded objects
Reimplemented from IO::StreamReader.
|
static |
helper method to convert vertex buffer endianess
|
inline |
get the resource access
|
inline |
get index buffer (not valid in raw mode)
|
inline |
get pointer to raw index data
|
inline |
get number of indices
|
inline |
get number of vertices
|
inline |
get primitive groups
|
inline |
get resource usage
|
inline |
get vertex buffer (not valid in raw mode)
|
inline |
get vertex components
|
inline |
get pointer to raw vertex data
|
inline |
get vertex width
|
inline |
get raw mode flag
|
virtual |
begin reading from the stream, read entire data
Reimplemented from IO::StreamReader.
|
private |
read header data from stream
This reads the nvx3 header data and checks whether the file is actually an nvx3 file through the magic number.
All header data will be read into member variables, and pointers to the start of the group-, vertex- and index-data will be setup.
NOTE: we assume that the file is in the correct byte order!
|
private |
read primitive groups from stream
|
inline |
set the intended resource access (default is AccessNone)
|
inline |
enable/disable raw mode (raw mode does not setup vertex/index buffers), default is false
|
private |
setup the index buffer object (not called in raw mode)
|
private |
setup the vertex buffer object (not called in raw mode)
|
private |
setup vertex components array
|
inline |
set the intended resource usage (default is UsageImmutable)
|
inline |
set the specialized vertex buffer
|
inline |
set the specialized vertex buffer reader
|
private |
update primitive group bounding boxes
Since nvx2 files don't contain any bounding box information we need to compute per-primitive-group bounding boxes manually by walking the triangle indices.
This may be inefficient with large meshes.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |