Nebula
Loading...
Searching...
No Matches
vkshaperenderer.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
12#include "util/fixedarray.h"
13#include "frame/framecode.h"
14
15namespace Vulkan
16{
18{
20public:
24 virtual ~VkShapeRenderer();
25
27 void Open();
29 void Close();
30
32 void DrawShapes(const CoreGraphics::CmdBufferId cmdBuf);
33
35 static const int MaxNumVertices = 262140;
37 static const int MaxNumIndices = 262140;
38
40 static const int MaxVertexWidth = 8 * sizeof(float);
42 static const int MaxIndexWidth = sizeof(int);
43private:
44
49
51 void GrowIndexBuffer();
53 void GrowVertexBuffer();
54
56 void DrawSimpleShape(const CoreGraphics::CmdBufferId cmdBuf, const Math::mat4& modelTransform, CoreGraphics::RenderShape::Type shapeType, const Math::vec4& color, const float lineThickness);
58 void DrawMesh(const CoreGraphics::CmdBufferId cmdBuf, const Math::mat4& modelTransform, const CoreGraphics::MeshId mesh, const Math::vec4& color, const float lineThickness);
60 void DrawPrimitives(const Math::mat4& modelTransform, CoreGraphics::PrimitiveTopology::Code topology, SizeT numVertices, const void* vertices, const float lineThickness);
62 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);
63
66
68 static const SizeT MaxVertexIndexBuffers = 2;
77
82
85
95
103};
104} // namespace Vulkan
Base class of ShapeRenderer, can render a number of shapes, mainly for debug visualization.
Definition shaperendererbase.h:30
void DrawShapes()
draw deferred shapes and clear deferred stack, must be called inside render loop
Definition shaperendererbase.cc:190
Code
index types enum
Definition indextype.h:22
Code
enumeration
Definition primitivetopology.h:23
@ NumTopologies
Definition primitivetopology.h:38
Type
shape types
Definition rendershape.h:36
Nebula's dynamic array class.
Definition array.h:60
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
Definition vkshaperenderer.h:18
byte * indexBufferPtr
Definition vkshaperenderer.h:72
Util::FixedArray< Resources::ResourceId > shapeMeshResources
Definition vkshaperenderer.h:64
IndexT lineWidth
Definition vkshaperenderer.h:81
SizeT indexBufferCapacity
Definition vkshaperenderer.h:76
SizeT vertexBufferCapacity
Definition vkshaperenderer.h:75
void DrawSimpleShape(const CoreGraphics::CmdBufferId cmdBuf, const Math::mat4 &modelTransform, CoreGraphics::RenderShape::Type shapeType, const Math::vec4 &color, const float lineThickness)
draw a shape
Definition vkshaperenderer.cc:258
static const int MaxNumIndices
maximum amount of indices to be rendered by drawprimitives and drawindexedprimitives
Definition vkshaperenderer.h:37
void Close()
close the shape renderer
Definition vkshaperenderer.cc:131
byte * vertexBufferPtr
Definition vkshaperenderer.h:71
void GrowIndexBuffer()
grow index buffer
Definition vkshaperenderer.cc:465
void DrawPrimitives(const Math::mat4 &modelTransform, CoreGraphics::PrimitiveTopology::Code topology, SizeT numVertices, const void *vertices, const float lineThickness)
draw primitives
Definition vkshaperenderer.cc:318
struct Vulkan::VkShapeRenderer::UnindexedDraws unindexed[CoreGraphics::PrimitiveTopology::NumTopologies]
static const SizeT MaxVertexIndexBuffers
Definition vkshaperenderer.h:68
IndexT diffuseColor
Definition vkshaperenderer.h:80
virtual ~VkShapeRenderer()
destructor
Definition vkshaperenderer.cc:49
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
Definition vkshaperenderer.cc:350
void DrawBufferedIndexedPrimitives(const CoreGraphics::CmdBufferId cmdBuf)
draw buffered indexed primtives
Definition vkshaperenderer.cc:427
void Open()
open the shape renderer
Definition vkshaperenderer.cc:58
static const int MaxVertexWidth
maximum size for primitive size (4 floats for position, 4 floats for color)
Definition vkshaperenderer.h:40
SizeT vertexBufferOffset
Definition vkshaperenderer.h:83
IndexT model
Definition vkshaperenderer.h:79
__DeclareClass(VkShapeRenderer)
struct Vulkan::VkShapeRenderer::IndexedDraws indexed[CoreGraphics::PrimitiveTopology::NumTopologies]
SizeT indexBufferOffset
Definition vkshaperenderer.h:84
Util::FixedArray< CoreGraphics::MeshId > meshes
Definition vkshaperenderer.h:65
void GrowVertexBuffer()
grow vertex buffer
Definition vkshaperenderer.cc:497
CoreGraphics::BufferId ibos[MaxVertexIndexBuffers]
Definition vkshaperenderer.h:69
CoreGraphics::VertexLayoutId vertexLayout
Definition vkshaperenderer.h:78
Util::Array< CoreGraphics::VertexComponent > comps
Definition vkshaperenderer.h:67
static const int MaxNumVertices
maximum amount of vertices to be rendered by drawprimitives and drawindexedprimitives
Definition vkshaperenderer.h:35
IndexT indexBufferActiveIndex
Definition vkshaperenderer.h:73
void DrawBufferedPrimitives(const CoreGraphics::CmdBufferId cmdBuf)
draw buffered primitives
Definition vkshaperenderer.cc:393
CoreGraphics::BufferId vbos[MaxVertexIndexBuffers]
Definition vkshaperenderer.h:70
VkShapeRenderer()
constructor
Definition vkshaperenderer.cc:30
IndexT vertexBufferActiveIndex
Definition vkshaperenderer.h:74
void DrawMesh(const CoreGraphics::CmdBufferId cmdBuf, const Math::mat4 &modelTransform, const CoreGraphics::MeshId mesh, const Math::vec4 &color, const float lineThickness)
draw debug mesh
Definition vkshaperenderer.cc:289
static const int MaxIndexWidth
maximum size for an index
Definition vkshaperenderer.h:42
Vulkan implementation of GPU acceleration structure.
Definition vkaccelerationstructure.cc:15
Definition buffer.h:23
Definition commandbuffer.h:155
Definition mesh.h:29
Definition vertexlayout.h:16
A 4x4 single point precision float matrix.
Definition mat4.h:49
A 4D vector.
Definition vec4.h:24
Definition vkshaperenderer.h:87
Util::Array< float > lineThicknesses
Definition vkshaperenderer.h:93
Util::Array< Math::mat4 > transforms
Definition vkshaperenderer.h:89
Util::Array< CoreGraphics::PrimitiveGroup > primitives
Definition vkshaperenderer.h:88
Util::Array< uint64 > firstIndexOffset
Definition vkshaperenderer.h:91
Util::Array< CoreGraphics::IndexType::Code > indexType
Definition vkshaperenderer.h:92
Util::Array< uint64 > firstVertexOffset
Definition vkshaperenderer.h:90
Definition vkshaperenderer.h:97
Util::Array< uint64 > firstVertexOffset
Definition vkshaperenderer.h:100
Util::Array< CoreGraphics::PrimitiveGroup > primitives
Definition vkshaperenderer.h:98
Util::Array< Math::mat4 > transforms
Definition vkshaperenderer.h:99
Util::Array< float > lineThicknesses
Definition vkshaperenderer.h:101
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48