Public Member Functions

sp::video::VertexFormatUniversal Class Reference

#include <spVertexFormatUniversal.hpp>

Inheritance diagram for sp::video::VertexFormatUniversal:
sp::video::VertexFormat

List of all members.

Public Member Functions

 VertexFormatUniversal ()
 ~VertexFormatUniversal ()
u32 getFormatSize () const
 Returns the size in bytes of this vertex format.
void addCoord (const ERendererDataTypes Type=DATATYPE_FLOAT, s32 Size=3)
void addColor (const ERendererDataTypes Type=DATATYPE_UNSIGNED_BYTE, s32 Size=4)
void addNormal (const ERendererDataTypes Type=DATATYPE_FLOAT)
 Adds the normal vector component to the vertex format. The size is always 3.
void addBinormal (const ERendererDataTypes Type=DATATYPE_FLOAT)
void addTangent (const ERendererDataTypes Type=DATATYPE_FLOAT)
void addTexCoord (const ERendererDataTypes Type=DATATYPE_FLOAT, s32 Size=2)
void addFogCoord (const ERendererDataTypes Type=DATATYPE_FLOAT)
void addUniversal (const ERendererDataTypes Type, s32 Size, const io::stringc &Name, bool Normalize=false, const EVertexFormatFlags Attribute=VERTEXFORMAT_UNIVERSAL)
void remove (const EVertexFormatFlags Type)
void clear ()
 Clears the whole vertex format. After calling this function the format size is 0.

Detailed Description

This is the universal vertex format. This can be used particular when using shader programs.


Constructor & Destructor Documentation

sp::video::VertexFormatUniversal::VertexFormatUniversal (  ) 
sp::video::VertexFormatUniversal::~VertexFormatUniversal (  ) 

Member Function Documentation

void sp::video::VertexFormatUniversal::addBinormal ( const ERendererDataTypes  Type = DATATYPE_FLOAT  ) 

Adds the binormal vector component to the vertex format. The size is always 3. This feature is only supported with Direct3D11. For other renderers add a universal component.

void sp::video::VertexFormatUniversal::addColor ( const ERendererDataTypes  Type = DATATYPE_UNSIGNED_BYTE,
s32  Size = 4 
)

Adds the color componetn to the vertex format. For Direct3D9 this is always 4 ubytes (in the order ARGB).

Parameters:
Size,: Valid numbers are: 3 -> RGB and 4 -> RGBA. By default 4.
void sp::video::VertexFormatUniversal::addCoord ( const ERendererDataTypes  Type = DATATYPE_FLOAT,
s32  Size = 3 
)

Adds the coordinate component to the vertex format with the specified attributes.

Parameters:
Type,: Specifies the data type (float, int etc.).
Size,: Specifies the data size. Valid numbers are: 1 -> X, 2 -> XY, 3 -> XYZ and 4 -> XYZW. By default 3.
Returns:
Byte offset of this component.
void sp::video::VertexFormatUniversal::addFogCoord ( const ERendererDataTypes  Type = DATATYPE_FLOAT  ) 

Adds the fog coordinate component to the vertex format. The size is always 1. This feature is only supported in OpenGL for fixed function pipeline.

void sp::video::VertexFormatUniversal::addNormal ( const ERendererDataTypes  Type = DATATYPE_FLOAT  ) 

Adds the normal vector component to the vertex format. The size is always 3.

void sp::video::VertexFormatUniversal::addTangent ( const ERendererDataTypes  Type = DATATYPE_FLOAT  ) 

Adds the tangent vector component to the vertex format. The size is always 3. This feature is only supported with Direct3D11. For other renderers add a universal component.

void sp::video::VertexFormatUniversal::addTexCoord ( const ERendererDataTypes  Type = DATATYPE_FLOAT,
s32  Size = 2 
)

Adds a new texture coordiante to the vertex format. You can not use texcoord 0 and 2 or anything like that. Only 0, 1, 2 etc.

Parameters:
Size,: Valid numbers are: 1 -> S, 2 -> ST, 3 -> STR and 4 -> STRQ. By default 2.
void sp::video::VertexFormatUniversal::addUniversal ( const ERendererDataTypes  Type,
s32  Size,
const io::stringc Name,
bool  Normalize = false,
const EVertexFormatFlags  Attribute = VERTEXFORMAT_UNIVERSAL 
)

Adds a universal vertex attribute to the vertex format. This can only be used in combination with a shader program.

Parameters:
Size,: Must be in range [0, 3].
Name,: Specifies attribute name. For OpenGL it can be any name used in the vertex shader. For Direct3D11 it needs to be one of the HLSL semantics (POSITION[n], COLOR[n] etc.):
Normalize,: Specifies whether the attribute shall be normalized or not. e.g. when you use the ubyte data type this can be useful to normlize the vector to the range [0.0, 1.0].
Attribute,: Specifies which kind of attribute this universal is. By default its an unknown attribute. If you specify it as a vertex coordinate e.g. you can set its data by the "setVertexCoord" function. In this case morph-target- or skeletal animation will further more work fine.
void sp::video::VertexFormatUniversal::clear (  ) 

Clears the whole vertex format. After calling this function the format size is 0.

u32 sp::video::VertexFormatUniversal::getFormatSize (  )  const [virtual]

Returns the size in bytes of this vertex format.

Reimplemented from sp::video::VertexFormat.

void sp::video::VertexFormatUniversal::remove ( const EVertexFormatFlags  Type  ) 

Removes the specified vertex attribute.

Parameters:
Type,: Specifies the vertex attribute which is to be removed. If the type is a texture coordiante or universal attribute the last one will be removed.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines