material: material rows

To use this module, require it in a generator script (see Geometry modules):

require material

The material table of a csg model: a row gives the faces of one material id a name, a look, a color scale, two-sided faces and an albedo texture.

Structures

Material

A row of the material table of the model.

Fields:
  • row : int - The index of the row in the table

Material rows

diffuse(m: Material; r: float; g: float; b: float): Material

Scales the face color of the row, 0 to 1 per channel; the default is 1. Returns the row.

Arguments:
  • m : Material

  • r : float

  • g : float

  • b : float

look(m: Material; name: string): Material

Sets the look of the row: paint, chrome, matte, glass or metallic. Returns the row.

Arguments:
material(id: int; name: string): Material

Adds a row to the material table of the model: the faces with the material id id take its name and look. Returns the row.

Arguments:
  • id : int - the material id of the faces, 0 to 65535, unique in the table

  • name : string - the material name, 1 to 255 printable ASCII characters, unique in the table; the names paint, chrome, matte, glass, metallic and mat<id> are only for their own ids

tex(m: Material; name: string): Material

Sets the albedo texture of the row, used when name is a texture asset of the project. Returns the row.

Arguments:
  • m : Material - the row

  • name : string - the texture asset path

two_sided(m: Material): Material

Draws the faces of the row from both sides. Returns the row.

Arguments:

Material of a part

mat(a: Sheet; name: string): Sheet

Gives all faces of the sheet the material id of the row named name; the row must be made before this call.

Arguments:
  • a : Sheet

  • name : string

mat(a: Shell; name: string): Shell

Gives all faces of the shell the material id of the row named name; the row must be made before this call.

Arguments:
  • a : Shell

  • name : string

mat(a: Solid; name: string): Solid

Gives all faces of the solid the material id of the row named name; the row must be made before this call.

Arguments:
  • a : Solid

  • name : string