Shapes
- class Shape(isom)
A representation of a 3D geometric shape. It should not be confused with Three.js Shape class. It is more an analogue of the class BufferGeometry in Three.js.
Constructor.
- Arguments:
isom (Isometry) – the position of the shape
- Shape.Shape
Constructor.
- Shape._absoluteIsom
type: Isometry
Isometry defining the absolute position of the shape (taking into account the position of the parent) The actual value is computed the first time absoluteIsom is called. If the object is moving, the updates should be made by the developer.
- Shape._absoluteIsomInv
type: Isometry
Inverse of the absolute isometry
- Shape.absoluteIsom
type: Isometry
If the shape is part of an advanced shape, the underlying isometry is a position relative to the parent shape. absoluteIsom, on the contrary return the isometry encoding the absolute position
- Shape.absoluteIsomInv
type: Isometry
Return the inverse of absoluteIsom
- Shape.hasUVMap
type: boolean
Says whether the shape comes with a UV map. Default is false If true, the shape should implement the method glslUVMap.
- Shape.isAdvancedShape
type: boolean
Says whether the shape is a basic shape, that it is not build on top of other shapes.
- Shape.isBasicShape
type: boolean
Says whether the shape is a basic shape, that it is not build on top of other shapes.
- Shape.isGlobal
type: boolean
Says whether the shape is global. True if global, false otherwise.
- Shape.isLocal
type: boolean
Says whether the shape is local. True if local, false otherwise.
- Shape.isShape
type: boolean
Says that the object inherits from Shape
- Shape.isom
type: Isometry
Isometry defining the position of the shape (relative to any potential parent)
- Shape.isomInv
type: Isometry
Inverse of the isometry
- Shape.parent
type: Shape
Parent of the shape (if this shape is part of an advanced shape)
- Shape.glslGradient()
Return the chunk of GLSL code corresponding to the gradient field. The default computation approximates numerically the gradient. This function can be overwritten for an explicit computation. If so, the gradient function on the GLSL side should have the following signature RelVector {{name}}_gradient(RelVector v) It takes the vector obtained when we hit the shape and render the normal to the shape at this point.
- Returns:
string –
- Shape.glslInstance()
Compile all the function directly related to the object (e.g. sdf, gradient, etc).
- Returns:
string –
- Shape.glslSDF()
Return the chunk of GLSL code corresponding to the signed distance function. The SDF on the GLSL side should have the following signature float {{name}}_sdf(RelVector v) It takes a vector, corresponding the position and direction of the geodesic we are following and return an under-estimation of the distance from this position to the shape along this geodesic.
- Returns:
string –
- Shape.glslUVMap()
Return the chunk of GLSL code corresponding to the UV map The UV map on the GLSL side should have the signature vec2 {{name}}_uvMap(RelVector v) It takes the vector obtained when we hit the shape and render the UV coordinates at this point.
- Shape.updateAbsoluteIsom()
Recompute the absolute isometry from the current data The update is “descending”, updating a shape will updates the children but not the parents.
- Shape.updateData()
The shape may contain data which depends on the isometry (like the center of a ball) This method can be overloaded to update all these data when needed
- class BasicShape(isom)
A representation of 3D basic shape. A basic shape is a shape that is not built on top of other shapes. The type of the properties of a basic shape should not depend on the instance of this shape. Indeed, these properties will be passed to the shader in the form of a struct. (This gives the options to animate the shapes.)
Constructor.
- Arguments:
isom (Isometry) – the position of the shape
- BasicShape.BasicShape
Constructor.
- BasicShape.isBasicShape
type: boolean
Says whether the shape is a basic shape, that it is not build on top of other shapes.
- class AdvancedShape(isom)
A representation of 3D advanced shapes. An advanced shape is a shape that is built on top of other shapes. The type of the properties of an advanced shape may depend on the instance of this shape. These properties will not be passed to the shader. Only the signed distance function will carry the relevant data.
Constructor.
- Arguments:
isom (Isometry) – the position of the shape
- AdvancedShape.AdvancedShape
Constructor.
- AdvancedShape.isBasicShape
type: boolean
Says whether the shape is a basic shape, that it is not build on top of other shapes.