/  ChuGL Geometries

Geometry

CubeGeometry

SphereGeometry

CircleGeometry

PlaneGeometry

TorusGeometry

CylinderGeometry

KnotGeometry

SuzanneGeometry

LinesGeometry

ChuGL geometries for assigning vertex data such as positions, normals, UV coordinates, and tangents to a GMesh.

Geometry

inherits : SG_Component : Object

Geometry component. Can contain vertex attribute data, indices data, and pulled vertex buffers.

examples

constructors

Geometry()

Default constructor for Geometry.

member functions

void vertexAttribute(int location, int numComponents, float[] attributeData)

Set the vertex attribute data for a geometry. location must be between 0 and AttributeLocation_Max.

void vertexAttribute(int location, int numComponents, int[] attributeData)

Set the vertex attribute data for a geometry. location must be between 0 and Geometry.AttributeLocation_Count.

void positions(vec3[] positions)

Set the positions for a geometry. Equivalent to vertexAttribute(0, 3, positions)

void normals(vec3[] normals)

Set the normals for a geometry. Equivalent to vertexAttribute(1, 3, normals)

void uvs(vec2[] uvs)

Set the UVs for a geometry. Equivalent to vertexAttribute(2, 2, uvs)

void tangents(vec4[] tangents)

Set the tangents for a geometry. Equivalent to vertexAttribute(3, 4, tangents)

vec3[] positions()

Get the positions for a geometry. Equivalent to getVertexAttributeData(0)

vec3[] normals()

Get the normals for a geometry. Equivalent to getVertexAttributeData(1)

vec2[] uvs()

Get the UVs for a geometry. Equivalent to getVertexAttributeData(2)

vec4[] tangents()

Get the tangents for a geometry. Equivalent to getVertexAttributeData(3)

int[] vertexAttributeNumComponents()

Get the component count for all vertex attributes on this geometry.

float[] vertexAttributeData(int location)

Get the vertex data for a vertex attribute. Default empty array.

int[] vertexAttributeDataInt(int location)

Get the vertex data for a vertex attribute. Default empty array.

void indices(int[] indices)

Set the indices for a geometry.

int[] indices()

Get the indices for a geometry.

void pulledVertexAttribute(int location, float[] data)

Set storage buffer for programmable vertex pulling. pulled attributes will be set as storage buffers bound to @group(3) in the shader. Location must be between 0-3.

void pulledVertexAttribute(int location, vec2[] data)

Set storage buffer for programmable vertex pulling. pulled attributes will be set as storage buffers bound to @group(3) in the shader. Location must be between 0-3.

void pulledVertexAttribute(int location, vec3[] data)

Set storage buffer for programmable vertex pulling. pulled attributes will be set as storage buffers bound to @group(3) in the shader. Location must be between 0-3.

void pulledVertexAttribute(int location, vec4[] data)

Set storage buffer for programmable vertex pulling. pulled attributes will be set as storage buffers bound to @group(3) in the shader. Location must be between 0-3.

void pulledVertexAttribute(int location, int[] data)

Set storage buffer for programmable vertex pulling. pulled attributes will be set as storage buffers bound to @group(3) in the shader. Location must be between 0-3.

float[] pulledVertexAttribute(int location)

Get the pulled vertex attribute data at this location. location must be between 0-3.

int[] pulledVertexAttributeInt(int location)

Get the pulled vertex attribute data at this location. location must be between 0-3.

void vertexCount(int count)

If this geometry uses vertex pulling or non-indexed drawing, Set the number of vertices to be drawn of this geometry by the rendererDefault is -1, which means all vertices are drawn. Values will be clamped to the actual number of vertices in the geometry.

void generateTangents()

Generate tangents assuming default vertex attribute locations: position=0, normal=1, uv=2, tangent=3. Tangents are written to location = 3.Indices are supported but optional. Call *after* all other attribute data and indices have been supplied.

static member variables

int AttributeLocation_Count

Maximum number of vertex attributes.

int AttributeLocation_Position

Position attribute location used by builtin renderer.

int AttributeLocation_Normal

Normal attribute location used by builtin renderer.

int AttributeLocation_UV

UV attribute location used by builtin renderer.

int AttributeLocation_Tangent

Tangent attribute location used by builtin renderer.


CubeGeometry

inherits : Geometry : SG_Component : Object

No description available

constructors

CubeGeometry()

Default constructor for CubeGeometry.

CubeGeometry(float width, float height, float depth, int widthSegments, int heightSegments, int depthSegments)

Create box with given dimensions and subdivisions.

member functions

int heightSegments()

Get the number of segments along the height.

int widthSegments()

Get the number of segments along the width.

void build(float width, float height, float depth, int widthSegments, int heightSegments, int depthSegments)

Rebuild box dimensions and subdivisions.

