Skip to content

Class Qf3DGeometryUtils

ClassList > Qf3DGeometryUtils

More...

  • #include <qf3dgeometryutils.h>

Public Static Attributes

Type Name
constexpr int VERTEX_STRIDE = 10 \* sizeof( float )
Byte stride of a single vertex: position(3) + normal(3) + rgba(4) = 10 floats.

Public Static Functions

Type Name
void generatePolygonFill (const QVector< QVector3D > & vertices, float r, float g, float b, float a, float *& vptr, quint32 *& iptr, quint32 & vertexOffset, QVector3D & minBound, QVector3D & maxBound, float extrusion=0.0f)
void generatePolygonWalls (const QVector< QVector3D > & vertices, float extrusion, float r, float g, float b, float a, float *& vptr, quint32 *& iptr, quint32 & vertexOffset, QVector3D & minBound, QVector3D & maxBound)
void generateSphere (const QVector3D & center, float radius, int stacks, int slices, float r, float g, float b, float a, float *& vptr, quint32 *& iptr, quint32 & vertexOffset, QVector3D & minBound, QVector3D & maxBound)
Generates a UV sphere centered at center .
void generateTube (const QVector< QVector3D > & path, int segments, float radius, float r, float g, float b, float a, float *& vptr, quint32 *& iptr, quint32 & vertexOffset, QVector3D & minBound, QVector3D & maxBound)
Extrudes a circular tube of segments sides and given__radius along__path .
int polygonWallsIndexCount (int ringSize)
Returns the number of indices produced by generatePolygonWalls() for a ring with__ringSize unique vertices.
int polygonWallsVertexCount (int ringSize)
Returns the number of vertices produced by generatePolygonWalls() for a ring with__ringSize unique vertices.
int sphereIndexCount (int stacks, int slices)
Returns the number of indices produced by generateSphere() for the given subdivisions.
int sphereVertexCount (int stacks, int slices)
Returns the number of vertices produced by generateSphere() for the given subdivisions.
void updateBounds (QVector3D & minBound, QVector3D & maxBound, const QVector3D & pos)
Expands minBound /__maxBound to include__pos .
void writeVertex (float *& vptr, const QVector3D & pos, const QVector3D & normal, float r, float g, float b, float a)
Writes a single vertex (position + normal + rgba) to vptr and advances the pointer.

Detailed Description

Mesh-building helpers shared between the rubberband and feature highlight geometries. Each helper appends to a raw vertex/index buffer using a fixed 10-float vertex layout: position(3) + normal(3) + rgba(4).

Public Static Attributes Documentation

variable VERTEX_STRIDE

Byte stride of a single vertex: position(3) + normal(3) + rgba(4) = 10 floats.

constexpr int Qf3DGeometryUtils::VERTEX_STRIDE;


Public Static Functions Documentation

function generatePolygonFill

static void Qf3DGeometryUtils::generatePolygonFill (
    const QVector< QVector3D > & vertices,
    float r,
    float g,
    float b,
    float a,
    float *& vptr,
    quint32 *& iptr,
    quint32 & vertexOffset,
    QVector3D & minBound,
    QVector3D & maxBound,
    float extrusion=0.0f
) 

Triangulates a closed polygon ring on the XZ plane with ear clipping and appends the resulting triangle fan to the buffer. Falls back to a simple fan from vertex 0 when ear clipping cannot make further progress (which keeps degenerate or self-touching rings from leaving uninitialised indices in the buffer).

When extrusion is non-zero every fill vertex is shifted upward by that amount so the fill becomes a roof cap on top of extruded walls.


function generatePolygonWalls

static void Qf3DGeometryUtils::generatePolygonWalls (
    const QVector< QVector3D > & vertices,
    float extrusion,
    float r,
    float g,
    float b,
    float a,
    float *& vptr,
    quint32 *& iptr,
    quint32 & vertexOffset,
    QVector3D & minBound,
    QVector3D & maxBound
) 

Generates vertical wall quads for each edge of a closed polygon ring, extruding from the base vertices upward by extrusion scene units. Each edge produces 4 vertices and 2 triangles (6 indices).


function generateSphere

Generates a UV sphere centered at center .

static void Qf3DGeometryUtils::generateSphere (
    const QVector3D & center,
    float radius,
    int stacks,
    int slices,
    float r,
    float g,
    float b,
    float a,
    float *& vptr,
    quint32 *& iptr,
    quint32 & vertexOffset,
    QVector3D & minBound,
    QVector3D & maxBound
) 


function generateTube

Extrudes a circular tube of segments sides and given__radius along__path .

static void Qf3DGeometryUtils::generateTube (
    const QVector< QVector3D > & path,
    int segments,
    float radius,
    float r,
    float g,
    float b,
    float a,
    float *& vptr,
    quint32 *& iptr,
    quint32 & vertexOffset,
    QVector3D & minBound,
    QVector3D & maxBound
) 


function polygonWallsIndexCount

Returns the number of indices produced by generatePolygonWalls() for a ring with__ringSize unique vertices.

static inline int Qf3DGeometryUtils::polygonWallsIndexCount (
    int ringSize
) 


function polygonWallsVertexCount

Returns the number of vertices produced by generatePolygonWalls() for a ring with__ringSize unique vertices.

static inline int Qf3DGeometryUtils::polygonWallsVertexCount (
    int ringSize
) 


function sphereIndexCount

Returns the number of indices produced by generateSphere() for the given subdivisions.

static int Qf3DGeometryUtils::sphereIndexCount (
    int stacks,
    int slices
) 


function sphereVertexCount

Returns the number of vertices produced by generateSphere() for the given subdivisions.

static int Qf3DGeometryUtils::sphereVertexCount (
    int stacks,
    int slices
) 


function updateBounds

Expands minBound /__maxBound to include__pos .

static void Qf3DGeometryUtils::updateBounds (
    QVector3D & minBound,
    QVector3D & maxBound,
    const QVector3D & pos
) 


function writeVertex

Writes a single vertex (position + normal + rgba) to vptr and advances the pointer.

static void Qf3DGeometryUtils::writeVertex (
    float *& vptr,
    const QVector3D & pos,
    const QVector3D & normal,
    float r,
    float g,
    float b,
    float a
) 



The documentation for this class was generated from the following file src/3d/qf3dgeometryutils.h