SimpleTextureMaterial

SimpleTextureMaterial

A material given by a image file

Constructor

new SimpleTextureMaterial(file, params)

Source:

Constructor

Parameters:
Name Type Description
file string

path to the image file

params Object

options for the material

Extends

Classes

SimpleTextureMaterial

Members

isMaterial :boolean

Source:
Overrides:

Says that the object inherits from Material

Type:
  • boolean

isReflecting

Source:
Overrides:

Says whether the material is reflecting Default is false.

lights

Source:
Overrides:

The light eventually affecting the material. If lights is not set up when the solid carrying the material is added to the scene, then lights is set up to the list of lights in the scene.

reflectivity :Color

Source:
Overrides:

Reflectivity of the material. Each channel (red, blue, green), interpreted as number between 0 and 1, is the reflectivity coefficient of the corresponding color (0 = no reflectivity, 1 = all light is reflected).

Type:
  • Color

sampler :Texture

Source:

Texture built from the given image

Type:
  • Texture

scale :Vector2

Source:

Scaling factor applied the the UV Coordinates before using them as Texture Coordinates

Type:
  • Vector2

start :Vector2

Source:

Point in the UV coordinates that will be map to the origin of the Texture Coordinates

Type:
  • Vector2

usesLight

Source:
Overrides:

Says whether the material reacts to (certain) lights in the scene. Default is false.

usesNormal

Source:
Overrides:

Says whether the material requires the normal to the shape for its computation. Default is true.

usesUVMap

Source:
Overrides:

Says whether the material requires a UV map on the shape for its computation. Default is false.

Methods

glslInstance() → {string}

Source:
Overrides:

Compile all the function directly related to the object (e.g. render).

Returns:
Type
string

(abstract) glslRender() → {string}

Source:
Overrides:

Return the chunk of GLSL code used to compute the color of the material at the given point The render function on the GLSL side should have one of the following signatures

  • vec3 {{name}}_render(ExtVector v)
  • vec3 {{name}}_render(ExtVector v, RelVector normal)
  • vec3 {{name}}_render(ExtVector v, vec2 uv)
  • vec3 {{name}}_render(ExtVector v, RelVector normal, vec2 uv) The exact signature depends whether the material requires a normal or UV coordinates. Here v is the vector obtained when we hit the shape. It should return the color as a vec3 of the material at the given point, without taking into account reflections.
Returns:
Type
string