int depthSegments()

Get the number of segments along the depth.

float width()

Get the box width.

float height()

Get the box height.

float depth()

Get the box depth.


SphereGeometry

inherits : Geometry : SG_Component : Object

No description available

constructors

SphereGeometry()

Default constructor for SphereGeometry.

SphereGeometry(float radius, int widthSeg, int heightSeg, float phiStart, float phiLength, float thetaStart, float thetaLength)

Set sphere dimensions and subdivisions.

member functions

int heightSegments()

Get the number of segments along the height.

int widthSegments()

Get the number of segments along the width.

void build(float radius, int widthSeg, int heightSeg, float phiStart, float phiLength, float thetaStart, float thetaLength)

Set sphere dimensions and subdivisions.

float thetaLength()

Get the length of the sphere along the central diameter.

float thetaStart()

Get the starting angle of the sphere along the central diameter.

float phiLength()

Get the length of the sphere along the circumference.

float phiStart()

Get the starting angle of the sphere along the circumference.

float radius()

Get the sphere radius.


CircleGeometry

inherits : Geometry : SG_Component : Object

No description available

constructors

CircleGeometry()

Default constructor for CircleGeometry.

CircleGeometry(float radius, int segments, float thetaStart, float thetaLength)

No description available

member functions

void build(float radius, int segments, float thetaStart, float thetaLength)

No description available

float thetaLength()

Get the length of the circle.

float thetaStart()

Get the starting angle of the circle.

int segments()

Get the number of segments.

float radius()

Get the circle radius.


PlaneGeometry

inherits : Geometry : SG_Component : Object

No description available

constructors

PlaneGeometry()

Default constructor for PlaneGeometry.

PlaneGeometry(float width, float height, int widthSegments, int heightSegments)

Set plane dimensions and subdivisions.

member functions

int heightSegments()

Get the number of segments along the height.

int widthSegments()

Get the number of segments along the width.

void build(float width, float height, int widthSegments, int heightSegments)

Set plane dimensions and subdivisions.

float width()

Get the plane width.

float height()

Get the plane height.


TorusGeometry

inherits : Geometry : SG_Component : Object

No description available

constructors

TorusGeometry()

Default constructor for TorusGeometry.

TorusGeometry(float radius, float tubeRadius, int radialSegments, int tubularSegments, float arcLength)

No description available

member functions

void build(float radius, float tubeRadius, int radialSegments, int tubularSegments, float arcLength)

No description available

float arcLength()

Get the arc length.

int tubularSegments()

Get the number of tubular segments.

int radialSegments()

Get the number of radial segments.

float tubeRadius()

Get the torus tube radius.

float radius()

Get the torus radius.


CylinderGeometry

inherits : Geometry : SG_Component : Object

No description available

constructors

CylinderGeometry()

Default constructor for CylinderGeometry.

CylinderGeometry(float radiusTop, float radiusBottom, float height, int radialSegments, int heightSegments, int openEnded, float thetaStart, float thetaLength)

No description available

member functions

int heightSegments()

Get the number of height segments.

void build(float radiusTop, float radiusBottom, float height, int radialSegments, int heightSegments, int openEnded, float thetaStart, float thetaLength)

No description available

float thetaLength()

Get the length of the cylinder.

float thetaStart()

Get the starting angle of the cylinder.

int radialSegments()

Get the number of radial segments.

int openEnded()

Get the cylinder open ended flag.

float radiusBottom()

Get the cylinder bottom radius.

float radiusTop()

Get the cylinder top radius.

float height()

Get the cylinder height.


KnotGeometry

inherits : Geometry : SG_Component : Object

No description available

constructors

KnotGeometry()

Default constructor for KnotGeometry.

KnotGeometry(float radius, float tube, int tubularSegments, int radialSegments, int p, int q)

No description available

member functions

void build(float radius, float tube, int tubularSegments, int radialSegments, int p, int q)

No description available

int tubularSegments()

Get the number of tubular segments.

int radialSegments()

Get the number of radial segments.

int q()

Get the knot q value.

float tube()

Get the knot tube radius.

float radius()

Get the knot radius.

int p()

Get the knot p value.


SuzanneGeometry

inherits : Geometry : SG_Component : Object

Blender Suzanne monkey head.

constructors

SuzanneGeometry()

Default constructor for SuzanneGeometry.


LinesGeometry

inherits : Geometry : SG_Component : Object

Geometry for GLines. You probably don't need to create this directly.

constructors

LinesGeometry()

Default constructor for LinesGeometry.

member functions

void linePositions(vec2[] points)

Set the line positions. Z values are fixed to 0.0.

void lineColors(vec3[] colors)

Set the line colors. Colors between line points are interpolated. If the number of colors is less than the number of points, the vertices will cycle through the colors.