Generic

Generic

Generic class for Shape, Material, Solid, etc. Factorize ID Management and other stuff.

Constructor

(abstract) new Generic()

Source:

Constructor. The constructor takes no argument.

Classes

Generic

Members

className

Source:

The name of the class. Useful to generate the name of items

(readonly) id

Source:

ID of the object in the scene This number is computed automatically when the object is added to the scene. It should not be changed

imports :Array.<string>

Source:

A list of GLSL code chunks that are needed for this shape (and could also be reused somewhere else). Default is the empty list.

Type:
  • Array.<string>

name :string

Source:

The name of the item. This name is computed (from the uuid) the first time the getter is called.

Type:
  • string

uniformType

Source:

Return the type under which the data is passed as uniform. Return the empty string, if the data should not be passed as a uniform.

(readonly) uuid :string

Source:

Universal unique ID. The dashes are replaced by underscored to avoid problems in the shaders

Type:
  • string

Methods

(abstract, static) glslClass() → {string}

Source:

Return the chunk of GLSL code defining the corresponding structure, And eventually basic functions associated to the structure.

Returns:
Type
string

addImport(…imports)

Source:

Extend the list of imports

Parameters:
Name Type Attributes Description
imports string <repeatable>

the imports to add

glslInstance() → {string}

Source:

Compile all the function directly related to the instance of the class (e.g. sdf, gradient, direction field, etc).

Returns:
Type
string

onAdd(scene)

Source:

Additional actions to perform when the object is added to the scene. By default, do nothing.

Parameters:
Name Type Description
scene Scene

the scene to which the object is added.

setId(scene)

Source:

Set the ID of the shape. Propagate the process if needed

Parameters:
Name Type Description
scene Scene

the scene to which the object is added.

shader(shaderBuilder)

Source:

Extend the given shader with the appropriate code

Parameters:
Name Type Description
shaderBuilder ShaderBuilder

the shader builder