Generic
- class Generic()
Generic class for Shape, Material, Solid, etc. Factorize ID Management and other stuff.
Constructor. The constructor takes no argument.
- Generic.Generic
Constructor. The constructor takes no argument.
- Generic.className
The name of the class. Useful to generate the name of items
- Generic.id
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
- Generic.imports
type: Array.<string>
A list of GLSL code chunks that are needed for this shape (and could also be reused somewhere else). Default is the empty list.
- Generic.name
type: string
The name of the item. This name is computed (from the uuid) the first time the getter is called.
- Generic.uniformType
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.
- Generic.uuid
type: string
Universal unique ID. The dashes are replaced by underscored to avoid problems in the shaders
- Generic.addImport(...imports)
Extend the list of imports
- Arguments:
imports (string) – the imports to add
- Generic.glslInstance()
Compile all the function directly related to the instance of the class (e.g. sdf, gradient, direction field, etc).
- Returns:
string –
- Generic.onAdd(scene)
Additional actions to perform when the object is added to the scene. By default, do nothing.
- Arguments:
scene (Scene) – the scene to which the object is added.
- Generic.setId(scene)
Set the ID of the shape. Propagate the process if needed
- Arguments:
scene (Scene) – the scene to which the object is added.
- Generic.shader(shaderBuilder)
Extend the given shader with the appropriate code
- Arguments:
shaderBuilder (ShaderBuilder) – the shader builder
- static Generic.glslClass()
Return the chunk of GLSL code defining the corresponding structure, And eventually basic functions associated to the structure.
- Returns:
string –