class ShapeMeshes3D

Helper class for easily creating common 3D shapes.

Public

Methods

staticWireAaBox

static void WireAaBox(const AABox &box, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing an outline of axis aligned box.

box
Axis aligned box to create the mesh data for
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticSolidAaBox

static void SolidAaBox(const AABox &box, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing a solid axis aligned box.

box
Axis aligned box to create the mesh data for
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticWireSphere

static void WireSphere(const Sphere &sphere, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing an outline of a sphere.

sphere
Sphere to get the mesh data for
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the sphere will have. Higher level means higher quality but also more vertices and primitives.

staticWireHemisphere

static void WireHemisphere(const Sphere &sphere, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing an outline of a hemisphere.

sphere
Sphere to get the mesh data for
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the sphere will have. Higher level means higher quality but also more vertices and primitives.

staticSolidSphere

static void SolidSphere(const Sphere &sphere, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 1)

Fills the mesh data with vertices representing a sphere.

sphere
Sphere to get the mesh data for
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the sphere will have. Higher level means higher quality but also more vertices and primitives.

staticWireArc

static void WireArc(const Vector3 &center, float radius, const Vector3 &normal, Degree startAngle, Degree amountAngle, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing an outline of an arc.

center
Center of the arc to generate geometry for.
radius
Radius of the arc to generate geometry for.
normal
Normal around which the arc is generated. Arc geometry will be perpendicular to the normal.
startAngle
Angle at which the arc starts.
amountAngle
Angle that the arc spans.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the arc will have. Higher level means higher quality but also more vertices and primitives.

staticSolidArc

static void SolidArc(const Vector3 &center, float radius, const Vector3 &normal, Degree startAngle, Degree amountAngle, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing a solid double-sided arc.

center
Center of the arc to generate geometry for.
radius
Radius of the arc to generate geometry for.
normal
Normal around which the arc is generated. Arc geometry will be perpendicular to the normal.
startAngle
Angle at which the arc starts.
amountAngle
Angle that the arc spans.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the arc will have. Higher level means higher quality but also more vertices and primitives.

staticWireDisc

static void WireDisc(const Vector3 &center, float radius, const Vector3 &normal, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing an outline of a disc.

center
Center of the disc to generate geometry for.
radius
Radius of the disc to generate geometry for.
normal
Normal around which the disc is generated. Disc geometry will be perpendicular to the normal.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the disc will have. Higher level means higher quality but also more vertices and primitives.

staticSolidDisc

static void SolidDisc(const Vector3 &center, float radius, const Vector3 &normal, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing a solid double-sided disc.

center
Center of the disc to generate geometry for.
radius
Radius of the disc to generate geometry for.
normal
Normal around which the disc is generated. Disc geometry will be perpendicular to the normal.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the disc will have. Higher level means higher quality but also more vertices and primitives.

staticWireFrustum

static void WireFrustum(const Vector3 &position, float aspect, Degree FOV, float near, float far, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing an outline of an camera frustum.

Frustum will be facing -z and be positioned at world origin.

position
Starting point for the frustum.
aspect
Aspect ratio (width / height).
FOV
Horizontal field of view angle.
near
Distance to near clipping plane.
far
Distance to far clipping plane.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticWireCone

static void WireCone(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing a wireframe cone.

base
World position of the cone base.
normal
Direction of the pointed part of the cone.
height
Cone height (distance from base to the top).
radius
Cone radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cones.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cone will have. Higher level means higher quality but also more vertices and primitives.

staticSolidCone

static void SolidCone(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing a solid cone.

base
World position of the cone base.
normal
Direction of the pointed part of the cone.
height
Cone height (distance from base to the top).
radius
Cone radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cones.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cone will have. Higher level means higher quality but also more vertices and primitives.

staticWireCylinder

static void WireCylinder(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing a wireframe cylinder.

base
World position of the cylinder base.
normal
Orientation of the cylinder (height gets applied in this direction).
height
Cylinder height (distance from base to the top).
radius
Cylinder radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cylinders.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cylinder will have. Higher level means higher quality but also more vertices and primitives.

staticSolidCylinder

static void SolidCylinder(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset, u32 quality = 10)

Fills the mesh data with vertices representing a solid cylinder.

base
World position of the cylinder base.
normal
Orientation of the cylinder (height gets applied in this direction).
height
Cylinder height (distance from base to the top).
radius
Cylinder radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cylinders.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cylinder will have. Higher level means higher quality but also more vertices and primitives.

staticSolidQuad

static void SolidQuad(const Rect3 &area, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing a quad (4 triangles, two sided).

area
Area in which to draw the quad.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticPixelLine

static void PixelLine(const Vector3 &a, const Vector3 &b, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing a per-pixel line.

a
Start point of the line.
b
End point of the line.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticAntialiasedLine

static void AntialiasedLine(const Vector3 &a, const Vector3 &b, const Vector3 &up, float width, float borderWidth, const Color &color, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing an anti-aliased line of specific width.

Antialiasing is done using alpha blending.

a
Start point of the line.
b
End point of the line.
up
Up direction to which the line will run perpendicular to.
width
Width of the line.
borderWidth
Width of the anti-aliased border.
color
Color of the line.
meshData
Mesh data that will be populated by this method.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticPixelLineList

static void PixelLineList(const Vector<Vector3> &linePoints, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing per-pixel lines.

linePoints
A list of start and end points for the lines. Must be a multiple of 2.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticAntialiasedLineList

static void AntialiasedLineList(const Vector<Vector3> &linePoints, const Vector3 &up, float width, float borderWidth, const Color &color, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing anti-aliased lines of specific width.

Antialiasing is done using alpha blending.

linePoints
A list of start and end points for the lines. Must be a multiple of 2.
up
Up direction to which the line will run perpendicular to.
width
Width of the line.
borderWidth
Width of the anti-aliased border.
color
Color of the line.
meshData
Mesh data that will be populated by this method.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticWireAaBox

static void WireAaBox(const AABox &box, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with position and index data representing an outline of an axis aligned box.

Use getNumElementsWireAABox() to determine the required sizes of the output buffers.

box
Box to create geometry for.
outVertices
Pre-allocated output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes.
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticSolidAaBox

static void SolidAaBox(const AABox &box, u8 *outVertices, u8 *outNormals, u8 *outUV, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with position and index data representing a solid axis aligned box.

Use getNumElementsAABox() to determine the required sizes of the output buffers.

box
Box to create geometry for.
outVertices
Pre-allocated output buffer that will store the vertex position data.
outNormals
Pre-allocated output buffer that will store the vertex normal data.
outUV
Pre-allocated output buffer that will store the vertex UV data. Set to null if not required.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticSolidSphere

static void SolidSphere(const Sphere &sphere, u8 *outVertices, u8 *outNormals, u8 *outUV, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset, u32 quality)

Fills the provided buffers with position and index data representing a sphere.

Use getNumElementsSphere() to determine the required sizes of the output buffers.

sphere
Sphere to create geometry for.
outVertices
Pre-allocated output buffer that will store the vertex position data.
outNormals
Pre-allocated output buffer that will store the vertex normal data. Can be null if normals aren't needed.
outUV
Pre-allocated output buffer that will store the vertex UV data. Set to null if not required.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the sphere will have. Higher level means higher quality but also more vertices and primitives.

staticWireArc

static void WireArc(const Vector3 &center, float radius, const Vector3 &normal, Degree startAngle, Degree amountAngle, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset, u32 quality)

Fills the provided buffers with position and index data representing an outline of an arc.

Use getNumElementWiresArc() to determine the required sizes of the output buffers.

center
Center of the arc to generate geometry for.
radius
Radius of the arc to generate geometry for.
normal
Normal around which the arc is generated. Arc geometry will be perpendicular to the normal.
startAngle
Angle at which the arc starts.
amountAngle
Angle that the arc spans.
outVertices
Pre-allocated output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes.
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the arc will have. Higher level means higher quality but also more vertices and primitives.

staticSolidArc

static void SolidArc(const Vector3 &center, float radius, const Vector3 &normal, Degree startAngle, Degree amountAngle, u8 *outVertices, u8 *outNormals, u8 *outUV, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset, u32 quality)

Fills the provided buffers with position and index data representing a solid arc.

Use getNumElementsArc() to determine the required sizes of the output buffers.

center
Center of the arc to generate geometry for.
radius
Radius of the arc to generate geometry for.
normal
Normal around which the arc is generated. Arc geometry will be perpendicular to the normal.
startAngle
Angle at which the arc starts.
amountAngle
Angle that the arc spans.
outVertices
Pre-allocated output buffer that will store the vertex position data.
outNormals
Pre-allocated output buffer that will store the vertex normal data.
outUV
Pre-allocated output buffer that will store the vertex UV data. Set to null if not required.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the arc will have. Higher level means higher quality but also more vertices and primitives.

staticWireFrustum

static void WireFrustum(const Vector3 &position, float aspect, Degree FOV, float near, float far, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with position and index data representing an outline of a camera frustum.

Use getNumElementsFrustum() to determine the required sizes of the output buffers.

position
Starting point for the frustum.
aspect
Aspect ratio (width / height).
FOV
Horizontal field of view angle.
near
Distance to near clipping plane.
far
Distance to far clipping plane.
outVertices
Pre-allocated output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes.
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticSolidCone

static void SolidCone(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, u8 *outVertices, u8 *outNormals, u8 *outUV, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset, u32 quality)

Fills the provided buffers with position and index data representing a solid cone.

Use getNumElementsCone() to determine the required sizes of the output buffers.

base
World position of the cone base.
normal
Direction of the pointed part of the cone.
height
Cone height (distance from base to the top).
radius
Cone radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cones.
outVertices
Pre-allocated output buffer that will store the vertex position data.
outNormals
Pre-allocated output buffer that will store the vertex normal data. Can be null if normals aren't needed.
outUV
Pre-allocated output buffer that will store the vertex UV data. Set to null if not required.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cone will have. Higher level means higher quality but also more vertices and primitives.

staticWireCone

static void WireCone(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset, u32 quality)

Fills the provided buffers with position and index data representing a wire cone.

Use getNumElementsWireCone() to determine the required sizes of the output buffers.

base
World position of the cone base.
normal
Direction of the pointed part of the cone.
height
Cone height (distance from base to the top).
radius
Cone radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cones.
outVertices
Pre-allocated output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cone will have. Higher level means higher quality but also more vertices and primitives.

staticSolidCylinder

static void SolidCylinder(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, u8 *outVertices, u8 *outNormals, u8 *outUV, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset, u32 quality)

Fills the provided buffers with position and index data representing a solid cylinder.

Use getNumElementsCylinder() to determine the required sizes of the output buffers.

base
World position of the cylinder base.
normal
Orientation of the cylinder (height gets applied in this direction).
height
Cylinder height (distance from base to the top).
radius
Cylinder radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cylinders.
outVertices
Pre-allocated output buffer that will store the vertex position data.
outNormals
Pre-allocated output buffer that will store the vertex normal data. Can be null if normals aren't needed.
outUV
Pre-allocated output buffer that will store the vertex UV data. Set to null if not required.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cylinder will have. Higher level means higher quality but also more vertices and primitives.

staticWireCylinder

static void WireCylinder(const Vector3 &base, const Vector3 &normal, float height, float radius, Vector2 scale, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset, u32 quality)

Fills the provided buffers with position and index data representing a wire cylinder.

Use getNumElementsWireCylinder() to determine the required sizes of the output buffers.

base
World position of the cylinder base.
normal
Orientation of the cylinder (height gets applied in this direction).
height
Cylinder height (distance from base to the top).
radius
Cylinder radius (distance from base center to outer edge).
scale
Scale to apply to the x/y axes, allowing you to create elliptical cylinders.
outVertices
Pre-allocated output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.
quality
Represents the level of tessellation the cylinder will have. Higher level means higher quality but also more vertices and primitives.

staticSolidQuad

static void SolidQuad(const Rect3 &area, u8 *outVertices, u8 *outNormals, u8 *outUV, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with position and index data representing a solid quad.

Use getNumElementsQuad() to determine the required sizes of the output buffers.

area
Area covered by the quad.
outVertices
Pre-allocated output buffer that will store the vertex position data.
outNormals
Pre-allocated output buffer that will store the vertex normal data.
outUV
Pre-allocated output buffer that will store the vertex UV data. Set to null if not required.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and normal buffer)
outIndices
Pre-allocated output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticGetNumElementsAaBox

static void GetNumElementsAaBox(u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a solid axis aligned box.

staticGetNumElementsWireAaBox

static void GetNumElementsWireAaBox(u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a wireframe axis aligned box.

staticGetNumElementsSphere

static void GetNumElementsSphere(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a solid sphere of the specified quality.

staticGetNumElementsWireSphere

static void GetNumElementsWireSphere(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a wire sphere of the specified quality.

staticGetNumElementsWireHemisphere

static void GetNumElementsWireHemisphere(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a wire hemisphere of the specified quality.

staticGetNumElementsArc

static void GetNumElementsArc(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a solid arc of the specified quality.

staticGetNumElementsWireArc

static void GetNumElementsWireArc(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a wire arc of the specified quality.

staticGetNumElementsDisc

static void GetNumElementsDisc(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a solid desc of the specified quality.

staticGetNumElementsWireDisc

static void GetNumElementsWireDisc(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a wire disc of the specified quality.

staticGetNumElementsCone

static void GetNumElementsCone(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a solid cone of the specified quality.

staticGetNumElementsWireCone

static void GetNumElementsWireCone(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a wireframe cone of the specified quality.

staticGetNumElementsCylinder

static void GetNumElementsCylinder(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a solid cylinder of the specified quality.

staticGetNumElementsWireCylinder

static void GetNumElementsWireCylinder(u32 quality, u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a wireframe cylinder of the specified quality.

staticGetNumElementsFrustum

static void GetNumElementsFrustum(u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a frustum.

staticGetNumElementsQuad

static void GetNumElementsQuad(u32 &numVertices, u32 &numIndices)

Calculates number of vertices and indices required for geometry of a quadrirateral.

Protected

Methods

staticPixelLine

static void PixelLine(const Vector3 &a, const Vector3 &b, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with vertices representing a per-pixel line.

a
Start point of the line.
b
End point of the line.
outVertices
Output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)
outIndices
Output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticAntialiasedLine

static void AntialiasedLine(const Vector3 &a, const Vector3 &b, const Vector3 &up, float width, float borderWidth, const Color &color, u8 *outVertices, u8 *outColors, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with vertices representing an antialiased line with a custom width.

a
Start point of the line.
b
End point of the line.
up
Up direction to which the line will run perpendicular to.
width
Width of the line.
borderWidth
Width of the anti-aliased border.
color
Color of the line.
outVertices
Output buffer that will store the vertex position data.
outColors
Output buffer that will store the vertex color data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)
outIndices
Output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticPixelSolidPolygon

static void PixelSolidPolygon(const Vector<Vector3> &points, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with position data and indices representing an inner area of a polygon (basically a normal non-antialiased polygon).

points
Points defining the polygon. First point is assumed to be the start and end point.
outVertices
Output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)
outIndices
Output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticPixelWirePolygon

static void PixelWirePolygon(const Vector<Vector3> &points, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with vertices representing a pixel-wide polygon border.

points
Points defining the polygon. First point is assumed to be the start and end point.
outVertices
Output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)
outIndices
Output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticAntialiasedPolygon

static void AntialiasedPolygon(const Vector<Vector3> &points, const Vector3 &up, float borderWidth, const Color &color, u8 *outVertices, u8 *outColors, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with vertices representing an antialiased polygon.

points
Points defining the polygon. First point is assumed to be the start and end point.
up
Up direction to which the polygon will run perpendicular to.
borderWidth
Width of the anti-aliased border.
color
Color of the polygon.
outVertices
Output buffer that will store the vertex position data.
outColors
Output buffer that will store the vertex color data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)
outIndices
Output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

Private

Methods

staticCalcCenter

static Vector3 CalcCenter(u8 *vertices, u32 numVertices, u32 vertexStride)

Calculates the center of the provided vertices.

vertices
Buffer containing vertices. Vertices must be of three dimensions at least.
numVertices
Number of vertices to calculate the center for.
vertexStride
Number of bytes between two vertices in the buffer.

Returns: Center point of the vertices.

staticSubdivideTriangleOnSphere

static u32 SubdivideTriangleOnSphere(const Vector3 &center, float radius, u32 numLevels, const Vector3 &a, const Vector3 &b, const Vector3 &c, u8 *outVertices, u8 *outNormals, u32 vertexOffset, u32 vertexStride)

Subdivides the provided triangle so it approximates a curved surface of a sphere.

center
Center of the sphere to approximate.
radius
Radius of the sphere to approximate.
numLevels
Number of times to subdivide the triangle. Higher number means better approximation.
a
First corner of the triangle. Must be normalized.
b
Second corner of the triangle. Must be normalized.
c
Third corner of the triangle. Must be normalized.
outVertices
Output buffer that will store the vertex position data.
outNormals
Output buffer that will store the vertex normal data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)

Returns: Number of vertices generated (3 * (4 ^ numLevels)).

staticGenerateArcVertices

static void GenerateArcVertices(const Vector3 &center, const Vector3 &up, float radius, Degree startAngle, Degree angleAmount, Vector2 scale, u32 numVertices, u8 *outVertices, u32 vertexOffset, u32 vertexStride)

Generates vertices that are part of an arc approximation.

center
Determines world position of the arc.
up
Determines rotation of the arc. Arc vertices will be perpendicular to this direction.
radius
Distance of arc vertices from the center.
startAngle
Angle in degrees to start the arc at.
angleAmount
Angle in degrees to extend the arc from the start angle.
scale
Scale to apply to the x/y axes, allowing you to create elliptical arcs.
numVertices
Number of vertices to generate for the arc. Higher number means better arc approximation. Must be 2 or higher.
outVertices
Output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)

staticGenerateTangents

static void GenerateTangents(u8 *positions, u8 *normals, u8 *uv, u32 *indices, u32 numVertices, u32 numIndices, u32 vertexOffset, u32 indexOffset, u32 vertexStride, u8 *tangents)

Calculates per-vertex tangents and bitangents based on the provided vertices, uv coordinates and indices.

positions
Pointer to an array of vertex positions.
normals
Pointer to an array of vertex normals.
uv
Pointer to an array of vertex UV coordinates.
indices
Set of 32-bit indices containing indexes into vertex array for each triangle.
numVertices
Number of vertices in the , and arrays.
numIndices
Number of indices in the array. Must be a multiple of three.
vertexOffset
Offset in number of vertices from the start of the buffers to start reading/writing.
indexOffset
Offset in number of indices from the start of the buffer to start reading from.
vertexStride
Number of bytes to advance the , and arrays with each vertex. If set to zero them each array is advanced according to its own size.
tangents
Pre-allocated buffer that will contain the calculated tangents & bitangents packed into 4D vector where first three components are the tangent, and 4th is the sign of the bitangent. Must be the same length as the vertex array.