Nebula
Loading...
Searching...
No Matches
Vulkan::VkShapeRenderer Class Reference

#include <vkshaperenderer.h>

Inherits Base::ShapeRendererBase.

Classes

struct  IndexedDraws
 
struct  UnindexedDraws
 

Public Member Functions

 VkShapeRenderer ()
 constructor
 
virtual ~VkShapeRenderer ()
 destructor
 
void Open ()
 open the shape renderer
 
void Close ()
 close the shape renderer
 
void DrawShapes (const CoreGraphics::CmdBufferId cmdBuf)
 draw attached shapes and clear deferred stack, must be called inside render loop
 
- Public Member Functions inherited from Base::ShapeRendererBase
 ShapeRendererBase ()
 constructor
 
virtual ~ShapeRendererBase ()
 destructor
 
void Open ()
 open the shape renderer
 
void Close ()
 close the shape renderer
 
bool IsOpen () const
 return true if open
 
void ClearShapes ()
 delete shapes of given thread id
 
void AddShape (const CoreGraphics::RenderShape &shape)
 add a shape for deferred rendering (can be called from outside render loop)
 
void AddShapes (const Util::Array< CoreGraphics::RenderShape > &shapeArray)
 add multiple shapes
 
void AddWireFrameBox (const Math::bbox &boundingBox, const Math::vec4 &color)
 add wireframe box
 
void DrawShapes ()
 draw deferred shapes and clear deferred stack, must be called inside render loop
 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Static Public Attributes

static const int MaxNumVertices = 262140
 maximum amount of vertices to be rendered by drawprimitives and drawindexedprimitives
 
static const int MaxNumIndices = 262140
 maximum amount of indices to be rendered by drawprimitives and drawindexedprimitives
 
static const int MaxVertexWidth = 8 * sizeof(float)
 maximum size for primitive size (4 floats for position, 4 floats for color)
 
static const int MaxIndexWidth = sizeof(int)
 maximum size for an index
 

Private Member Functions

 __DeclareClass (VkShapeRenderer)
 
void DrawBufferedPrimitives (const CoreGraphics::CmdBufferId cmdBuf)
 draw buffered primitives
 
void DrawBufferedIndexedPrimitives (const CoreGraphics::CmdBufferId cmdBuf)
 draw buffered indexed primtives
 
void GrowIndexBuffer ()
 grow index buffer
 
void GrowVertexBuffer ()
 grow vertex buffer
 
void DrawSimpleShape (const CoreGraphics::CmdBufferId cmdBuf, const Math::mat4 &modelTransform, CoreGraphics::RenderShape::Type shapeType, const Math::vec4 &color, const float lineThickness)
 draw a shape
 
void DrawMesh (const CoreGraphics::CmdBufferId cmdBuf, const Math::mat4 &modelTransform, const CoreGraphics::MeshId mesh, const Math::vec4 &color, const float lineThickness)
 draw debug mesh
 
void DrawPrimitives (const Math::mat4 &modelTransform, CoreGraphics::PrimitiveTopology::Code topology, SizeT numVertices, const void *vertices, const float lineThickness)
 draw primitives
 
void DrawIndexedPrimitives (const Math::mat4 &modelTransform, CoreGraphics::PrimitiveTopology::Code topology, SizeT numVertices, const void *vertices, SizeT numIndices, const void *indices, CoreGraphics::IndexType::Code indexType, const float lineThickness)
 draw indexed primitives
 

Private Attributes

Util::FixedArray< Resources::ResourceId > shapeMeshResources
 
Util::FixedArray< CoreGraphics::MeshIdmeshes
 
Util::Array< CoreGraphics::VertexComponentcomps
 
CoreGraphics::BufferId ibos [MaxVertexIndexBuffers]
 
CoreGraphics::BufferId vbos [MaxVertexIndexBuffers]
 
byte * vertexBufferPtr
 
byte * indexBufferPtr
 
IndexT indexBufferActiveIndex
 
IndexT vertexBufferActiveIndex
 
SizeT vertexBufferCapacity
 
SizeT indexBufferCapacity
 
CoreGraphics::VertexLayoutId vertexLayout
 
IndexT model
 
IndexT diffuseColor
 
IndexT lineWidth
 
SizeT vertexBufferOffset
 
SizeT indexBufferOffset
 
struct Vulkan::VkShapeRenderer::IndexedDraws indexed [CoreGraphics::PrimitiveTopology::NumTopologies]
 
struct Vulkan::VkShapeRenderer::UnindexedDraws unindexed [CoreGraphics::PrimitiveTopology::NumTopologies]
 

Static Private Attributes

static const SizeT MaxVertexIndexBuffers = 2
 

Additional Inherited Members

- Public Types inherited from Base::ShapeRendererBase
enum  ShaderTypes {
  Mesh , MeshNoDepth , MeshWireframe , Primitives ,
  PrimitivesNoDepth , PrimitivesWireframeTriangles , PrimitivesWireframeLines , NumShaders
}
 
- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 
- Protected Attributes inherited from Base::ShapeRendererBase
bool isOpen
 
Util::Array< CoreGraphics::RenderShapeshapes [ShaderTypes::NumShaders]
 
Util::Array< CoreGraphics::RenderShapeprimitives [ShaderTypes::NumShaders]
 
CoreGraphics::ShaderProgramId programs [ShaderTypes::NumShaders]
 
SizeT numIndicesThisFrame
 
SizeT numVerticesThisFrame
 

Constructor & Destructor Documentation

◆ VkShapeRenderer()

Vulkan::VkShapeRenderer::VkShapeRenderer ( )

constructor

◆ ~VkShapeRenderer()

