ChuGL geometries for assigning vertex data such as positions, normals, UV coordinates, and tangents to a GMesh.
Geometry component. Can contain vertex attribute data, indices data, and pulled vertex buffers.
Geometry()
Default constructor for Geometry.
void indices(int[] indices)
Set the indices for a geometry.
int[] indices()
Get the indices for a geometry.
void normals(vec3[] normals)
Set the normals for a geometry. Equivalent to vertexAttribute(1, 3, normals)
vec3[] normals()
Get the normals for a geometry. Equivalent to getVertexAttributeData(1)
void positions(vec3[] positions)
Set the positions for a geometry. Equivalent to vertexAttribute(0, 3, positions)
vec3[] positions()
Get the positions for a geometry. Equivalent to getVertexAttributeData(0)
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 uvs(vec2[] uvs)
Set the UVs for a geometry. Equivalent to vertexAttribute(2, 2, uvs)
vec2[] uvs()
Get the UVs for a geometry. Equivalent to getVertexAttributeData(2)
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, vec2[] attributeData)
Set the vertex attribute data for a geometry. location must be between 0 and AttributeLocation_Max. Assumes attribute has 2 float components.
void vertexAttribute(int location, vec3[] attributeData)
Set the vertex attribute data for a geometry. location must be between 0 and AttributeLocation_Max. Assumes attribute has 3 float components.
void vertexAttribute(int location, vec4[] attributeData)
Set the vertex attribute data for a geometry. location must be between 0 and AttributeLocation_Max. Assumes attribute has 4 float components.
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.
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.
int[] vertexAttributeNumComponents()
Get the component count for all vertex attributes on this geometry.
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.
int AttributeLocation_Count
Maximum number of vertex attributes.
int AttributeLocation_Normal
Normal attribute location used by builtin renderer.
int AttributeLocation_Position
Position attribute location used by builtin renderer.
int AttributeLocation_UV
UV attribute location used by builtin renderer.
[ top ]
No description available
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.
void build(float width, float height, float depth, int widthSegments, int heightSegments, int depthSegments)
Rebuild box dimensions and subdivisions.
float depth()
Get the box depth.
int depthSegments()
Get the number of segments along the depth.
float height()
Get the box height.
int heightSegments()
Get the number of segments along the height.
float width()
Get the box width.
int widthSegments()
Get the number of segments along the width.
[ top ]
No description available
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.
void build(float radius, int widthSeg, int heightSeg, float phiStart, float phiLength, float thetaStart, float thetaLength)
Set sphere dimensions and subdivisions.
int heightSegments()
Get the number of segments along the height.
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.
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.
int widthSegments()
Get the number of segments along the width.
[ top ]
No description available
CircleGeometry()
Default constructor for CircleGeometry.
CircleGeometry(float radius, int segments, float thetaStart, float thetaLength)
No description available
void build(float radius, int segments, float thetaStart, float thetaLength)
No description available
float radius()
Get the circle radius.
int segments()
Get the number of segments.
float thetaLength()
Get the length of the circle.
float thetaStart()
Get the starting angle of the circle.
[ top ]
No description available
PlaneGeometry()
Default constructor for PlaneGeometry.
PlaneGeometry(float width, float height, int widthSegments, int heightSegments)
Set plane dimensions and subdivisions.
void build(float width, float height, int widthSegments, int heightSegments)
Set plane dimensions and subdivisions.
float height()
Get the plane height.
int heightSegments()
Get the number of segments along the height.
float width()
Get the plane width.
int widthSegments()
Get the number of segments along the width.
[ top ]
No description available
TorusGeometry()
Default constructor for TorusGeometry.
TorusGeometry(float radius, float tubeRadius, int radialSegments, int tubularSegments, float arcLength)
No description available
float arcLength()
Get the arc length.
void build(float radius, float tubeRadius, int radialSegments, int tubularSegments, float arcLength)
No description available
int radialSegments()
Get the number of radial segments.
float radius()
Get the torus radius.
float tubeRadius()
Get the torus tube radius.
int tubularSegments()
Get the number of tubular segments.
[ top ]
No description available
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
void build(float radiusTop, float radiusBottom, float height, int radialSegments, int heightSegments, int openEnded, float thetaStart, float thetaLength)
No description available
float height()
Get the cylinder height.
int heightSegments()
Get the number of height segments.
int openEnded()
Get the cylinder open ended flag.
int radialSegments()
Get the number of radial segments.
float radiusBottom()
Get the cylinder bottom radius.
float radiusTop()
Get the cylinder top radius.
float thetaLength()
Get the length of the cylinder.
float thetaStart()
Get the starting angle of the cylinder.
[ top ]
No description available
KnotGeometry()
Default constructor for KnotGeometry.
KnotGeometry(float radius, float tube, int tubularSegments, int radialSegments, int p, int q)
No description available
void build(float radius, float tube, int tubularSegments, int radialSegments, int p, int q)
No description available
int p()
Get the knot p value.
int q()
Get the knot q value.
int radialSegments()
Get the number of radial segments.
float radius()
Get the knot radius.
float tube()
Get the knot tube radius.
int tubularSegments()
Get the number of tubular segments.
[ top ]
Blender Suzanne monkey head.
SuzanneGeometry()
Default constructor for SuzanneGeometry.
[ top ]
Geometry for GLines. You probably don't need to create this directly.
LinesGeometry()
Default constructor for LinesGeometry.
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.
void linePositions(vec2[] points)
Set the line positions. Z values are fixed to 0.0.
[ top ]
ChuGL port of the earcut triangulation library: https://github.com/mapbox/earcut.hpp Supports arbitrary polygons with holes.
PolygonGeometry()
Default constructor for PolygonGeometry.
void build(vec2[] points)
Construct a polygon from the given points. The points are automatically closed.
void build(vec2[] points, vec2[] holes, int[] hole_counts)
Construct a polygon (with holes) from the given points and holes. `points` forms the closed shape. Any winding order is supported. The points and holes are automatically closed. `hole_counts` specifies the number of points in each hole. E.g. build([@(0,0), @(1,0), @(1,1), @(0,1)], [@(0.25,0.25), @(0.5, 0.75), @(0.75, 0.25)], [3]) will create a square with a triangular hole in the center.
[ top ]