23#ifndef VCL_BGFX_PRIMITIVES_LINES_PRIMITIVE_LINES_H
24#define VCL_BGFX_PRIMITIVES_LINES_PRIMITIVE_LINES_H
26#include <vclib/bgfx/buffers.h>
27#include <vclib/bgfx/context.h>
31namespace vcl::detail {
37 bgfx::ProgramHandle mLinesPH =
40 .getProgram<VertFragProgram::PRIMITIVE_LINES>();
42 enum Ownership { OWNED = 0, NOT_OWNED = 1 };
46 bool mOwnsBuffers =
true;
48 std::variant<VertexBuffer, const VertexBuffer*> mVertexCoords;
49 std::variant<VertexBuffer, const VertexBuffer*> mVertexNormals;
50 std::variant<VertexBuffer, const VertexBuffer*> mVertexColors;
51 std::variant<IndexBuffer, const IndexBuffer*> mLineColors;
53 std::variant<IndexBuffer, const IndexBuffer*> mIndices;
56 PrimitiveLines() =
default;
59 const std::vector<float>& vertCoords,
60 const std::vector<float>& vertNormals = std::vector<float>(),
61 const std::vector<uint>& vertColors = std::vector<uint>(),
62 const std::vector<uint>& lineColors = std::vector<uint>());
65 const std::vector<float>& vertCoords,
66 const std::vector<uint>& lineIndices,
67 const std::vector<float>& vertNormals = std::vector<float>(),
68 const std::vector<uint>& vertColors = std::vector<uint>(),
69 const std::vector<uint>& lineColors = std::vector<uint>());
72 const uint pointsSize,
73 const VertexBuffer& vertexCoords,
74 const VertexBuffer& vertexNormals = VertexBuffer(),
75 const VertexBuffer& vertexColors = VertexBuffer(),
76 const IndexBuffer& lineColors = IndexBuffer());
79 const uint pointsSize,
80 const VertexBuffer& vertexCoords,
81 const IndexBuffer& lineIndices,
82 const VertexBuffer& vertexNormals = VertexBuffer(),
83 const VertexBuffer& vertexColors = VertexBuffer(),
84 const IndexBuffer& lineColors = IndexBuffer());
86 void swap(PrimitiveLines& other);
88 friend void swap(PrimitiveLines& a, PrimitiveLines& b) { a.swap(b); }
91 const std::vector<float>& vertCoords,
92 const std::vector<float>& vertNormals,
93 const std::vector<uint>& vertColors,
94 const std::vector<uint>& lineColors);
97 const std::vector<float>& vertCoords,
98 const std::vector<uint>& lineIndices,
99 const std::vector<float>& vertNormals,
100 const std::vector<uint>& vertColors,
101 const std::vector<uint>& lineColors);
104 const uint pointsSize,
105 const VertexBuffer& vertexCoords,
106 const VertexBuffer& vertexNormals = VertexBuffer(),
107 const VertexBuffer& vertexColors = VertexBuffer(),
108 const IndexBuffer& lineColors = IndexBuffer());
111 const uint pointsSize,
112 const VertexBuffer& vertexCoords,
113 const IndexBuffer& lineIndices,
114 const VertexBuffer& vertexNormals = VertexBuffer(),
115 const VertexBuffer& vertexColors = VertexBuffer(),
116 const IndexBuffer& lineColors = IndexBuffer());
118 void draw(uint viewId)
const;
121 void reinitBuffers(Ownership owned);
125 const std::vector<float>& vertCoords,
126 const std::vector<uint>& lineIndices,
127 const std::vector<float>& vertNormals,
128 const std::vector<uint>& vertColors,
129 const std::vector<uint>& lineColors);
static Context & instance(void *windowHandle=nullptr, void *displayHandle=nullptr)
Return the context instance.
Definition context.cpp:371