Vulkan::VkShapeRenderer::~VkShapeRenderer ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Vulkan::VkShapeRenderer::__DeclareClass ( VkShapeRenderer )
private

◆ Close()

void Vulkan::VkShapeRenderer::Close ( )

close the shape renderer

◆ DrawBufferedIndexedPrimitives()

void Vulkan::VkShapeRenderer::DrawBufferedIndexedPrimitives ( const CoreGraphics::CmdBufferId cmdBuf)
private

draw buffered indexed primtives

◆ DrawBufferedPrimitives()

void Vulkan::VkShapeRenderer::DrawBufferedPrimitives ( const CoreGraphics::CmdBufferId cmdBuf)
private

draw buffered primitives

◆ DrawIndexedPrimitives()

void Vulkan::VkShapeRenderer::DrawIndexedPrimitives ( const Math::mat4 & modelTransform,
CoreGraphics::PrimitiveTopology::Code topology,
SizeT numVertices,
const void * vertices,
SizeT numIndices,
const void * indices,
CoreGraphics::IndexType::Code indexType,
const float lineThickness )
private

draw indexed primitives

◆ DrawMesh()

void Vulkan::VkShapeRenderer::DrawMesh ( const CoreGraphics::CmdBufferId cmdBuf,
const Math::mat4 & modelTransform,
const CoreGraphics::MeshId mesh,
const Math::vec4 & color,
const float lineThickness )
private

draw debug mesh

◆ DrawPrimitives()

void Vulkan::VkShapeRenderer::DrawPrimitives ( const Math::mat4 & modelTransform,
CoreGraphics::PrimitiveTopology::Code topology,
SizeT numVertices,
const void * vertices,
const float lineThickness )
private

draw primitives

◆ DrawShapes()

void Vulkan::VkShapeRenderer::DrawShapes ( const CoreGraphics::CmdBufferId cmdBuf)

draw attached shapes and clear deferred stack, must be called inside render loop

◆ DrawSimpleShape()

void Vulkan::VkShapeRenderer::DrawSimpleShape ( const CoreGraphics::CmdBufferId cmdBuf,
const Math::mat4 & modelTransform,
CoreGraphics::RenderShape::Type shapeType,
const Math::vec4 & color,
const float lineThickness )
private

draw a shape

◆ GrowIndexBuffer()

void Vulkan::VkShapeRenderer::GrowIndexBuffer ( )
private

grow index buffer

◆ GrowVertexBuffer()

void Vulkan::VkShapeRenderer::GrowVertexBuffer ( )
private

grow vertex buffer

◆ Open()

void Vulkan::VkShapeRenderer::Open ( )

open the shape renderer

Member Data Documentation

◆ comps

Util::Array<CoreGraphics::VertexComponent> Vulkan::VkShapeRenderer::comps
private

◆ diffuseColor

IndexT Vulkan::VkShapeRenderer::diffuseColor
private

◆ ibos

CoreGraphics::BufferId Vulkan::VkShapeRenderer::ibos[MaxVertexIndexBuffers]
private

◆ indexBufferActiveIndex

IndexT Vulkan::VkShapeRenderer::indexBufferActiveIndex
private

◆ indexBufferCapacity

SizeT Vulkan::VkShapeRenderer::indexBufferCapacity
private

◆ indexBufferOffset

SizeT Vulkan::VkShapeRenderer::indexBufferOffset
private

◆ indexBufferPtr

byte* Vulkan::VkShapeRenderer::indexBufferPtr
private

◆ indexed

◆ lineWidth

IndexT Vulkan::VkShapeRenderer::lineWidth
private

◆ MaxIndexWidth

const int Vulkan::VkShapeRenderer::MaxIndexWidth = sizeof(int)
static

maximum size for an index

◆ MaxNumIndices

const int Vulkan::VkShapeRenderer::MaxNumIndices = 262140
static

maximum amount of indices to be rendered by drawprimitives and drawindexedprimitives

◆ MaxNumVertices

const int Vulkan::VkShapeRenderer::MaxNumVertices = 262140
static

maximum amount of vertices to be rendered by drawprimitives and drawindexedprimitives

◆ MaxVertexIndexBuffers

const SizeT Vulkan::VkShapeRenderer::MaxVertexIndexBuffers = 2
staticprivate

◆ MaxVertexWidth

const int Vulkan::VkShapeRenderer::MaxVertexWidth = 8 * sizeof(float)
static

maximum size for primitive size (4 floats for position, 4 floats for color)

◆ meshes

Util::FixedArray<CoreGraphics::MeshId> Vulkan::VkShapeRenderer::meshes
private

◆ model

IndexT Vulkan::VkShapeRenderer::model
private

◆ shapeMeshResources

Util::FixedArray<Resources::ResourceId> Vulkan::VkShapeRenderer::shapeMeshResources
private

◆ unindexed

◆ vbos

CoreGraphics::BufferId Vulkan::VkShapeRenderer::vbos[MaxVertexIndexBuffers]
private

◆ vertexBufferActiveIndex

IndexT Vulkan::VkShapeRenderer::vertexBufferActiveIndex
private

◆ vertexBufferCapacity

SizeT Vulkan::VkShapeRenderer::vertexBufferCapacity
private

◆ vertexBufferOffset

SizeT Vulkan::VkShapeRenderer::vertexBufferOffset
private

◆ vertexBufferPtr

byte* Vulkan::VkShapeRenderer::vertexBufferPtr
private

◆ vertexLayout

CoreGraphics::VertexLayoutId Vulkan::VkShapeRenderer::vertexLayout
private

The documentation for this class was generated from the following files: