#include <spMeshBuffer.hpp>
Classes | |
struct | SBuffer |
struct | SMeshBufferBackup |
Public Member Functions | |
MeshBuffer (const video::VertexFormat *VertexFormat=0, ERendererDataTypes IndexFormat=DATATYPE_UNSIGNED_INT) | |
MeshBuffer (const MeshBuffer &Other, bool isCreateMeshBuffer=true) | |
virtual | ~MeshBuffer () |
virtual io::stringc | getIdentifier () const |
Returns mesh buffer identifier (e.g. 'mesh buffer "test"' or 'anonymous mesh buffer'). | |
MeshBuffer * | getReference () |
Returns pointer to the surface reference object if set otherwise zero. | |
const MeshBuffer * | getReference () const |
Returns constant pointer to the surface reference object if set otherwise zero. | |
bool | sortCompare (const MeshBuffer &Other) const |
bool | compare (const MeshBuffer &Other) const |
void | setVertexFormat (const VertexFormat *Format) |
void | setIndexFormat (ERendererDataTypes Format) |
void | saveBackup () |
Save backup from the current mesh buffer. This can be useful before modifying the vertex- or index format. | |
void | loadBackup () |
Load backup to the current mesh buffer. | |
void | clearBackup () |
Clear the mesh buffer backup. | |
void | createVertexBuffer () |
Creates the hardware vertex buffer. | |
void | createIndexBuffer () |
Creates the hardware index buffer. | |
void | createMeshBuffer () |
Creates the hardware vertex- and index buffer. | |
void | deleteVertexBuffer () |
Deletes the hardware vertex buffer. | |
void | deleteIndexBuffer () |
Deletes the hardware index buffer. | |
void | deleteMeshBuffer () |
Deletes the hardware vertex- and index buffer. | |
void | updateVertexBuffer () |
Updates the hardware vertex buffer or rather uploads the vertex buffer into VRAM. | |
void | updateIndexBuffer () |
Updates the hardware index buffer or rather uploads the index buffer into VRAM. | |
void | updateMeshBuffer () |
Updates the hardware vertex- and index buffer. | |
void | updateVertexBufferElement (u32 Index) |
Updates the hardware vertex buffer only for the specified element. | |
void | updateIndexBufferElement (u32 Index) |
Updates the hardware index buffer only for the specified element. | |
void | setPrimitiveType (const ERenderPrimitives Type) |
s32 | getPrimitiveSize () const |
Returns the primitive size (see the static version of getPrimitiveSize). | |
bool | renderable () const |
u32 | addVertex () |
void | addVertices (const u32 Count) |
Adds the specified amount of new vertices to the vertex buffer. | |
u32 | addVertex (const dim::vector3df &Position, const dim::vector3df &TexCoord=0, const video::color &Color=255) |
u32 | addVertex (const dim::vector3df &Position, const dim::vector3df &Normal, const dim::vector3df &TexCoord, const video::color &Color=255, const f32 Fog=0.0f) |
u32 | addVertex (const dim::vector3df &Position, const dim::vector3df &Normal, const std::vector< dim::vector3df > &TexCoordList, const video::color &Color=255, const f32 Fog=0.0f) |
u32 | addVertex (const scene::SMeshVertex3D &VertexData) |
Adds a vertex with the specified data. | |
u32 | addVertex (u32 IndexA, u32 IndexB, u32 IndexC, const dim::vector3df &BarycentricCoord) |
bool | removeVertex (const u32 Index) |
u32 | addTriangle () |
void | addTriangles (const u32 Count) |
Adds the specified amount of new triangles to the index buffer. | |
u32 | addTriangle (u32 VertexA, u32 VertexB, u32 VertexC) |
u32 | addTriangle (const u32 Indices[3]) |
Adds a new triangle to the index buffer with the specified indices. | |
u32 | addQuadrangle (u32 VertexA, u32 VertexB, u32 VertexC, u32 VertexD) |
u32 | addQuadrangle (const u32 Indices[4]) |
Adds a new quadrangle to the index buffer with the specified indices. | |
u32 | addPrimitiveIndex (u32 Index) |
void | addIndices (const u32 Count) |
Adds the specified amount of new indicies to the index buffer. | |
bool | removePrimitive (const u32 Index) |
void | clearVertices () |
Deletes all vertices and all indices because the indices will became invalid. | |
void | clearIndices () |
Deletes all indices. | |
bool | insertMeshBuffer (const MeshBuffer &Other) |
void | setTriangleIndices (const u32 Index, const u32(&Indices)[3]) |
void | getTriangleIndices (const u32 Index, u32(&Indices)[3]) const |
void | setPrimitiveIndex (const u32 Index, const u32 VertexIndex) |
u32 | getPrimitiveIndex (const u32 Index) const |
scene::SMeshVertex3D | getVertex (const u32 Index) const |
Returns an SMeshVertex3D structure with all available vertex information. | |
scene::SMeshTriangle3D | getTriangle (const u32 Index) const |
Returns an SMeshTriangle3D structure with the three triangle indices. | |
dim::triangle3df | getTriangleCoords (const u32 Index) const |
Returns the coordinates of the specified triangle. Also works when the index buffer is not used. | |
dim::ptriangle3df | getTriangleReference (const u32 Index) const |
DEPRECATED! | |
void | flipTriangles () |
Flips the first index with the last index of each triangle. | |
bool | cutTriangle (const u32 Index, const dim::plane3df &ClipPlane) |
Cuts the specified triangle with the specified clipping plane. | |
u32 | getIndexCount () const |
u32 | getTriangleCount () const |
void | setVertexAttribute (const u32 Index, const SVertexAttribute &Attrib, const void *AttribData, u32 Size) |
void | getVertexAttribute (const u32 Index, const SVertexAttribute &Attrib, void *AttribData, u32 Size) |
void | setVertexCoord (const u32 Index, const dim::vector3df &Coord) |
dim::vector3df | getVertexCoord (const u32 Index) const |
Returns the specified vertex coordinate. | |
void | setVertexNormal (const u32 Index, const dim::vector3df &Normal) |
dim::vector3df | getVertexNormal (const u32 Index) const |
Returns the specified vertex normal. | |
void | setVertexTangent (const u32 Index, const dim::vector3df &Tangent) |
dim::vector3df | getVertexTangent (const u32 Index) const |
Returns the specified vertex tangent. | |
void | setVertexBinormal (const u32 Index, const dim::vector3df &Binormal) |
dim::vector3df | getVertexBinormal (const u32 Index) const |
Returns the specified vertex binormal. | |
void | setVertexColor (const u32 Index, const color &Color) |
color | getVertexColor (const u32 Index) const |
Returns the specified vertex color. | |
void | setVertexTexCoord (const u32 Index, const dim::vector3df &TexCoord, const u8 Layer=TEXTURE_IGNORE) |
dim::vector3df | getVertexTexCoord (const u32 Index, const u8 Layer=0) const |
Returns the specified texture coordinate for the specified layer. | |
void | setVertexFog (const u32 Index, const f32 FogCoord) |
f32 | getVertexFog (const u32 Index) const |
Returns the specified fog coordinate. | |
virtual void | updateNormals (const EShadingTypes Shading=SHADING_GOURAUD) |
Updates each normal vector for flat- or gouraud shading. | |
void | updateTangentSpace (const u8 TangentLayer=TEXTURE_IGNORE, const u8 BinormalLayer=TEXTURE_IGNORE, bool UpdateNormals=true) |
void | meshTranslate (const dim::vector3df &Direction) |
Translates each vertex coordinate in the specified direction. | |
void | meshTransform (const dim::vector3df &Size) |
Transforms each vertex coordinate by multiplying it with the specified size. | |
void | meshTransform (const dim::matrix4f &Matrix) |
Transforms each vertex coordinate by multiplying it with the specified transformation matrix. | |
void | meshTurn (const dim::vector3df &Rotation) |
Turns each vertex coordinate by rotating them with the specified rotation vector. This function performs a YXZ matrix rotation. | |
void | meshFlip () |
Flips the mesh. i.e. each vertex coordinate will be inverted. | |
void | meshFlip (bool isXAxis, bool isYAxis, bool isZAxis) |
Flips each vertex coordiante only for the specified axles. | |
void | seperateTriangles () |
void | paint (const video::color &Color, bool CombineColors=false) |
TextureLayer * | addTexture (Texture *Tex=0, const u8 Layer=TEXLAYER_LAST, const ETextureLayerTypes LayerType=TEXLAYER_DEFAULT) |
template<class T > | |
T * | addTexture (Texture *Tex=0, const u8 Layer=TEXLAYER_LAST) |
bool | removeTexture (const u8 Layer=TEXLAYER_LAST, bool RemoveLayer=true) |
u32 | removeTexture (Texture *Tex, bool RemoveLayers=true) |
void | clearTextureLayers () |
Clears the texture layer list. | |
TextureLayer * | getTextureLayer (const u8 Layer, bool SearchLayerIndex=false) const |
void | textureTranslate (const u8 Layer, const dim::vector3df &Direction) |
void | textureTransform (const u8 Layer, const dim::vector3df &Size) |
void | textureTurn (const u8 Layer, const f32 Rotation) |
void | setTexture (const u8 Layer, Texture *Tex) |
Texture * | getTexture (const u8 Layer=0) const |
Returns pointer to the Texture object of the specified layer. | |
void | setTextureMatrix (const u8 Layer, const dim::matrix4f &Matrix) |
dim::matrix4f | getTextureMatrix (const u8 Layer) const |
Returns texture matrix of the specified layer. | |
void | setTextureEnv (const u8 Layer, const ETextureEnvTypes Type) |
ETextureEnvTypes | getTextureEnv (const u8 Layer) const |
Returns the texture environment type for the specified layer. | |
void | setMappingGen (const u8 Layer, const EMappingGenTypes Type) |
EMappingGenTypes | getMappingGen (const u8 Layer) const |
Returns texture mapping generation type of the specified layer. | |
void | setMappingGenCoords (const u8 Layer, s32 Coords) |
s32 | getMappingGenCoords (const u8 Layer) const |
Returns texture mapping generation axles of the specified layer. | |
std::vector< Texture * > | getTextureList () const |
Returns a list with Pointers of all Texture objects. | |
void | setTexturesReference (MeshBuffer *Reference) |
void | setTexturesReference (TextureLayerListType *Reference) |
void | setReference (MeshBuffer *ReferenceSurface) |
Sets a reference. Use this for mesh buffer instancing. By default 0 to disable instancing. | |
void | setHardwareInstancing (s32 InstanceCount) |
s32 | getHardwareInstancing () const |
Returns the count of instancies for hardware instancing. | |
void | setName (const io::stringc &Name) |
Sets the buffers description name. | |
const io::stringc & | getName () const |
Returns the buffers description name. | |
void * | getVertexBufferID () const |
Returns the hardware vertex buffer id. | |
void * | getIndexBufferID () const |
Returns the hardware index buffer id. | |
const dim::UniversalBuffer & | getVertexBuffer () const |
Returns the vertex buffer. | |
const dim::UniversalBuffer & | getIndexBuffer () const |
Returns the index buffer. | |
const VertexFormat * | getVertexFormat () const |
Returns the vertex format. | |
const IndexFormat * | getIndexFormat () const |
Returns the index format. | |
u32 | getVertexCount () const |
Returns count of vertices. | |
void | setMeshBufferUsage (const EHWBufferUsage Usage) |
Sets the mesh buffer usage. For more detail see "setVertexBufferUsage". | |
void | setVertexBufferUsage (const EHWBufferUsage Usage) |
EHWBufferUsage | getVertexBufferUsage () const |
Returns the vertex buffer usage. By default HWBUFFER_STATIC. | |
void | setIndexBufferUsage (const EHWBufferUsage Usage) |
Sets the index buffer usage. For more information see "setVertexBufferUsage". | |
EHWBufferUsage | getIndexBufferUsage () const |
Returns the vertex buffer usage. | |
void | setTextureLayerList (const TextureLayerListType &TextureLayers) |
Sets the texture layer list. | |
const TextureLayerListType & | getTextureLayerList () const |
Returns the texture layer list. | |
u32 | getTextureCount () const |
Returns count of textures. | |
bool | hasTexturesReference () const |
Returns true if the texture list is a reference to another one. | |
void | setIndexOffset (u32 Offset) |
Sets the index offset which will be added to each vertex index when adding a new triangle. | |
void | addIndexOffset (u32 Offset) |
Increments the index offset which will be added to each vertex index when adding a new triangle. | |
void | setIndexBufferEnable (bool Enable) |
bool | getIndexBufferEnable () const |
Returns true if the index buffer is to be used. Otherwise false. | |
void | setUpdateImmediate (bool Enable) |
bool | getUpdateImmediate () const |
Returns status of immediate mesh buffer updating. By defautl false. | |
ERenderPrimitives | getPrimitiveType () const |
Returns the primitive type. By default PRIMITIVE_TRIANGLES. | |
Static Public Member Functions | |
static s32 | getPrimitiveSize (const ERenderPrimitives Type) |
Protected Member Functions | |
void | convertVertexAttribute (const dim::UniversalBuffer &OldBuffer, u32 Index, const SVertexAttribute &OldAttrib, const SVertexAttribute &NewAttrib, bool isClamp=true) |
void | fillVertexAttribute (u32 Index, const SVertexAttribute &Attrib) |
void | setVertexAttributeBarycentric (u32 IndexResult, u32 IndexA, u32 IndexB, u32 IndexC, const SVertexAttribute &Attrib, const dim::vector3df &BarycentricCoord) |
virtual void | updateNormalsFlat () |
TODO! -> move this to a utility or scene:: namespace/ class, whatever!!! | |
virtual void | updateNormalsGouraud () |
TODO! -> move this to a utility or scene:: namespace/ class, whatever!!! | |
void | checkIndexFormat (ERendererDataTypes &Format) |
template<typename T , typename D > | |
void | setDefaultVertexAttribute (const ERendererDataTypes Type, s32 MaxSize, u32 Index, const SVertexAttribute &Attrib, const T &Data) |
template<typename T , typename D > | |
T | getDefaultVertexAttribute (const ERendererDataTypes Type, s32 MaxSize, u32 Index, const SVertexAttribute &Attrib) const |
template<typename T > | |
void | addTriangleIndices (const u32 VertexA, const u32 VertexB, const u32 VertexC) |
template<typename T > | |
void | addQuadrangleIndices (const u32 VertexA, const u32 VertexB, const u32 VertexC, const u32 VertexD) |
Protected Attributes | |
io::stringc | Name_ |
SBuffer | VertexBuffer_ |
SBuffer | IndexBuffer_ |
const VertexFormat * | VertexFormat_ |
IndexFormat | IndexFormat_ |
MeshBuffer * | Reference_ |
TextureLayerListType | OrigTextureLayers_ |
TextureLayerListType * | TextureLayers_ |
u32 | IndexOffset_ |
s32 | InstanceCount_ |
ERenderPrimitives | PrimitiveType_ |
bool | UseIndexBuffer_ |
bool | UpdateImmediate_ |
SMeshBufferBackup * | Backup_ |
This is the hardware mesh buffer class (also called a "Surface"). Containing a vertex- and index buffer. Since version 2.2 each vertex mesh manipulation such as texturing, vertex- or triangle access is handled by this class.
sp::video::MeshBuffer::MeshBuffer | ( | const video::VertexFormat * | VertexFormat = 0 , |
|
ERendererDataTypes | IndexFormat = DATATYPE_UNSIGNED_INT | |||
) |
sp::video::MeshBuffer::MeshBuffer | ( | const MeshBuffer & | Other, | |
bool | isCreateMeshBuffer = true | |||
) |
sp::video::MeshBuffer::~MeshBuffer | ( | ) | [virtual] |
void sp::video::MeshBuffer::addIndexOffset | ( | u32 | Offset | ) | [inline] |
Increments the index offset which will be added to each vertex index when adding a new triangle.
void sp::video::MeshBuffer::addIndices | ( | const u32 | Count | ) |
Adds the specified amount of new indicies to the index buffer.
Adds a single index to the index buffer.
Adds a new quadrangle to the index buffer. A quadrangle is nothing more than a connection between four vertices.
VertexA,: | First vertex index. Affected by the VertexCounter. | |
VertexB,: | Second vertex index. Affected by the VertexCounter. | |
VertexC,: | Third vertex index. Affected by the VertexCounter. | |
VertexD,: | Fourth vertex index. Affected by the VertexCounter. |
Adds a new quadrangle to the index buffer with the specified indices.
void sp::video::MeshBuffer::addQuadrangleIndices | ( | const u32 | VertexA, | |
const u32 | VertexB, | |||
const u32 | VertexC, | |||
const u32 | VertexD | |||
) | [inline, protected] |
TextureLayer * sp::video::MeshBuffer::addTexture | ( | Texture * | Tex = 0 , |
|
const u8 | Layer = TEXLAYER_LAST , |
|||
const ETextureLayerTypes | LayerType = TEXLAYER_DEFAULT | |||
) |
Adds a new texture layer with the given texture to the list.
[in] | Tex | Pointer to the texture object which is to be added. By default null. |
[in] | Layer | Specifies the texture layer index. |
[in] | LayerType | Specifies the layer class type. This can only be a pre-defined texture-layer class, i.e. TEXLAYER_CUSTOM is not allowed! |
T* sp::video::MeshBuffer::addTexture | ( | Texture * | Tex = 0 , |
|
const u8 | Layer = TEXLAYER_LAST | |||
) | [inline] |
Adds a new texture layer with the given texture to the list.
T | Specifies the texture-layer class. |
[in] | Tex | Pointer to the texture object which is to be added. By default null. |
[in] | Layer | Specifies the texture layer index. |
u32 sp::video::MeshBuffer::addTriangle | ( | ) |
Adds a new triangle to the index buffer. A triangle can be seen as a delta connection between three vertices. The indices of this triangle are all 0.
Adds a new triangle to the index buffer. A triangle is nothing more than a delta connection between three vertices.
VertexA,: | First vertex index. Affected by the VertexCounter. | |
VertexB,: | Second vertex index. Affected by the VertexCounter. | |
VertexC,: | Third vertex index. Affected by the VertexCounter. |
Adds a new triangle to the index buffer with the specified indices.
void sp::video::MeshBuffer::addTriangleIndices | ( | const u32 | VertexA, | |
const u32 | VertexB, | |||
const u32 | VertexC | |||
) | [inline, protected] |
void sp::video::MeshBuffer::addTriangles | ( | const u32 | Count | ) |
Adds the specified amount of new triangles to the index buffer.
u32 sp::video::MeshBuffer::addVertex | ( | u32 | IndexA, | |
u32 | IndexB, | |||
u32 | IndexC, | |||
const dim::vector3df & | BarycentricCoord | |||
) |
Adds a new vertex by interpolating between the three vertices described by the given indices and the given barycentric coordinate.
[in] | IndexA | Specifies the index of the first vertex. |
[in] | IndexB | Specifies the index of the second vertex. |
[in] | IndexC | Specifies the index of the third vertex. |
[in] | BarycentricCoord | Specifies the barycentric coordinate which is used to interpolate between the three vertices. The sum of a barycentric coordainte must always be 1.0. |
u32 sp::video::MeshBuffer::addVertex | ( | ) |
Adds a new vertex to the vertex buffer. A vertex can be seen as a point in 3D space which also have some further information such as color, normal, texture coordinates etc.
u32 sp::video::MeshBuffer::addVertex | ( | const dim::vector3df & | Position, | |
const dim::vector3df & | TexCoord = 0 , |
|||
const video::color & | Color = 255 | |||
) |
Position,: | 3D coordiante. A left-handed coordinate system is used like in the whole engine. | |
TexCoord,: | Texture coordinate which is used for each texture layer. | |
Color,: | Specifies the vertex color. |
u32 sp::video::MeshBuffer::addVertex | ( | const dim::vector3df & | Position, | |
const dim::vector3df & | Normal, | |||
const dim::vector3df & | TexCoord, | |||
const video::color & | Color = 255 , |
|||
const f32 | Fog = 0.0f | |||
) |
Normal,: | Normal for the vertex. This normal vector will not be normalized. | |
Fog,: | Fog coordinate. This is only supported with OpenGL. |
u32 sp::video::MeshBuffer::addVertex | ( | const dim::vector3df & | Position, | |
const dim::vector3df & | Normal, | |||
const std::vector< dim::vector3df > & | TexCoordList, | |||
const video::color & | Color = 255 , |
|||
const f32 | Fog = 0.0f | |||
) |
TexCoordList,: | List of all texture coordinates. |
u32 sp::video::MeshBuffer::addVertex | ( | const scene::SMeshVertex3D & | VertexData | ) |
Adds a vertex with the specified data.
void sp::video::MeshBuffer::addVertices | ( | const u32 | Count | ) |
Adds the specified amount of new vertices to the vertex buffer.
void sp::video::MeshBuffer::checkIndexFormat | ( | ERendererDataTypes & | Format | ) | [protected] |
void sp::video::MeshBuffer::clearBackup | ( | ) |
Clear the mesh buffer backup.
void sp::video::MeshBuffer::clearIndices | ( | ) |
Deletes all indices.
void sp::video::MeshBuffer::clearTextureLayers | ( | ) |
Clears the texture layer list.
void sp::video::MeshBuffer::clearVertices | ( | ) |
Deletes all vertices and all indices because the indices will became invalid.
bool sp::video::MeshBuffer::compare | ( | const MeshBuffer & | Other | ) | const |
Compares this mesh buffer with the given mesh buffer.
void sp::video::MeshBuffer::convertVertexAttribute | ( | const dim::UniversalBuffer & | OldBuffer, | |
u32 | Index, | |||
const SVertexAttribute & | OldAttrib, | |||
const SVertexAttribute & | NewAttrib, | |||
bool | isClamp = true | |||
) | [protected] |
void sp::video::MeshBuffer::createIndexBuffer | ( | ) |
Creates the hardware index buffer.
void sp::video::MeshBuffer::createMeshBuffer | ( | ) |
Creates the hardware vertex- and index buffer.
void sp::video::MeshBuffer::createVertexBuffer | ( | ) |
Creates the hardware vertex buffer.
bool sp::video::MeshBuffer::cutTriangle | ( | const u32 | Index, | |
const dim::plane3df & | ClipPlane | |||
) |
Cuts the specified triangle with the specified clipping plane.
void sp::video::MeshBuffer::deleteIndexBuffer | ( | ) |
Deletes the hardware index buffer.
void sp::video::MeshBuffer::deleteMeshBuffer | ( | ) |
Deletes the hardware vertex- and index buffer.
void sp::video::MeshBuffer::deleteVertexBuffer | ( | ) |
Deletes the hardware vertex buffer.
void sp::video::MeshBuffer::fillVertexAttribute | ( | u32 | Index, | |
const SVertexAttribute & | Attrib | |||
) | [protected] |
void sp::video::MeshBuffer::flipTriangles | ( | ) |
Flips the first index with the last index of each triangle.
T sp::video::MeshBuffer::getDefaultVertexAttribute | ( | const ERendererDataTypes | Type, | |
s32 | MaxSize, | |||
u32 | Index, | |||
const SVertexAttribute & | Attrib | |||
) | const [inline, protected] |
s32 sp::video::MeshBuffer::getHardwareInstancing | ( | ) | const [inline] |
Returns the count of instancies for hardware instancing.
io::stringc sp::video::MeshBuffer::getIdentifier | ( | ) | const [virtual] |
Returns mesh buffer identifier (e.g. 'mesh buffer "test"' or 'anonymous mesh buffer').
const dim::UniversalBuffer& sp::video::MeshBuffer::getIndexBuffer | ( | ) | const [inline] |
Returns the index buffer.
bool sp::video::MeshBuffer::getIndexBufferEnable | ( | ) | const [inline] |
Returns true if the index buffer is to be used. Otherwise false.
void* sp::video::MeshBuffer::getIndexBufferID | ( | ) | const [inline] |
Returns the hardware index buffer id.
EHWBufferUsage sp::video::MeshBuffer::getIndexBufferUsage | ( | ) | const [inline] |
Returns the vertex buffer usage.
u32 sp::video::MeshBuffer::getIndexCount | ( | ) | const |
Returns the count of indices.
const IndexFormat* sp::video::MeshBuffer::getIndexFormat | ( | ) | const [inline] |
Returns the index format.
EMappingGenTypes sp::video::MeshBuffer::getMappingGen | ( | const u8 | Layer | ) | const |
Returns texture mapping generation type of the specified layer.
Returns texture mapping generation axles of the specified layer.
const io::stringc& sp::video::MeshBuffer::getName | ( | ) | const [inline] |
Returns the buffers description name.
Returns the vertex index of the specified primitive index.
Index,: | Specifies the primitive index (e.g. when adding a triangle three indices will be added). |
s32 sp::video::MeshBuffer::getPrimitiveSize | ( | const ERenderPrimitives | Type | ) | [static] |
Returns the primitive size. If the primitive type is PRIMITIVE_TRIANGLES the size is 3. If the primitive type is PRIMITIVE_QUADS the size is 4 etc.
Type,: | Specifies the primitive type. |
s32 sp::video::MeshBuffer::getPrimitiveSize | ( | ) | const |
Returns the primitive size (see the static version of getPrimitiveSize).
ERenderPrimitives sp::video::MeshBuffer::getPrimitiveType | ( | ) | const [inline] |
Returns the primitive type. By default PRIMITIVE_TRIANGLES.
MeshBuffer * sp::video::MeshBuffer::getReference | ( | ) |
Returns pointer to the surface reference object if set otherwise zero.
const MeshBuffer * sp::video::MeshBuffer::getReference | ( | ) | const |
Returns constant pointer to the surface reference object if set otherwise zero.
Returns pointer to the Texture object of the specified layer.
u32 sp::video::MeshBuffer::getTextureCount | ( | ) | const [inline] |
Returns count of textures.
ETextureEnvTypes sp::video::MeshBuffer::getTextureEnv | ( | const u8 | Layer | ) | const |
Returns the texture environment type for the specified layer.
TextureLayer * sp::video::MeshBuffer::getTextureLayer | ( | const u8 | Layer, | |
bool | SearchLayerIndex = false | |||
) | const |
Returns the texture layer object with the specified layer index.
[in] | Layer | Specifies the index for the texture layer which is to be returned. |
[in] | SearchLayerIndex | Specifies whether the layer index is to be interpreted as texture-layer index or array index from the texture-layer list. By default the index is interpreted as array-index. Otherwise the texture-layer with the same layer index must be searched - which is much slower! |
const TextureLayerListType& sp::video::MeshBuffer::getTextureLayerList | ( | ) | const [inline] |
Returns the texture layer list.
std::vector< Texture * > sp::video::MeshBuffer::getTextureList | ( | ) | const |
Returns a list with Pointers of all Texture objects.
dim::matrix4f sp::video::MeshBuffer::getTextureMatrix | ( | const u8 | Layer | ) | const |
Returns texture matrix of the specified layer.
scene::SMeshTriangle3D sp::video::MeshBuffer::getTriangle | ( | const u32 | Index | ) | const |
Returns an SMeshTriangle3D structure with the three triangle indices.
dim::triangle3df sp::video::MeshBuffer::getTriangleCoords | ( | const u32 | Index | ) | const |
Returns the coordinates of the specified triangle. Also works when the index buffer is not used.
u32 sp::video::MeshBuffer::getTriangleCount | ( | ) | const |
Returns the count of triangles (or rather count of indices divided by 3).
Returns the indices of the specified triangle.
Index,: | Specifies the triangle index (position for the index buffer multiplied by 3). | |
Indices,: | Array where the 3 indices are to be stored. |
dim::ptriangle3df sp::video::MeshBuffer::getTriangleReference | ( | const u32 | Index | ) | const |
bool sp::video::MeshBuffer::getUpdateImmediate | ( | ) | const [inline] |
Returns status of immediate mesh buffer updating. By defautl false.
scene::SMeshVertex3D sp::video::MeshBuffer::getVertex | ( | const u32 | Index | ) | const |
Returns an SMeshVertex3D structure with all available vertex information.
void sp::video::MeshBuffer::getVertexAttribute | ( | const u32 | Index, | |
const SVertexAttribute & | Attrib, | |||
void * | AttribData, | |||
u32 | Size | |||
) |
Gets the specifies vertex attribute data.
Index,: | Specifies the vertex index. | |
Attrib,: | Specifies the vertex attribute. For more information see "setVertexAttribute". | |
AttribData,: | Pointer to the buffer where the vertex attribute data is to be stored. | |
Size,: | Data size in bytes of the "AttribData" buffer. |
dim::vector3df sp::video::MeshBuffer::getVertexBinormal | ( | const u32 | Index | ) | const |
Returns the specified vertex binormal.
const dim::UniversalBuffer& sp::video::MeshBuffer::getVertexBuffer | ( | ) | const [inline] |
Returns the vertex buffer.
void* sp::video::MeshBuffer::getVertexBufferID | ( | ) | const [inline] |
Returns the hardware vertex buffer id.
EHWBufferUsage sp::video::MeshBuffer::getVertexBufferUsage | ( | ) | const [inline] |
Returns the vertex buffer usage. By default HWBUFFER_STATIC.
Returns the specified vertex color.
dim::vector3df sp::video::MeshBuffer::getVertexCoord | ( | const u32 | Index | ) | const |
Returns the specified vertex coordinate.
u32 sp::video::MeshBuffer::getVertexCount | ( | ) | const [inline] |
Returns count of vertices.
Returns the specified fog coordinate.
const VertexFormat* sp::video::MeshBuffer::getVertexFormat | ( | ) | const [inline] |
Returns the vertex format.
dim::vector3df sp::video::MeshBuffer::getVertexNormal | ( | const u32 | Index | ) | const |
Returns the specified vertex normal.
dim::vector3df sp::video::MeshBuffer::getVertexTangent | ( | const u32 | Index | ) | const |
Returns the specified vertex tangent.
dim::vector3df sp::video::MeshBuffer::getVertexTexCoord | ( | const u32 | Index, | |
const u8 | Layer = 0 | |||
) | const |
Returns the specified texture coordinate for the specified layer.
bool sp::video::MeshBuffer::hasTexturesReference | ( | ) | const [inline] |
Returns true if the texture list is a reference to another one.
bool sp::video::MeshBuffer::insertMeshBuffer | ( | const MeshBuffer & | Other | ) |
Inserts (or rather adds) the given mesh buffer to this mesh buffer, i.e. all vertices and indices will be copied. You still have to update the mesh buffer after inserting it.
void sp::video::MeshBuffer::loadBackup | ( | ) |
Load backup to the current mesh buffer.
void sp::video::MeshBuffer::meshFlip | ( | ) |
Flips the mesh. i.e. each vertex coordinate will be inverted.
void sp::video::MeshBuffer::meshFlip | ( | bool | isXAxis, | |
bool | isYAxis, | |||
bool | isZAxis | |||
) |
Flips each vertex coordiante only for the specified axles.
void sp::video::MeshBuffer::meshTransform | ( | const dim::vector3df & | Size | ) |
Transforms each vertex coordinate by multiplying it with the specified size.
void sp::video::MeshBuffer::meshTransform | ( | const dim::matrix4f & | Matrix | ) |
Transforms each vertex coordinate by multiplying it with the specified transformation matrix.
void sp::video::MeshBuffer::meshTranslate | ( | const dim::vector3df & | Direction | ) |
Translates each vertex coordinate in the specified direction.
void sp::video::MeshBuffer::meshTurn | ( | const dim::vector3df & | Rotation | ) |
Turns each vertex coordinate by rotating them with the specified rotation vector. This function performs a YXZ matrix rotation.
void sp::video::MeshBuffer::paint | ( | const video::color & | Color, | |
bool | CombineColors = false | |||
) |
Paints each vertex with the specified color.
Color,: | Specifies the color which is to be painted. | |
CombineColors,: | Specifies whether the color is to be multiplied with each vertex color or not. |
bool sp::video::MeshBuffer::removePrimitive | ( | const u32 | Index | ) |
Removes the specified primitive. If the primitive type is PRIMITIVE_TRIANGLES three indices will be removed. If the primitive type is PRIMITIVE_QUADS four indices will be removed etc.
Index,: | Specifies the primitive index. For triangles the index will be multiplied by 3, for quads it will be multiplied by four etc. |
Removes the specified texture for each layer which holds it.
[in] | Tex | Pointer to the texture which is to be removed. This may also be null which removes all texture layers which do not hold a texture. |
[in] | RemoveLayers | Specifies whether the texture layers are to be removed or only the textures from the layers. By default also the texture layers will be removed. |
bool sp::video::MeshBuffer::removeTexture | ( | const u8 | Layer = TEXLAYER_LAST , |
|
bool | RemoveLayer = true | |||
) |
Removes the texture from the specified layer index.
[in] | Layer | Specifies the layer index from which the texture is to be removed. By default the last texture layer is used (TEXLAYER_LAST). |
[in] | RemoveLayer | Specifies whether also the texture-layer is to be removed. By default true. |
bool sp::video::MeshBuffer::removeVertex | ( | const u32 | Index | ) |
Removes the specified vertex.
bool sp::video::MeshBuffer::renderable | ( | ) | const |
Returns true if rendering this mesh buffer has any effect. False otherwise when the count of indices are 0 or index buffer is used but count of vertices are 0.
void sp::video::MeshBuffer::saveBackup | ( | ) |
Save backup from the current mesh buffer. This can be useful before modifying the vertex- or index format.
void sp::video::MeshBuffer::seperateTriangles | ( | ) |
Seperates concatenated triangles.
void sp::video::MeshBuffer::setDefaultVertexAttribute | ( | const ERendererDataTypes | Type, | |
s32 | MaxSize, | |||
u32 | Index, | |||
const SVertexAttribute & | Attrib, | |||
const T & | Data | |||
) | [inline, protected] |
void sp::video::MeshBuffer::setHardwareInstancing | ( | s32 | InstanceCount | ) | [inline] |
Sets the count of instances for hardware instancing. To check if hardware instancing is supported call "RenderSystem::queryVideoSupport" with parameter "video::QUERY_HARDWARE_INSTANCING".
InstanceCount,: | Specifies the count of instancies. If this parameters smaller or equal to 1 hardware instancing will be disabled. |
void sp::video::MeshBuffer::setIndexBufferEnable | ( | bool | Enable | ) | [inline] |
Enables or disables the vertex buffer. If disabled the mesh buffer will be rendered as an array of vertices only. By default enabled.
void sp::video::MeshBuffer::setIndexBufferUsage | ( | const EHWBufferUsage | Usage | ) | [inline] |
Sets the index buffer usage. For more information see "setVertexBufferUsage".
void sp::video::MeshBuffer::setIndexFormat | ( | ERendererDataTypes | Format | ) |
Sets the new index format. This function is very slow and should never be used inside a render loop. Software as well as hardware index buffer will be recreated.
Format,: | Specifies the new index format. Only the following values are valid: ATTRIBUTE_UNSIGNED_BYTE, ATTRIBUTE_UNSIGNED_SHORT and ATTRIBUTE_USNIGNED_INT. The default value is ATTRIBUTE_USNIGNED_INT. |
void sp::video::MeshBuffer::setIndexOffset | ( | u32 | Offset | ) | [inline] |
Sets the index offset which will be added to each vertex index when adding a new triangle.
void sp::video::MeshBuffer::setMappingGen | ( | const u8 | Layer, | |
const EMappingGenTypes | Type | |||
) |
Sets the texture mapping generation type. This specifies if and how the texture coordinates are to be automatically generated. This can be used for "sphere-mapping" for example (video::MAPGEN_SPHERE_MAP). The value "video::MAPGEN_DISABLE" disables the auto. generation and the originally stored texture coordinates will be used for texture mapping. The specified texture coordinates of each vertex will not get lost when auto. generation was used because this process will be performed in real-time on the GPU.
Layer,: | Specifies the texture layer. | |
Type,: | Mapping generation type. |
Sets the texture mapping generation axles which are affected by auto. mapping generation. e.g. for "sphere-mapping" the axles "S" and "T" are need to be used. In texture space the axles are called S, T, R and Q. Which represent X, Y, Z and W.
Layer,: | Specifies the texture layer. | |
Coords,: | This is a flags parameter so several values can be combined. e.g. for "sphere-mapping" the following combination has to be used: video::MAPGEN_S | video::MAPGEN_T. But you don't need to call this function to use "sphere-mapping". "setMappingGen" will automatically configure the right axles. Only use this function to configure this feature in more detail for your own purposes. |
void sp::video::MeshBuffer::setMeshBufferUsage | ( | const EHWBufferUsage | Usage | ) | [inline] |
Sets the mesh buffer usage. For more detail see "setVertexBufferUsage".
void sp::video::MeshBuffer::setName | ( | const io::stringc & | Name | ) | [inline] |
Sets the buffers description name.
Sets the vertex index for the specified primitive index.
Index,: | Specifies the primitive index (e.g. when adding a triangle three indices will be added). | |
VertexIndex,: | Specifies the new vertex index which is to be set. |
void sp::video::MeshBuffer::setPrimitiveType | ( | const ERenderPrimitives | Type | ) |
Sets the primitive type. By default PRIMITIVE_TRIANGLES. There are some types which are only supported by OpenGL which are: PRIMITIVE_LINE_LOOP, PRIMITIVE_QUADS, PRIMITIVE_QUAD_STRIP and PRIMITIVE_POLYGON.
void sp::video::MeshBuffer::setReference | ( | MeshBuffer * | ReferenceSurface | ) | [inline] |
Sets a reference. Use this for mesh buffer instancing. By default 0 to disable instancing.
Sets the new texture.
Layer,: | Specifies the texture layer. | |
Tex,: | Pointer to the new Texture object (must not be 0). |
void sp::video::MeshBuffer::setTextureEnv | ( | const u8 | Layer, | |
const ETextureEnvTypes | Type | |||
) |
Sets the texture environment type. Usefull for detailmaps for example (video::TEXENV_ADDSIGNED). It configures how the texels shall be rendered onto the mesh and/or how they are to be combined with the previous texel.
Type,: | Environment type. |
void sp::video::MeshBuffer::setTextureLayerList | ( | const TextureLayerListType & | TextureLayers | ) | [inline] |
Sets the texture layer list.
void sp::video::MeshBuffer::setTextureMatrix | ( | const u8 | Layer, | |
const dim::matrix4f & | Matrix | |||
) |
Sets the texture matrix.
Layer,: | Specifies the texture layer. | |
Matrix,: | New matrix transformation. This is a 4x4 matrix but a transformation for a 2D texture normally should be limited to X-/ Y axle transformations and Z axis rotations. For this useful are functions like "matrix4::setTextureRotation". |
void sp::video::MeshBuffer::setTexturesReference | ( | MeshBuffer * | Reference | ) |
Sets the reference to the surface texture list.
[in] | Reference | Specifies the MeshBuffer object where its texture list will be used as reference. If 0 the original texture list will be used which is the default configuration. |
void sp::video::MeshBuffer::setTexturesReference | ( | TextureLayerListType * | Reference | ) |
Sets the reference to the surface texture list. Use this if you want to use the same texture list for several surfaces. This can be usful for terrains where every terrain patch has the same textures.
[in] | Reference | Pointer to an TextureLayerListType object. |
Sets the indices of the specified triangle.
Index,: | Specifies the triangle index (position for the index buffer multiplied by 3). | |
Indices,: | Array with the 3 indices which are to be set. |
void sp::video::MeshBuffer::setUpdateImmediate | ( | bool | Enable | ) | [inline] |
Enables or disables updating mesh buffer immediatly. By default disabled.
Enable,: | If true each vertex manipulation will be updated immediatly. This is very fast when just changing a few vertices in a large mesh. But when the model has a MorphTarget- or SkeletalAnimation it should be disabled. |
void sp::video::MeshBuffer::setVertexAttribute | ( | const u32 | Index, | |
const SVertexAttribute & | Attrib, | |||
const void * | AttribData, | |||
u32 | Size | |||
) |
Sets the specifies vertex attribute data. This can be used when you want to set the data for a vertex attribute with an unconventional data type. Actually a vertex coordinate in the SPE is always a 3 component 32bit floating-point vector. If you created your own vertex format where the coordinate is stored in form of a 3 component 16bit integer vector you need to use this function to set the attribute data.
Index,: | Specifies the vertex index. | |
Attrib,: | Specifies the vertex attribute which is to be set (e.g. "myVertexFormat->getCoord()" or "myVertexFormat->getUniversals()[0]"). | |
AttribData,: | Pointer to the attribue data which is to be set (e.g. "&myVector.X"). | |
Size,: | Data size in bytes (e.g. "sizeof(myVector)"). |
void sp::video::MeshBuffer::setVertexAttributeBarycentric | ( | u32 | IndexResult, | |
u32 | IndexA, | |||
u32 | IndexB, | |||
u32 | IndexC, | |||
const SVertexAttribute & | Attrib, | |||
const dim::vector3df & | BarycentricCoord | |||
) | [protected] |
void sp::video::MeshBuffer::setVertexBinormal | ( | const u32 | Index, | |
const dim::vector3df & | Binormal | |||
) |
Sets the specified vertex binormal.
Index,: | Specifies the vertex index. | |
Binormal,: | Specifies the binormal vector which is to be set. This vector will not be normalized. |
void sp::video::MeshBuffer::setVertexBufferUsage | ( | const EHWBufferUsage | Usage | ) | [inline] |
Sets the vertex buffer usage. Use this to optimize usage on VRAM. If you have an animated mesh use the dynamic configuration. If you have a static mesh use the static configuration. By default static.
Sets the specified vertex color.
Index,: | Specifies the vertex index. | |
Color,: | Specifies the vertex color which is to be set. |
void sp::video::MeshBuffer::setVertexCoord | ( | const u32 | Index, | |
const dim::vector3df & | Coord | |||
) |
Sets the specified vertex coordinate.
Index,: | Specifies the vertex index. | |
Coord,: | Specifies the vertex coordinate which is to be set. |
Sets the specified vertex fog coordinate. Fog coordinates are only visible with OpenGL if the fog is volumetric (FOG_VOLUMETRIC).
Index,: | Specifies the vertex index. | |
FogCoord,: | Specifies the fog coordinate which is to be set. |
void sp::video::MeshBuffer::setVertexFormat | ( | const VertexFormat * | Format | ) |
Sets the new vertex format. This function is very slow and should never be used inside a render loop. Software as well as hardware vertex buffer will be recreated.
Format,: | Specifies the new vertex format. If it's null this call has no effect. The default vertex format is an instance of the class "DefaultVertexFormat". The previous vertex format will not be deleted. If you set a new vertex format you need to delete it self when your program ends! |
void sp::video::MeshBuffer::setVertexNormal | ( | const u32 | Index, | |
const dim::vector3df & | Normal | |||
) |
Sets the specified vertex normal. Normals are important for lighting calculations.
Index,: | Specifies the vertex index. | |
Normal,: | Specifies the normal vector which is to be set. This vector will not be normalized. The GPU will perform normalization in real-time. So normalize the vector before setting it or do it in your shader program. |
void sp::video::MeshBuffer::setVertexTangent | ( | const u32 | Index, | |
const dim::vector3df & | Tangent | |||
) |
Sets the specified vertex tangent. Tangent vectors are used for normal mapping effects like bump- or parallax mapping.
Index,: | Specifies the vertex index. | |
Tangent,: | Specifies the tangent vector which is to be set. This vector will not be normalized. |
void sp::video::MeshBuffer::setVertexTexCoord | ( | const u32 | Index, | |
const dim::vector3df & | TexCoord, | |||
const u8 | Layer = TEXTURE_IGNORE | |||
) |
Sets the specified vertex texture coordinate.
Index,: | Specifies the vertex index. | |
TexCoord,: | Specifies the texture coordinate which is to be set. | |
Layer,: | Specifies the texture layer. By default TEXTURE_IGNORE which means that each layer will be used. |
bool sp::video::MeshBuffer::sortCompare | ( | const MeshBuffer & | Other | ) | const |
Compares this mesh buffer with the given mesh buffer on their surfaces. This is used to sort and then merge a list of mesh buffers.
void sp::video::MeshBuffer::textureTransform | ( | const u8 | Layer, | |
const dim::vector3df & | Size | |||
) |
Transforms each texture coordinate with the specified size.
Layer,: | Specifies the texture layer. | |
Size,: | Specifies the 2D factor which will be multiplied with each texture coordinate. |
void sp::video::MeshBuffer::textureTranslate | ( | const u8 | Layer, | |
const dim::vector3df & | Direction | |||
) |
Translates each texture coordinate in the specified direction.
Layer,: | Specifies the texture layer. | |
Direction,: | 2D vector in which direction the texture coordinates are to be translated. |
Rotates each texture coordinate. This is a matrix rotation around the Z-Axis.
Layer,: | Specifies the texture layer. | |
Rotation,: | Specifies the rotation angle. This is in degree. To work with radian use the "math::Radian" class and call the "getDegree()" function. |
void sp::video::MeshBuffer::updateIndexBuffer | ( | ) |
Updates the hardware index buffer or rather uploads the index buffer into VRAM.
void sp::video::MeshBuffer::updateIndexBufferElement | ( | u32 | Index | ) |
Updates the hardware index buffer only for the specified element.
void sp::video::MeshBuffer::updateMeshBuffer | ( | ) |
Updates the hardware vertex- and index buffer.
void sp::video::MeshBuffer::updateNormals | ( | const EShadingTypes | Shading = SHADING_GOURAUD |
) | [virtual] |
Updates each normal vector for flat- or gouraud shading.
void sp::video::MeshBuffer::updateNormalsFlat | ( | ) | [protected, virtual] |
TODO! -> move this to a utility or scene:: namespace/ class, whatever!!!
void sp::video::MeshBuffer::updateNormalsGouraud | ( | ) | [protected, virtual] |
TODO! -> move this to a utility or scene:: namespace/ class, whatever!!!
void sp::video::MeshBuffer::updateTangentSpace | ( | const u8 | TangentLayer = TEXTURE_IGNORE , |
|
const u8 | BinormalLayer = TEXTURE_IGNORE , |
|||
bool | UpdateNormals = true | |||
) |
Updates the tangent space (i.e. tangent- and binormal vectors for each vertex). This function stores the computed vectors in the specified texture coordinates to use them in your shader programs. Direct3D11 can use the special tangent and binormal vectors.
void sp::video::MeshBuffer::updateVertexBuffer | ( | ) |
Updates the hardware vertex buffer or rather uploads the vertex buffer into VRAM.
void sp::video::MeshBuffer::updateVertexBufferElement | ( | u32 | Index | ) |
Updates the hardware vertex buffer only for the specified element.
SMeshBufferBackup* sp::video::MeshBuffer::Backup_ [protected] |
SBuffer sp::video::MeshBuffer::IndexBuffer_ [protected] |
IndexFormat sp::video::MeshBuffer::IndexFormat_ [protected] |
u32 sp::video::MeshBuffer::IndexOffset_ [protected] |
s32 sp::video::MeshBuffer::InstanceCount_ [protected] |
io::stringc sp::video::MeshBuffer::Name_ [protected] |
MeshBuffer* sp::video::MeshBuffer::Reference_ [protected] |
bool sp::video::MeshBuffer::UpdateImmediate_ [protected] |
bool sp::video::MeshBuffer::UseIndexBuffer_ [protected] |
SBuffer sp::video::MeshBuffer::VertexBuffer_ [protected] |
const VertexFormat* sp::video::MeshBuffer::VertexFormat_ [protected] |