TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Types | Public Member Functions | Public Attributes | List of all members
sVertexArrayInitializer Struct Reference

Detailed Description

Large vertex array initializer.

Public Types

typedef astl::hash_map< tU32,
tU32
tIndexHMap
 Index hash map. More...
 
typedef astl::hash_map< tU64, sVBtVBHMap
 Vertex buffer hash map. More...
 
typedef astl::hash_map< tFVF,
tU32
tChunkHMap
 Chunk hash map. More...
 

Public Member Functions

 sVertexArrayInitializer (tU32 anMaxVert)
 Constructor, pass the maximum vertex per vertex array manually. More...
 
 sVertexArrayInitializer (iGraphics *apGraphics)
 Constructor, pass the maximum vertex per vertex array using the graphics caps. More...
 
 ~sVertexArrayInitializer ()
 Destructor. More...
 
tU64 GetHash (tFVF aFVF, tU32 anChunk) const
 Hash for FVF|Chunk set. More...
 
tVBHMap::iterator GetVB (tFVF anFVF, tU32 anChunk)
 Get the vertex buffer of the specified FVF|Chunk pair. More...
 
tU32 GetNextChunk (tFVF aFVF, tU32 anNumVerts)
 Get a new chunk. The number of vertices should be smaller than the number of vertices per VA allowed. More...
 
tU32 PushVertex (tFVF anFVF, tU32 anChunk, tU32 anIndex, tFVF aSrcFVF, tPtr apVert)
 Add a vertex to the specified FVF|Chunk|Index. More...
 
tU32 GetVertexIndex (tFVF anFVF, tU32 anChunk, tU32 anIndex) const
 Get the index of the specified vertex in the final VA. More...
 
const tU8GetVerts (tFVF anFVF, tU32 anChunk) const
 Get all vertices of the specified FVF|Chunk. More...
 
tU32 GetNumVerts (tFVF anFVF, tU32 anChunk) const
 Get the number of vertices of the specified FVF|Chunk. More...
 
iVertexArrayGetVA (iGraphics *apGraphics, tFVF anFVF, tU32 anChunk, eArrayUsage aUsage)
 Get the vertex array of the specified FVF|Chunk. More...
 
iVertexArrayGetVA (iGraphics *apGraphics, tVBHMap::iterator itVB, eArrayUsage aUsage)
 
tVBHMap::iterator GetVBBeginIt ()
 Get the first VB iterator. More...
 
tVBHMap::iterator GetVBEndIt ()
 Get the end VB iterator. More...
 
tU32 GetTotalNumVerts () const
 Get the total number of vertices. More...
 
tU64 GetTotalMemory () const
 Get the total memory in bytes. More...
 

Public Attributes

tU32 mnMaxVertsPerVA
 
tVBHMap mhmapVB
 
tChunkHMap mhmapChunks
 
tU32 mnTotalVerts
 
tU64 mnTotalMemory
 

Member Typedef Documentation

Index hash map.

Vertex buffer hash map.

Chunk hash map.

Constructor & Destructor Documentation

sVertexArrayInitializer ( tU32  anMaxVert)

Constructor, pass the maximum vertex per vertex array manually.

Constructor, pass the maximum vertex per vertex array using the graphics caps.

Destructor.

Member Function Documentation

tU64 GetHash ( tFVF  aFVF,
tU32  anChunk 
) const

Hash for FVF|Chunk set.

tVBHMap::iterator GetVB ( tFVF  anFVF,
tU32  anChunk 
)

Get the vertex buffer of the specified FVF|Chunk pair.

tU32 GetNextChunk ( tFVF  aFVF,
tU32  anNumVerts 
)

Get a new chunk. The number of vertices should be smaller than the number of vertices per VA allowed.

Remarks
anNumVerts is an estimate of the max number of vertices that will go into the chunk. PushVertex will do the actual vertex adding.
tU32 PushVertex ( tFVF  anFVF,
tU32  anChunk,
tU32  anIndex,
tFVF  aSrcFVF,
tPtr  apVert 
)

Add a vertex to the specified FVF|Chunk|Index.

Remarks
Will convert the FVF from srcFVF to the FVF of the chunk.
Returns
The index of the pushed vertex.
tU32 GetVertexIndex ( tFVF  anFVF,
tU32  anChunk,
tU32  anIndex 
) const

Get the index of the specified vertex in the final VA.

const tU8* GetVerts ( tFVF  anFVF,
tU32  anChunk 
) const

Get all vertices of the specified FVF|Chunk.

tU32 GetNumVerts ( tFVF  anFVF,
tU32  anChunk 
) const

Get the number of vertices of the specified FVF|Chunk.

iVertexArray* GetVA ( iGraphics apGraphics,
tFVF  anFVF,
tU32  anChunk,
eArrayUsage  aUsage 
)

Get the vertex array of the specified FVF|Chunk.

iVertexArray* GetVA ( iGraphics apGraphics,
tVBHMap::iterator  itVB,
eArrayUsage  aUsage 
)
tVBHMap::iterator GetVBBeginIt ( )

Get the first VB iterator.

tVBHMap::iterator GetVBEndIt ( )

Get the end VB iterator.

tU32 GetTotalNumVerts ( ) const

Get the total number of vertices.

Remarks
This is initialized by GetVA
tU64 GetTotalMemory ( ) const

Get the total memory in bytes.

Remarks
This is initialized by GetVA

Member Data Documentation

tU32 mnMaxVertsPerVA
tVBHMap mhmapVB
tChunkHMap mhmapChunks
tU32 mnTotalVerts
tU64 mnTotalMemory