"L. Spiro Engine"
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes

lsg::CDirectX11VertexBuffer Class Reference

Implements the interface specified by CVertexBufferBase for DirectX 11. More...

#include <LSGDirectX11VertexBuffer.h>

Inheritance diagram for lsg::CDirectX11VertexBuffer:
lsg::CVertexBufferBase lsg::CVertexBuffer

List of all members.

Classes

struct  LSG_DIRECTX11_LAST_VERT_DECLS
struct  LSG_DIRECTX11_PREFINED_VERT_ATT

Public Member Functions

LSE_INLINE
D3D11_PRIMITIVE_TOPOLOGY
LSE_CALL 
GetDirectX11PrimitiveType () const

Protected Types

typedef struct
lsg::CDirectX11VertexBuffer::LSG_DIRECTX11_PREFINED_VERT_ATT
LPLSG_DIRECTX11_PREFINED_VERT_ATT
typedef struct
lsg::CDirectX11VertexBuffer::LSG_DIRECTX11_PREFINED_VERT_ATT 
LPCLSG_DIRECTX11_PREFINED_VERT_ATT
typedef struct
lsg::CDirectX11VertexBuffer::LSG_DIRECTX11_LAST_VERT_DECLS
LPLSG_DIRECTX11_LAST_VERT_DECLS
typedef struct
lsg::CDirectX11VertexBuffer::LSG_DIRECTX11_LAST_VERT_DECLS 
LPCLSG_DIRECTX11_LAST_VERT_DECLS

Protected Member Functions

LSBOOL LSE_CALL CreateApiVertexBuffer ()
LSVOID LSE_CALL ResetApi ()
LSVOID LSE_CALL UnLockApi ()
LSVOID LSE_CALL AdjustInputsToApi (LSG_VB_CONTENTS &_vcContents, LSUINT16 &_ui16UsageAndAccess)
LSUINT32 LSE_CALL GetVertexAttributeSizeApi (const LSG_VB_CONTENTS &_vcContents)
LSBOOL LSE_CALL SetStreamApi (LSUINT32 _ui32Stream, LSUINT32 _ui32Offset, LSUINT32 _ui32ElementsSize)
LSBOOL LSE_CALL CanBufferBeDestroyedApi (LSUINT32 _ui32Elements, LSUINT32 _ui32ElementsSize, LSUINT32 _ui32UsageAndAccess)
LSUINT32 LSE_CALL RawColorToApiColor (LSREAL _fR, LSREAL _fG, LSREAL _fB, LSVOID *_pvBuffer)
LSUINT32 LSE_CALL RawColorToApiColor (LSREAL _fR, LSREAL _fG, LSREAL _fB, LSREAL _fA, LSVOID *_pvBuffer)
LSVOID LSE_CALL SetColorApi (LSREAL _fR, LSREAL _fG, LSREAL _fB, LSVOID *_pvBuffer)
LSVOID LSE_CALL SetAlphaApi (LSREAL _fA, LSVOID *_pvBuffer)
LSVOID LSE_CALL PrepareToRenderApi ()
LSVOID LSE_CALL EndRenderApi ()
LSVOID LSE_CALL RenderApi (LSUINT32 _ui32TotalPrimitives)
LSUINT32 LSE_CALL BestStrideApi (LSUINT32 _ui32Size)

Protected Attributes

ID3D11Buffer * m_pbApiVertexBuffer
LSBOOL m_bFakeAlpha [LSG_VBM_MAX_USAGES]
LSUINT32 m_ui32VertexDeclLength
CVectorPoD
< LSG_DIRECTX11_LAST_VERT_DECLS,
LSUINT8, 1UL > 
m_vVertDeclRecord
D3D11_INPUT_ELEMENT_DESC * m_piedVertexDeclaration
D3D11_PRIMITIVE_TOPOLOGY m_ptPrimitiveType

Static Protected Attributes

static
LSG_DIRECTX11_PREFINED_VERT_ATT 
m_dpvaVertices []

Detailed Description

Implements the interface specified by CVertexBufferBase for DirectX 11.

Class CDirectX11VertexBuffer Description: Implements the interface specified by CVertexBufferBase for DirectX 11. Note that only in debug builds is CVertexBufferBase actually inherited by this class.


Member Typedef Documentation

Last-set vertex declarations for a given stream combination.

Vertex attribute properties.


Member Function Documentation

LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::AdjustInputsToApi ( LSG_VB_CONTENTS _vcContents,
LSUINT16 &  _ui16UsageAndAccess 
) [protected]

Give the current graphics API vertex buffer a chance to adjust some of the inputs when creating a vertex buffer. For example, OpenGL allows colors to be specified without alpha, whereas DirectX always has alpha when there are colors specified. Using this function, DirectX can magically add the alpha flag when the color flag is specified.

Parameters:
_vcContentsThe vertex attributes.
_ui16UsageAndAccessThe usage and access value.
LSUINT32 LSE_CALL lsg::CDirectX11VertexBuffer::BestStrideApi ( LSUINT32  _ui32Size) [protected]

Determines the best stride for a vertex buffer given its element size.

Parameters:
_ui32Size
Returns:
Returns the best stride for a vertex buffer given its element size.
LSBOOL LSE_CALL lsg::CDirectX11VertexBuffer::CanBufferBeDestroyedApi ( LSUINT32  _ui32Elements,
LSUINT32  _ui32ElementsSize,
LSUINT32  _ui32UsageAndAccess 
) [protected]

