20 return !m_lines.isEmpty() || !m_persistentLines.isEmpty() || !m_bounds.isEmpty() || !m_persistentBounds.isEmpty() || !m_persistentPoints.isEmpty() || !m_points.isEmpty();
28 LineData
line = {startPoint, endPoint,
color};
30 m_persistentLines.append(
line);
39 BoundsData bound = {bounds,
color};
41 m_persistentBounds.append(bound);
43 m_bounds.append(bound);
48 VertexData point = {vertex, {
color.redF(),
color.greenF(),
color.blueF()}};
50 m_persistentPoints.append(point);
52 m_points.append(point);
62 for (
const auto &
line : m_persistentLines)
63 generateLine(
line, vertexData, indexData);
64 for (
const auto &
line : m_lines)
65 generateLine(
line, vertexData, indexData);
66 for (
const auto &bounds : m_persistentBounds)
67 generateBox(bounds, vertexData, indexData);
68 for (
const auto &bounds : m_bounds)
69 generateBox(bounds, vertexData, indexData);
70 pointsData = m_persistentPoints + m_points;
77 if (m_lineVertexBuffer)
78 m_lineVertexBuffer.reset();
79 if (m_lineIndexBuffer)
80 m_lineIndexBuffer.reset();
82 m_lineVertexBuffer = std::make_shared<QSSGRhiBuffer>(*rhiCtx,
86 6 *
sizeof(
float) * vertexData.
count());
87 m_lineVertexBuffer->buffer()->setName(
QByteArrayLiteral(
"debug lines vertex buffer"));
90 m_lineIndexBuffer = std::make_shared<QSSGRhiBuffer>(*rhiCtx,
94 indexBufferData.
size(),
96 m_lineIndexBuffer->buffer()->setName(
QByteArrayLiteral(
"debug lines index buffer"));
99 m_indexSize = indexData.
count();
106 if (m_pointVertexBuffer)
107 m_pointVertexBuffer.reset();
109 m_pointVertexBuffer = std::make_shared<QSSGRhiBuffer>(*rhiCtx,
113 vertexBufferData.
size());
114 m_pointVertexBuffer->buffer()->setName(
QByteArrayLiteral(
"debug points vertex buffer"));
116 m_pointsSize = pointsData.
count();
138 if (m_indexSize > 0) {
140 cb->setGraphicsPipeline(graphicsPipeline);
141 cb->setShaderResources(srb);
146 cb->setVertexInput(0, 1, &vb, m_lineIndexBuffer->buffer(), 0, m_lineIndexBuffer->indexFormat());
147 cb->drawIndexed(m_indexSize);
151 if (m_pointsSize > 0) {
154 cb->setGraphicsPipeline(graphicsPipeline);
155 cb->setShaderResources(srb);
159 cb->setVertexInput(0, 1, &vb);
160 cb->draw(m_pointsSize);
181 const QVector3D color = {bounds.color.redF(), bounds.color.greenF(), bounds.color.blueF()};
184 for (
const QVector3D point : bounds.bounds.toQSSGBoxPoints())
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
The QColor class provides colors based on RGB, HSV or CMYK values.
const_pointer constData() const noexcept
bool isEmpty() const noexcept
qsizetype count() const noexcept
void append(parameter_type t)
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
void uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Enqueues updating a region of a QRhiBuffer buf created with the type QRhiBuffer::Immutable or QRhiBuf...
Class representing 3D range or axis aligned bounding box.
void drawLine(const QVector3D &startPoint, const QVector3D &endPoint, const QColor &color, bool isPersistent=false)
void recordRenderDebugObjects(QSSGRhiContext *rhiCtx, QSSGRhiGraphicsPipelineState *ps, QRhiShaderResourceBindings *srb, QRhiRenderPassDescriptor *rpDesc)
void drawPoint(const QVector3D &vertex, const QColor &color, bool isPersistent=false)
void prepareGeometry(QSSGRhiContext *rhiCtx, QRhiResourceUpdateBatch *rub)
void drawBounds(const QSSGBounds3 &bounds, const QColor &color, bool isPersistent=false)
QRhiCommandBuffer * commandBuffer() const
QRhiGraphicsPipeline * pipeline(const QSSGGraphicsPipelineStateKey &key, QRhiRenderPassDescriptor *rpDesc, QRhiShaderResourceBindings *srb)
The QVector3D class represents a vector or vertex in 3D space.
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
GLenum GLuint GLintptr offset
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
static QSSGGraphicsPipelineStateKey create(const QSSGRhiGraphicsPipelineState &state, const QRhiRenderPassDescriptor *rpDesc, const QRhiShaderResourceBindings *srb)
QSSGRhiInputAssemblerState ia
QRhiGraphicsPipeline::CullMode cullMode