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 } |
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 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 allowed!) |
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 allowed!) |
Binormal |
Binormal (also referred to as bitangent) data (1 channel, only Float3 allowed!) |
Vertex attribute types.
RGBA |
Color (API dependent storage, do always use GetColor() and SetColor()!) |
Float1 |
Float 1 |
Float2 |
Float 2 |
Float3 |
Float 3 |
Float4 |
Float 4 |
Short2 |
Short 2 |
Short4 |
Short 4 |
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 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 (in bytes)
|