Can the source vertex data be destroyed? This is guaranteed to be called only after a successful call to CreateApiVertexBuffer().

Parameters:
_ui32ElementsThe number of elements in the buffer to be potentially destroyed.
_ui32ElementsSizeThe size of the elements in the buffer to be potentially destroyed.
_ui32UsageAndAccessThe usage and access of the buffer to be potentially destroyed.
Returns:
Returns true if the buffer can be destroyed after having been sent to the hardware.
LSBOOL LSE_CALL lsg::CDirectX11VertexBuffer::CreateApiVertexBuffer ( ) [protected]

Create a vertex buffer compliant with the current graphics API.

Returns:
Returns false if the creation of the buffer failed.
LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::EndRenderApi ( ) [protected]

Finish rendering.

LSE_INLINE D3D11_PRIMITIVE_TOPOLOGY LSE_CALL lsg::CDirectX11VertexBuffer::GetDirectX11PrimitiveType ( ) const

Get the primitive type in DirectX 11 terms.

Returns:
Returns the primitive type in DirectX 11 terms.
LSUINT32 LSE_CALL lsg::CDirectX11VertexBuffer::GetVertexAttributeSizeApi ( const LSG_VB_CONTENTS _vcContents) [protected]

Given a contents mask, determine the size of a single vertex attribute in bytes.

Parameters:
_vcContentsMask indicating the contents of a vertex.
Returns:
Returns the size of the data or ~0UL to indicate that the size could not be calculated.
LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::PrepareToRenderApi ( ) [protected]

Prepare for rendering.

LSE_INLINE LSUINT32 LSE_CALL lsg::CDirectX11VertexBuffer::RawColorToApiColor ( LSREAL  _fR,
LSREAL  _fG,
LSREAL  _fB,
LSVOID *  _pvBuffer 
) [protected]

Translate a color from 3 floats to the internal format used by the graphics API.

Parameters:
_fRThe red component of the color to translate.
_fGThe green component of the color to translate.
_fBThe blue component of the color to translate.
_pvBufferThe location where to store the color.
Returns:
Returns the size of the translated value in bytes.
LSE_INLINE LSUINT32 LSE_CALL lsg::CDirectX11VertexBuffer::RawColorToApiColor ( LSREAL  _fR,
LSREAL  _fG,
LSREAL  _fB,
LSREAL  _fA,
LSVOID *  _pvBuffer 
) [protected]

Translate a color from 4 floats to the internal format used by the graphics API.

Parameters:
_fRThe red component of the color to translate.
_fGThe green component of the color to translate.
_fBThe blue component of the color to translate.
_fAThe alpha component of the color to translate.
_pvBufferThe location where to store the color.
Returns:
Returns the size of the translated value in bytes.
LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::RenderApi ( LSUINT32  _ui32TotalPrimitives) [protected]

Render. This is performed on the first vertex buffer set. All other vertex buffers must use the same primitive type and have the same number of elements active. If not, the system will throw an error.

Parameters:
_ui32TotalPrimitivesThe total number of primitives to render.
LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::ResetApi ( ) [protected]

Destroy the vertex buffer that is compliant with the current graphics API and all related resources.

LSE_INLINE LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::SetAlphaApi ( LSREAL  _fA,
LSVOID *  _pvBuffer 
) [protected]

Apply a given alpha to the given vertex buffer location.

Parameters:
_fAThe alpha component of the color to set.
_pvBufferThe location on the vertex buffer where to store the alpha.
LSE_INLINE LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::SetColorApi ( LSREAL  _fR,
LSREAL  _fG,
LSREAL  _fB,
LSVOID *  _pvBuffer 
) [protected]

Apply a given color to the given vertex buffer location.

Parameters:
_fRThe red component of the color to set.
_fGThe green component of the color to set.
_fBThe blue component of the color to set.
_pvBufferThe location on the vertex buffer where to store the color.
LSBOOL LSE_CALL lsg::CDirectX11VertexBuffer::SetStreamApi ( LSUINT32  _ui32Stream,
LSUINT32  _ui32Offset,
LSUINT32  _ui32ElementsSize 
) [protected]

Activate this vertex buffer on a given stream.

Parameters:
_ui32StreamThe stream on which to activate this buffer.
_ui32OffsetThe offset, in elements.
_ui32ElementsSizeSize of the elements in the vertex buffer.
Returns:
Returns true if the vertex buffer was activated on the given stream, ready to be rendered.
LSVOID LSE_CALL lsg::CDirectX11VertexBuffer::UnLockApi ( ) [protected]

Updates the hardware with the modified vertex buffer data.


Member Data Documentation

LSBOOL lsg::CDirectX11VertexBuffer::m_bFakeAlpha[LSG_VBM_MAX_USAGES] [protected]

Do we fake the alpha values?

Vertex attributes.

A DirectX 11 vertex buffer.

D3D11_INPUT_ELEMENT_DESC* lsg::CDirectX11VertexBuffer::m_piedVertexDeclaration [protected]

Vertex declaration.

D3D11_PRIMITIVE_TOPOLOGY lsg::CDirectX11VertexBuffer::m_ptPrimitiveType [protected]

DirectX 11 primitive type.

Total values in our vertex declaration.

CVectorPoD<LSG_DIRECTX11_LAST_VERT_DECLS, LSUINT8, 1UL> lsg::CDirectX11VertexBuffer::m_vVertDeclRecord [protected]

An array of up to LSG_VBM_MAX_STREAMS entries to record the last-set vertex declarations for each slot combination.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator