ChuGL materials describe appearance of geometries, including color and shading properties.
Base material class, do not instantiate directly.
Material()
Default constructor for Material.
float alpha(float alpha)
Set the alpha of the material color.
float alpha()
Get the alpha of the material color.
int attenuatePoints(int attenuation)
For PointMaterial: set if point size should be scaled by distance from camera.
int attenuatePoints()
For PointMaterial: returns 1 if point size is being scaled by distance from camera, else 0.
Material clone()
Clones this material.
vec3 color(vec3 rgb)
Set material color uniform as an rgb. Alpha set to 1.0.
void diffuseMap(Texture tex)
Set diffuse map texture.
int envMapBlend(int blendMode)
For PhongMaterial: set environment map blend mode. Can be Material.BLEND_MODE_ADD, Material.BLEND_MODE_MULTIPLY, or Material.BLEND_MODE_MIX.
int envMapBlend()
For PhongMaterial: returns environment map blend mode.
int envMapEnabled(int enabled)
For PhongMaterial: enable or disable environment mapping.
int envMapEnabled()
For PhongMaterial: returns 1 if environment mapping is enabled, else 0.
float envMapIntensity(float intensity)
For PhongMaterial: set environment map intensity. Environment Map lighting contribution is multiplied by this value.
float envMapIntensity()
For PhongMaterial: returns environment map intensity.
int envMapMethod(int method)
For PhongMaterial: set environment map method. Can be Material.ENV_MAP_REFLECT or Material.ENV_MAP_REFRACT.
int envMapMethod()
For PhongMaterial: returns environment map method.
float envMapRefractionRatio(float ratio)
For PhongMaterial: set environment map refactive ratio.
float envMapRefractionRatio()
For PhongMaterial: returns environment map refactive ratio.
void fragShader(string frag)
For ShaderMaterial: set fragment shader path.
void fragString(string frag)
For ShaderMaterial: set fragment shader string.
int lineMode(int mode)
For LineMaterial: set line mode. Can be Material.LINE_SEGMENTS, Material.LINE_STRIP, or Material.LINE_LOOP.
void lineWidth(float width)
Set line width if rendering with Material.POLYGON_LINE. NOTE: unsupported on macOS.
void localNormals()
For NormalsMaterial: color surface using local-space normals.
void pointSize(float size)
Set point size of PointsMaterial. Also affects point size if rendering in mode Material.POLYGON_POINT.
Texture pointSprite(Texture sprite)
For PointMaterial: set sprite texture for point sprite rendering.
int polygonMode(int mode)
Set the rendering mode for this material, can be Material.POLYGON_FILL, Material.POLYGON_LINE, or Material.POLYGON_POINT.
int polygonMode()
Get the rendering mode for this material, can be Material.POLYGON_FILL, Material.POLYGON_LINE, or Material.POLYGON_POINT.
void shaders(string vert, string frag)
For ShaderMaterial: set vertex and fragment shaders.
float shine(float shininess)
For PhongMaterial: set shininess exponent, default 5.
vec3 specular(vec3 color)
For PhongMat: set specular color.
void specularMap(Texture tex)
Set specular map texture.
int transparent(int transparent)
Set if material should be rendered with transparency. 1 for true, 0 for falseMeshes using this material will then be rendered in the transparent pass with depth writing disabled.
int transparent()
Returns whether material is marked transparent. 1 for true, 0 for false.
void uniformBool(string name, int b0)
No description available
void uniformFloat2(string name, float f0, float f1)
No description available
void uniformFloat3(string name, float f0, float f1, float f2)
No description available
void uniformFloat4(string name, float f0, float f1, float f2, float f3)
No description available
void uniformFloat(string name, float f0)
No description available
void uniformInt2(string name, int i0, int i1)
No description available
void uniformInt3(string name, int i0, int i1, int i2)
No description available
void uniformInt4(string name, int i0, int i1, int i2, int i3)
No description available
void uniformInt(string name, int i0)
No description available
void uniformTexture(string name, Texture texture)
No description available
void vertShader(string vert)
For ShaderMaterial: set vertex shader path.
void vertString(string vert)
For ShaderMaterial: set vertex shader string.
void worldNormals()
For NormalsMaterial: color surface using world-space normals.
int BLEND_MODE_ADD
Blend colors by adding them.
int BLEND_MODE_MIX
Blend colors by mixing, i.e. interpolating between them.
int BLEND_MODE_MULTIPLY
Blend colors by multiplying them.
int ENV_MAP_REFLECT
Pass into Material.envMapMethod() to use reflection mapping.
int ENV_MAP_REFRACT
Pass into Material.envMapMethod() to use refraction mapping.
int LINE_LOOP
Used by LineMaterial to render lines as a loop, connecting each vertex to the next, and also the last to the first.
int LINE_SEGMENTS
Used by LineMaterial to render lines as a series of segments, where every 2 vertices is a line.
int LINE_STRIP
Used by LineMaterial to render lines as a continuous strip, connecting each vertex to the next.
int POLYGON_FILL
Pass into Material.polygonMode() to set polygon rendering to filled triangles, default.
int POLYGON_LINE
Pass into Material.polygonMode() to render geometry as a line mesh.
int POLYGON_POINT
Pass into Material.polygonMode() to render geometry as a point mesh (points drawn at each vertex position)
[ top ]
Color each pixel using the surface normal at that point.
NormalsMaterial()
Default constructor for NormalsMaterial.
[ top ]
Color each pixel using a flat color.
FlatMaterial()
Default constructor for FlatMaterial.
[ top ]
Color each pixel using a phong specular shading.
PhongMaterial()
Default constructor for PhongMaterial.
[ top ]
Used by GPoints.
PointMaterial()
Default constructor for PointMaterial.
[ top ]
Used by GLines.
LineMaterial()
Default constructor for LineMaterial.
[ top ]
Color each pixel using its UV coordinates. Looks like a mango, yum.
MangoUVMaterial()
Default constructor for MangoUVMaterial.
[ top ]
Color each pixel using the custom glsl shaders you provide via Material.shaders()
ShaderMaterial()
Default constructor for ShaderMaterial.
[ top ]