Graphics generators (GGens) that can be composed together in a scene graph.
Chugl graphics generator. Can be grucked to the scenegraph. Contains methods for transform manipulation.
GGen()
Default constructor for GGen.
GGen parent()
Get the parent of this GGen.
vec3 right()
Get the right vector of this GGen in world space.
vec3 rot()
Get object rotation in local space as euler angles in radians.
vec3 pos()
Get object position in local space.
void update(float dt)
This method is automatically invoked once per frame for all GGens connected to the scene graph.Override this method in custom GGen classes to implement your own update logic.
vec3 forward()
Get the forward vector of this GGen in world space.
vec3 up()
Get the up vector of this GGen in world space.
float posX()
Get X position of this GGen in local space.
GGen posX(float pos)
Set X position of this GGen in local space.
float posY()
Get Y position of this GGen in local space.
GGen posY(float pos)
Set Y position of this GGen in local space.
float posZ()
Get Z position of this GGen in local space.
GGen posZ(float pos)
Set Z position of this GGen in local space.
GGen pos(vec3 pos)
Set object position in local space.
vec3 posWorld()
Get object position in world space.
GGen posWorld(vec3 pos)
Set object position in world space.
GGen translate(vec3 translation)
Translate this GGen by the given vector.
GGen translateX(float amt)
Translate this GGen by given amount on the X axis in local space.
GGen translateY(float amt)
Translate this GGen by given amount on the Y axis in local space.
GGen translateZ(float amt)
Translate this GGen by given amount on the Z axis in local space.
float rotX()
Get the rotation of this GGen on the X axis in local space.
GGen rotX(float radians)
Set the rotation of this GGen on the X axis in local space to the given radians.
float rotY()
Get the rotation of this GGen on the Y axis in local space.
GGen rotY(float radians)
Set the rotation of this GGen on the Y axis in local space to the given radians.
float rotZ()
Get the rotation of this GGen on the Z axis in local space.
GGen rotZ(float radians)
Set the rotation of this GGen on the Z axis in local space to the given radians.
vec3 rot(vec3 eulers)
Set rotation of this GGen in local space as euler angles.
GGen rotate(vec3 eulers)
Rotate this GGen by the given euler angles in local space.
GGen rotateX(float radians)
Rotate this GGen by the given radians on the X axis in local space.
GGen rotateY(float radians)
Rotate this GGen by the given radians on the Y axis in local space.
GGen rotateZ(float radians)
Rotate this GGen by the given radians on the Z axis in local space.
GGen rotateOnLocalAxis(vec3 axis, float radians)
Rotate this GGen by the given radians on the given axis in local space.
GGen rotateOnWorldAxis(vec3 axis, float radians)
Rotate this GGen by the given radians on the given axis in world space.
GGen lookAt(vec3 pos)
Look at the given position in world space.
float scaX()
Get X scale of this GGen in local space.
GGen scaX(float scale)
Set X scale of this GGen in local space.
float scaY()
Get Y scale of this GGen in local space.
GGen scaY(float scale)
Set Y scale of this GGen in local space.
float scaZ()
Get Z scale of this GGen in local space.
GGen scaZ(float scale)
Set Z scale of this GGen in local space.
vec3 sca()
Get object scale in local space.
GGen sca(vec3 scale)
Set object scale in local space.
GGen sca(float scale)
Set object scale in local space uniformly across all axes.
vec3 scaWorld()
Get object scale in world space.
GGen scaWorld(vec3 scale)
Set object scale in world space.
vec3 posLocalToWorld(vec3 localPos)
Transform a position in local space to world space.
GGen child(int n)
Get the n'th child of this GGen.
GGen scene()
Get the scene this GGen is attached to. Returns null if not attached.
GGen child()
Get the 0th child of this GGen.
int numChildren()
Get the number of children for this GGen.
void detachParent()
Detach this GGen from its parent. Equivalent to ggen --< ggen.parent()
void detachChildren()
Detach all children from this GGen. Equivalent to ggen --< ggen.child(i) for all children. children are NOT reparented.
void detach()
Detach this GGen from its parent and all children. children are NOT reparented.
[ top ]
Scene class. Static--all instances point to the same underlying ChuGL main scene. GGens must be added to a scene to be rendered.
GScene()
Default constructor for GScene.
void backgroundColor(vec3 color)
Set the background color of the scene.
vec3 backgroundColor()
Get the background color of the scene.
GCamera camera(GCamera camera)
Set the main camera of the scene.
GCamera camera()
Get the main camera of the scene.
void ambient(vec3 color)
Set the ambient lighting of the scene. Sets material visibility even when no light is present.
vec3 ambient()
Get the ambient lighting value of the scene.
GLight light()
Get the first light of the scene. On the initial default scene, this returns the default directional light.
GLight[] lights()
Get array of all lights in the scene.
void envMap(Texture envMap)
Set the environment map of the scene. By default this used as a skybox and for environment lighting calculations on lit materials (PhongMaterial supported, PBRMaterial not yet supported). The environment color will be multiplied by the background color set in GScene.backgroundColor(vec3), remember to set the background color to Color.WHITE to view the original image colors.
Texture envMap()
Get the environment map of the scene.
void skybox(Material skybox)
Set the skybox material of the scene. Will be used in the skybox pass and drawn with NO bound vertex attribute buffers and a vertexCount of 3. The default scene already includes an instance of SkyboxMaterial here.
Material skybox()
Get the skybox material of the scene.
[ top ]
Class for creating instanced points in 3D space.
GPoints()
Default constructor for GPoints.
void sampler(TextureSampler sampler)
Set the sampler used for the point texture.
void texture(Texture texture)
Set the texture applied to each point.
void positions(vec3[] positions)
Set positions of the points.
void colors(vec3[] colors)
Set per-point colors. If there are more points than colors, extra points cycle through the colors. The final color is multiplied by the global point color, GPoints.color()
void sizes(float[] sizes)
Set per-point sizes. If there are more points than sizes, extra points cycle through the sizes. The final size is multiplied by the global point size, GPoints.size()
void color(vec3 color)
Set the global color of the points.
vec3 color()
Get the global color of the points.
void size(float size)
Set the global size of the points (in world-space units, a size of 1 means each point is 1 unit wide)
float size()
Get the global size of the points.
TextureSampler sampler()
Get the sampler used for the point texture.
Texture texture()
Get the texture applied to each point.
void billboard(int billboard)
Set whether the points should always face the camera (billboard mode). 0 for no, 1 for yes.
int billboard()
Get whether the points should always face the camera.
[ top ]
Class for creating 2D lines.
GLines()
Default constructor for GLines.
void positions(vec2[] points)
Set the line positions. Z values are fixed to 0.0. Equivalent to LinesGeometry.linePoints()
void colors(vec3[] colors)
Set the line colors. If the array is shorter than the number of lines, the last color is used for the remaining lines. Equivalent to LinesGeometry.lineColors()
void width(float width)
Set the thickness of the lines in the material.
float width()
Get the thickness of the lines in the material.
void color(vec3 color)
Set the line color.
vec3 color()
Get the line color.
[ top ]
Mesh class for renderables. Can be assigned Geometry and Material components.
GMesh()
Default constructor for GMesh.
GMesh(Geometry geo, Material mat)
No description available
Material mat()
Get the material of this GMesh (shorthand for backwards compatibility)
Geometry geo()
Get the geometry of this GMesh (shorthand for backwards compatibility)
Material material()
Get the material of this GMesh.
GMesh material(Material material)
Set the material of this GMesh.
GMesh mat(Material material)
Set the material of this GMesh (shorthand for backwards compatibility)
Geometry geometry()
Get the geometry of this GMesh.
GMesh geometry(Geometry geometry)
Set the geometry of this GMesh.
GMesh geo(Geometry geometry)
Set the geometry of this GMesh (shorthand for backwards compatibility)
void mesh(Geometry geometry, Material material)
Set the geometry and material of this GMesh.
[ top ]
Convenience class for creating a GMesh(CircleGeometry, PhongMaterial)
GCircle()
Default constructor for GCircle.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Convenience class for creating a GMesh(PlaneGeometry, PhongMaterial)
GPlane()
Default constructor for GPlane.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Convenience class for creating a GMesh(CubeGeometry, PhongMaterial)
GCube()
Default constructor for GCube.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Convenience class for creating a GMesh(SphereGeometry, PhongMaterial)
GSphere()
Default constructor for GSphere.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Convenience class for creating a GMesh(TorusGeometry, PhongMaterial)
GTorus()
Default constructor for GTorus.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Convenience class for creating a GMesh(CylinderGeometry, PhongMaterial)
GCylinder()
Default constructor for GCylinder.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Convenience class for creating a GMesh(KnotGeometry, PhongMaterial)
GKnot()
Default constructor for GKnot.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Convenience class for creating a GMesh(SuzanneGeometry, PhongMaterial)
GSuzanne()
Default constructor for GSuzanne.
Texture colorMap()
Get the diffuse texture of the material.
vec3 specular()
Get the specular color of the material.
float shine()
Get the log shininess exponent.
vec3 emission()
Get the emission color of the material.
float normalFactor()
Get the normal factor of the material. Scales effect of normal map. Default 1.0.
float aoFactor()
Get the ambient occlusion factor of the material. Default 1.0.
Texture specularMap()
Get the specular texture of the material.
Texture aoMap()
Get the ambient occlusion texture of the material.
Texture emissiveMap()
Get the emissive texture of the material.
Texture normalMap()
Get the normal texture of the material.
int envmapMethod()
Get the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Set the environment map via GScene.envMap(Texture). Default EnvmapMethod_Reflect.
float refractionRatio()
Get the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 0.5.
int envmapBlend()
Get the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Default EnvmapBlend_None.
float envmapIntensity()
Get the intensity of the environment map lighting. Default 1.0.
void specular(vec3 specular)
Set the specular color of the material.
vec3 color()
Get the diffuse color of the material.
void color(vec3 diffuse)
Set the diffuse color of the material.
void shine(float shine)
Set the log shininess exponent. default 5.
void emission(vec3 emission)
Set the emission color of the material. Default black.
void normalFactor(float normalFactor)
Set the normal factor of the material. Scales effect of normal map.
void aoFactor(float aoFactor)
Set the ambient occlusion factor of the material. Default 1.0. 0 disables AO. Set between 0 and 1.
void colorMap(Texture albedoTexture)
Set the diffuse texture of the material.
void specularMap(Texture specularTexture)
Set the specular texture of the material.
void aoMap(Texture aoTexture)
Set the ambient occlusion texture of the material.
void emissiveMap(Texture emissiveTexture)
Set the emissive texture of the material.
void normalMap(Texture normalTexture)
Set the normal texture of the material.
void envmapMethod(int envmapMethod)
Set the environment map sampling method. One of PhongMaterial.EnvmapMethod_None, PhongMaterial.EnvmapMethod_Reflect, PhongMaterial.EnvmapMethod_Refract. Default EnvmapMethod_Reflect.
void refractionRatio(float ratio)
Set the refraction ratio of the material. Only used when envmapMethod is PhongMaterial.EnvmapMethod_Refract. Default 1.0.
void envmapBlend(int blendMode)
Set the blend mode of the environment map. One of PhongMaterial.EnvmapBlend_None, PhongMaterial.EnvmapBlend_Mix, PhongMaterial.EnvmapBlend_Add, PhongMaterial.EnvmapBlend_Multiply. Set to EnvmapBlend_None to disable environment lighting.
void envmapIntensity(float intensity)
Set the intensity of the environment map lighting. Default 1.0.
[ top ]
Base class for all light components.
GLight()
Default constructor for GLight.
GLight(int type)
No description available
void mode(int mode)
Set the light type. Use GLight.Directional or GLight.Point.
int mode()
Get the light type. Returns either GLight.Directional or GLight.Point.
void color(vec3 color)
Set the light color.
vec3 color()
Get the light color.
void intensity(float intensity)
Set the light intensity. Default 1.0. Use 0 to turn off the light. The intensity is multiplied by the color in final lighting calculations.
float intensity()
Get the light intensity.
int Directional
No description available
int Point
No description available
[ top ]
Point light component.
GPointLight()
Default constructor for GPointLight.
float radius()
Get the point light radius.
void radius(float radius)
Set the point light radius.
float falloff()
Get the point light falloff exponent, i.e. how quickly the light intensity ramps down to 0. A value of 1.0 means linear, 2.0 means quadratic. Default is 2.0.
void falloff(float falloff_exponent)
Set the point light falloff exponent, i.e. how quickly the light intensity ramps down to 0. A value of 1.0 means linear, 2.0 means quadratic. Default is 2.0.
[ top ]
Directional light component.
GDirLight()
Default constructor for GDirLight.
[ top ]
ChuGL Camera class. Can be used to create perspective or orthographic cameras. Also comes with builtin OrbitCamera and FlyCamera controllers.
GCamera()
Default constructor for GCamera.
void clip(float near, float far)
Set camera clip planes.
void perspective()
Set camera mode to perspective.
void orthographic()
Set camera mode to orthographic.
int mode()
Get camera mode. Returns either GCamera.PERSPECTIVE or GCamera.ORTHOGRAPHIC.
float clipNear()
Get camera near clip plane.
float clipFar()
Get camera far clip plane.
void fov(float fov_radians)
Set camera field of view in radians.
float fov()
Get camera field of view in radians.
void viewSize(float size)
(orthographic mode) set the height of the view volume in world space units. Width is automatically calculated based on aspect ratio.
float viewSize()
(orthographic mode) get the height of the view volume in world space units.
vec3 screenCoordToWorldPos(vec2 screen_pos, float distance)
Returns the world position of a point in screen space at a given distance from the camera. Useful in combination with GWindow.mousePos() for mouse picking.
vec2 worldPosToScreenCoord(vec3 world_pos)
Get a screen coordinate from a world position by casting a ray from worldPos back to the camera and finding the intersection with the near clipping planeworld_pos is a vec3 representing a world position.Returns a vec2 screen coordinate.Remember, screen coordinates have origin at the top-left corner of the window.
vec3 NDCToWorldPos(vec3 clip_pos)
Convert a point in clip space to world space. Clip space x and y should be in range [-1, 1], and z in the range [0, 1]. For x and y, 0 is the center of the screen. For z, 0 is the near clip plane and 1 is the far clip plane.
vec3 worldPosToNDC(vec3 world_pos)
Convert a point in world space to this camera's clip space.
int PERSPECTIVE
No description available
int ORTHOGRAPHIC
No description available
[ top ]
Built-in orbit camera controller. Click and drag to rotate the camera. Scroll to zoom.
GOrbitCamera()
Default constructor for GOrbitCamera.
void update(float dt)
Overrides the GGen.update(float dt) method. Called automatically every frame.
void dragSpeed(vec2 speed)
Set the horizontal and vertical speed of the camera's rotation when dragging with the mouse.
vec2 dragSpeed()
Get the speed of the camera's rotation when dragging with the mouse.
void zoomSpeed(float speed)
Set the speed of the camera's zoom when scrolling with the mouse wheel.
float zoomSpeed()
Get the speed of the camera's zoom when scrolling with the mouse wheel.
void target(vec3 target)
Set the point in world space that the camera orbits around.
vec3 target()
Get the point in world space that the camera orbits around.
[ top ]
Built-in fly camera controller. Use WASD to move and mouse to look. Use QE to move up and down.
GFlyCamera()
Default constructor for GFlyCamera.
void speed(float speed)
Set the move speed of the camera.
void update(float dt)
Overrides the GGen.update(dt) method. Called automatically every frame.
float speed()
Get the move speed of the camera.
void sensitivity(float sensitivity)
Set the mouse look sensitivity of the camera.
float sensitivity()
Get the mouse look sensitivity of the camera.
[ top ]
Builtin fonts are "chugl:cousine-regular", "chugl:karla-regular", "chugl:proggy-tiny", "chugl:proggy-clean" which can be assigned to GText.font(string)
GText()
Default constructor for GText.
void texture(Texture texture)
Set a texture to be applied to the text block. Default 1 white pixel.
void color(vec4 color)
Set text color.
vec4 color()
Get text color.
void text(string text)
Set text.
string text()
Get text.
void font(string font)
Set path to a font file (supported types: .otf and .ttf). If not provided, will default to the font set via GText.defaultFont(). See top of class doc for list of builtin font names.
string font()
Get path to font file.
void spacing(float spacing)
Set vertical line spacing. Default is 1.0.
float spacing()
Get vertical line spacing.
void controlPoints(vec2 control_points)
Set control points for text. x = horizontal, y = verticalThe control point is a ratio within the text's bounding box that determines where its origin isFor example, (0.5, 0.5) will place the origin at the center the text. (0.0, 0.0) will place the origin at the bottom-left of the text. (1.0, 1.0) will place the origin at the top-right of the text.
vec2 controlPoints()
Get control points for text. Default is (0.5, 0.5), meaning the center of the text string is at the position of the text transform.
Texture texture()
Get the current texture applied to the text block.
void defaultFont(string default_font)
Set default font file to be used by all GText not given a font path.
[ top ]