PixelLightAPI
.
|
Renderer vertex buffer (VBO) resource. More...
#include <VertexBuffer.h>
Classes | |
struct | Attribute |
Defines input vertex attribute to the pipeline. More... | |
Public Types | |
enum | ESemantic { Position = 0, BlendWeight = 1, Normal = 2, Color = 3, FogCoord = 4, PointSize = 5, BlendIndices = 6, TexCoord = 7, Tangent = 8, Binormal = 9 } |
Vertex attribute semantic. More... | |
enum | EType { RGBA = 0, Float1 = 1, Float2 = 2, Float3 = 3, Float4 = 4, Short2 = 5, Short4 = 6, Half1 = 7, Half2 = 8, Half3 = 9, Half4 = 10 } |
Vertex attribute types. More... | |
Public Member Functions | |
virtual PLRENDERER_API | ~VertexBuffer () |
Destructor. | |
PLCore::uint32 | GetNumOfVertexAttributes () const |
Returns the number of vertex attributes. | |
PLRENDERER_API bool | ClearVertexAttributes () |
Clears the vertex attributes. | |
PLRENDERER_API bool | AddVertexAttribute (ESemantic nSemantic, PLCore::uint32 nChannel, EType nType) |
Adds vertex attribute. | |
const Attribute * | GetVertexAttribute (PLCore::uint32 nIndex=0) const |
Returns a vertex attribute. | |
PLRENDERER_API const Attribute * | GetVertexAttribute (ESemantic nSemantic, PLCore::uint32 nChannel=0) const |
Returns the first found vertex attribute with the requested semantic. | |
PLCore::uint32 | GetVertexSize () const |
Returns the vertex size (in bytes) | |
PLRENDERER_API VertexBuffer & | operator= (const VertexBuffer &cSource) |
Copy operator. | |
PLRENDERER_API bool | GetFloat (PLCore::uint32 nIndex, PLCore::uint32 nSemantic, PLCore::uint32 nChannel, float &fX, float &fY, float &fZ, float &fW) |
Fills the data of a vertex buffer attribute into four given generic floating point components. | |
PLRENDERER_API bool | SetFloat (PLCore::uint32 nIndex, PLCore::uint32 nSemantic, PLCore::uint32 nChannel, float fX, float fY=0.0f, float fZ=0.0f, float fW=0.0f) |
Sets the data of a vertex buffer attribute by using four given generic floating point components. | |
PLRENDERER_API void | CalculateBoundingBox (PLMath::Vector3 &vMinPos, PLMath::Vector3 &vMaxPos, PLRenderer::IndexBuffer *pIndexBuffer=nullptr) |
Returns the vertex buffer bounding box. | |
PLRENDERER_API void | CalculateBoundingSphere (PLMath::Vector3 &vPos, float &fRadius, PLRenderer::IndexBuffer *pIndexBuffer=nullptr) |
Returns the vertex buffer bounding sphere. | |
virtual void * | GetData (PLCore::uint32 nIndex, PLCore::uint32 nSemantic, PLCore::uint32 nChannel=0)=0 |
Returns the data of a vertex buffer attribute. | |
virtual PLGraphics::Color4 | GetColor (PLCore::uint32 nIndex, PLCore::uint32 nChannel=0)=0 |
Returns the RGBA color of a vertex. | |
virtual bool | SetColor (PLCore::uint32 nIndex, const PLGraphics::Color4 &cColor, PLCore::uint32 nChannel=0)=0 |
Set the RGBA color of a vertex. | |
virtual PLRENDERER_API void * | GetData () override |
Returns the buffer data. | |
Static Public Attributes | |
static const PLCore::uint8 | NumOfSemantics = 10 |
static const PLCore::uint8 | MaxPipelineChannels = 16 |
Protected Member Functions | |
PLRENDERER_API | VertexBuffer (Renderer &cRenderer) |
Constructor. | |
Protected Attributes | |
PLCore::Array< Attribute * > | m_lstVertexAttributes |
PLCore::uint32 | m_nVertexSize |
Renderer vertex buffer (VBO) resource.
Vertex attribute semantic.
Position |
Position data (1 channel) |
BlendWeight |
Blend weight data (1 channel) |
Normal |
Normal data (1 channel, only Float3/Half3 allowed due to restrictions of legacy APIs!) |
Color |
Color data (2 channels, only RGBA allowed, second channel requires Capabilities::bVertexBufferSecondaryColor) |
FogCoord |
Fog coordinate data (1 channel, only Float1 allowed, requires FixedFunctions::Capabilities::bVertexBufferFogCoord) |
PointSize |
Point sprite size data (1 channel, only Float1 allowed! Known as "PSize", but this name may conflict with OS definitions) |
BlendIndices |
Blend indices data (1 channel) |
TexCoord |
Texture coordinate data (n channels) |
Tangent |
Tangent data (1 channel, only Float3/Half3 allowed due to restrictions of legacy APIs!) |
Binormal |
Binormal (also referred to as bitangent) data (1 channel, only Float3/Half3 allowed due to restrictions of legacy APIs!) |
Vertex attribute types.
RGBA |
Color (legacy API dependent storage which is no longer required when using modern shader based API's, do always use GetColor() and SetColor()!) |
Float1 |
Float 1 (one component per element, 32 bit floating point per component) |
Float2 |
Float 2 (two components per element, 32 bit floating point per component) |
Float3 |
Float 3 (three components per element, 32 bit floating point per component) |
Float4 |
Float 4 (four components per element, 32 bit floating point per component) |
Short2 |
Short 2 (two components per element, 16 bit integer per component) |
Short4 |
Short 4 (four components per element, 16 bit integer per component) |
Half1 |
Half 1 (one component per element, 16 bit floating point per component, may not be supported by each API, be careful with this data type because not every GPU driver is optimized for it) |
Half2 |
Half 2 (two components per element, 16 bit floating point per component, may not be supported by each API, be careful with this data type because not every GPU driver is optimized for it) |
Half3 |
Half 3 (three components per element, 16 bit floating point per component, may not be supported by each API, be careful with this data type because not every GPU driver is optimized for it) |
Half4 |
Half 4 (four components per element, 16 bit floating point per component, may not be supported by each API, be careful with this data type because not every GPU driver is optimized for it) |
Reimplemented from PLRenderer::Resource.
virtual PLRENDERER_API PLRenderer::VertexBuffer::~VertexBuffer | ( | ) | [virtual] |
Destructor.
PLRENDERER_API PLRenderer::VertexBuffer::VertexBuffer | ( | Renderer & | cRenderer | ) | [protected] |
Constructor.
[in] | cRenderer | Owner renderer |
PLCore::uint32 PLRenderer::VertexBuffer::GetNumOfVertexAttributes | ( | ) | const [inline] |
Returns the number of vertex attributes.
PLRENDERER_API bool PLRenderer::VertexBuffer::ClearVertexAttributes | ( | ) |
Clears the vertex attributes.
PLRENDERER_API bool PLRenderer::VertexBuffer::AddVertexAttribute | ( | ESemantic | nSemantic, |
PLCore::uint32 | nChannel, | ||
EType | nType | ||
) |
Adds vertex attribute.
[in] | nSemantic | Any member of the vertex attribute semantic enumeration type |
[in] | nChannel | Pipeline channel (see ESemantic, maximum see MaxPipelineChannels) |
[in] | nType | Any member of the EType enumeration type |
const VertexBuffer::Attribute * PLRenderer::VertexBuffer::GetVertexAttribute | ( | PLCore::uint32 | nIndex = 0 | ) | const [inline] |
Returns a vertex attribute.
[in] | nIndex | Index of the vertex attribute which should be returned |
PLRENDERER_API const Attribute* PLRenderer::VertexBuffer::GetVertexAttribute | ( | ESemantic | nSemantic, |
PLCore::uint32 | nChannel = 0 |
||
) | const |
Returns the first found vertex attribute with the requested semantic.
[in] | nSemantic | Vertex attribute semantic |
[in] | nChannel | Pipeline channel (see ESemantic, maximum see MaxPipelineChannels) |
PLCore::uint32 PLRenderer::VertexBuffer::GetVertexSize | ( | ) | const [inline] |
Returns the vertex size (in bytes)
Returns the vertex size in bytes.
PLRENDERER_API VertexBuffer& PLRenderer::VertexBuffer::operator= | ( | const VertexBuffer & | cSource | ) |
Copy operator.
[in] | cSource | Source to copy from |
PLRENDERER_API bool PLRenderer::VertexBuffer::GetFloat | ( | PLCore::uint32 | nIndex, |
PLCore::uint32 | nSemantic, | ||
PLCore::uint32 | nChannel, | ||
float & | fX, | ||
float & | fY, | ||
float & | fZ, | ||
float & | fW | ||
) |
Fills the data of a vertex buffer attribute into four given generic floating point components.
[in] | nIndex | Vertex index |
[in] | nSemantic | Any member of the vertex attribute semantic enumeration type |
[in] | nChannel | Pipeline channel (see ESemantic) |
[out] | fX | On success, receives the first component, set to null on error |
[out] | fY | On success, receives the second component, set to null on error or when the component does not exist |
[out] | fZ | On success, receives the third component, set to null on error or when the component does not exist |
[out] | fW | On success, receives the fourth component, set to null on error or when the component does not exist |
PLRENDERER_API bool PLRenderer::VertexBuffer::SetFloat | ( | PLCore::uint32 | nIndex, |
PLCore::uint32 | nSemantic, | ||
PLCore::uint32 | nChannel, | ||
float | fX, | ||
float | fY = 0.0f , |
||
float | fZ = 0.0f , |
||
float | fW = 0.0f |
||
) |
Sets the data of a vertex buffer attribute by using four given generic floating point components.
[in] | nIndex | Vertex index |
[in] | nSemantic | Any member of the vertex attribute semantic enumeration type |
[in] | nChannel | Pipeline channel (see ESemantic) |
[in] | fX | First component |
[in] | fY | Second component |
[in] | fZ | Third component |
[in] | fW | Fourth component |
PLRENDERER_API void PLRenderer::VertexBuffer::CalculateBoundingBox | ( | PLMath::Vector3 & | vMinPos, |
PLMath::Vector3 & | vMaxPos, | ||
PLRenderer::IndexBuffer * | pIndexBuffer = nullptr |
||
) |
Returns the vertex buffer bounding box.
[out] | vMinPos | Will receive the minimum bounding box position |
[out] | vMaxPos | Will receive the maximum bounding box position |
[in] | pIndexBuffer | Optional index buffer to take only a set of vertices into account, set to a null pointer if not used |
PLRENDERER_API void PLRenderer::VertexBuffer::CalculateBoundingSphere | ( | PLMath::Vector3 & | vPos, |
float & | fRadius, | ||
PLRenderer::IndexBuffer * | pIndexBuffer = nullptr |
||
) |
Returns the vertex buffer bounding sphere.
[out] | vPos | Will receive the bounding sphere position |
[out] | fRadius | Will receive the bounding sphere radius |
[in] | pIndexBuffer | Optional index buffer to take only a set of vertices into account, set to a null pointer if not used |
virtual void* PLRenderer::VertexBuffer::GetData | ( | PLCore::uint32 | nIndex, |
PLCore::uint32 | nSemantic, | ||
PLCore::uint32 | nChannel = 0 |
||
) | [pure virtual] |
Returns the data of a vertex buffer attribute.
[in] | nIndex | Vertex index |
[in] | nSemantic | Any member of the vertex attribute semantic enumeration type |
[in] | nChannel | Pipeline channel (see ESemantic) |
virtual PLGraphics::Color4 PLRenderer::VertexBuffer::GetColor | ( | PLCore::uint32 | nIndex, |
PLCore::uint32 | nChannel = 0 |
||
) | [pure virtual] |
Returns the RGBA color of a vertex.
[in] | nIndex | Vertex index |
[in] | nChannel | Pipeline channel (see ESemantic) |
virtual bool PLRenderer::VertexBuffer::SetColor | ( | PLCore::uint32 | nIndex, |
const PLGraphics::Color4 & | cColor, | ||
PLCore::uint32 | nChannel = 0 |
||
) | [pure virtual] |
Set the RGBA color of a vertex.
[in] | nIndex | Vertex index |
[in] | cColor | Color to set |
[in] | nChannel | Pipeline channel (see ESemantic) |
virtual PLRENDERER_API void* PLRenderer::VertexBuffer::GetData | ( | ) | [override, virtual] |
Returns the buffer data.
Implements PLRenderer::Buffer.
const PLCore::uint8 PLRenderer::VertexBuffer::NumOfSemantics = 10 [static] |
Number of vertex attribute semantics
const PLCore::uint8 PLRenderer::VertexBuffer::MaxPipelineChannels = 16 [static] |
Maximum possible number of channels
The vertex attributes
PLCore::uint32 PLRenderer::VertexBuffer::m_nVertexSize [protected] |
Size (in bytes) of the vertex buffer
|