Solid

class Solid(shape, material, ptMaterial)

Abstract class for solids. Unlike shapes, materials or lights, solids have no existence as a structure on the shader side. This comes from the fact that the type of shape / material may vary. As a consequence, solids do not have a numerical ID, just a UUID.

Arguments:
  • shape (Shape) – the shape of the solid

  • material (Material) – the material of the solid

  • ptMaterial (PTMaterial) – material for path tracing (optional)

Solid.Solid
Solid.isRendered

Says whether the solid should be rendered or not. The property can be used to define solids that will appear later in the scene (because of some animation, game event, etc) without having to rebuild the shader. Default is true.

Solid.isSolid

type: boolean

Say if the item is a solid

Solid.material

type: Material

The material of the solid

Solid.ptMaterial

type: PTMaterial

The material of the solid for path tracing

Solid.shape

type: Shape

The shape of the solids

Solid.glslInstance()

Return a chunk of GLSL code specific to the instance of the solid We use a hack here. It is indeed impossible in GLSL to update the fields of a uniform variable However for the (crude) handling of transparency we need to modify the isRendered variable. Therefore, after the object is defined, we directly add a variable _isRenderedHack set to true. In the scene SDF the test to check is an object should be rendered is : .isRendered & _isRenderedHack (with the right prefixes)

Returns:

string

Solid.onAdd(scene)

Additional actions to perform when the object is added to the scene. By default, propagate the call.

Arguments:
  • scene (Scene) – the scene to which the object is added.

Solid.setId(scene)

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

Arguments:
  • scene (Scene) – the scene to which the object is added.

Solid.updateData()

Update the data of the underlying shape. It should also update the data of all itd children.