5#include <QtQuick3DRuntimeRender/private/qssgrendergeometry_p.h>
98 if (m_horLines ==
count)
109 if (m_vertLines ==
count)
119 step =
qMax(step, 0.0f);
130 step =
qMax(step, 0.0f);
140 int vertLines,
float vertStep)
142 const int size = (horLines + vertLines) *
sizeof(
float) * 8 * 2;
144 float *dataPtr =
reinterpret_cast<float *
>(vertexData.
data());
146 float y0 = -float(horLines - 1) * horStep * .5f;
147 float x0 = -float(vertLines - 1) * vertStep * .5f;
151 for (
int i = 0;
i < horLines; ++
i) {
154 dataPtr[1] =
y0 +
i * horStep;
167 dataPtr[1] =
y0 +
i * horStep;
179 for (
int i = 0;
i < vertLines; ++
i) {
181 dataPtr[0] =
x0 +
i * vertStep;
194 dataPtr[0] =
x0 +
i * vertStep;
208void GridGeometry::updateData()
220 setBounds(
QVector3D(
float(-m_vertLines / 2),
float(-m_horLines / 2), 0.0f) * m_horStep,
221 QVector3D(
float(m_vertLines / 2),
float(m_horLines / 2), 0.0f) * m_vertStep);
GridGeometry()
\qmltype GridGeometry \inqmlmodule QtQuick3D.Helpers \inherits Geometry
void setVerticalStep(float step)
void setVerticalLines(int count)
void verticalLinesChanged()
void horizontalLinesChanged()
void horizontalStepChanged()
void verticalStepChanged()
void setHorizontalLines(int count)
void setHorizontalStep(float step)
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
\qmltype Geometry \inherits Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DGeometry
void setPrimitiveType(PrimitiveType type)
Sets the primitive type used for rendering to type.
void setStride(int stride)
Sets the stride of the vertex buffer to stride, measured in bytes.
void addAttribute(Attribute::Semantic semantic, int offset, Attribute::ComponentType componentType)
Adds vertex attribute description.
void setVertexData(const QByteArray &data)
Sets the vertex buffer data.
void clear()
Resets the geometry to its initial state, clearing previously set vertex and index data as well as at...
void setBounds(const QVector3D &min, const QVector3D &max)
Sets the bounding volume of the geometry to the cube defined by the points min and max.
QByteArray vertexData() const
Returns the vertex buffer data set by setVertexData.
The QVector3D class represents a vector or vertex in 3D space.
static void fillVertexData(QByteArray &vertexData, int horLines, float horStep, int vertLines, float vertStep)
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
constexpr const T & qMax(const T &a, const T &b)
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLenum GLenum GLsizei count
GLuint GLfloat GLfloat y0