taichi.ui.scene
¶
Module Contents¶
Classes¶
A 3D scene, which can contain meshes and particles, and can be rendered on a canvas |
Functions¶
|
|
|
|
|
|
|
Attributes¶
- taichi.ui.scene.normals_field_cache¶
- taichi.ui.scene.get_normals_field(vertices)¶
- taichi.ui.scene.gen_normals_kernel(vertices: template(), normals: template())¶
- taichi.ui.scene.gen_normals_kernel_indexed(vertices: template(), indices: template(), normals: template(), weights: template())¶
- taichi.ui.scene.gen_normals(vertices, indices)¶
- class taichi.ui.scene.Scene¶
Bases:
taichi._lib.core.PyScene
A 3D scene, which can contain meshes and particles, and can be rendered on a canvas
- set_camera(self, camera)¶
- mesh(self, vertices, indices=None, normals=None, color=(0.5, 0.5, 0.5), per_vertex_color=None, two_sided=False)¶
Declare a mesh inside the scene.
- Parameters
vertices – a taichi 3D Vector field, where each element indicate the 3D location of a vertex.
indices – a taichi int field of shape (3 * #triangles), which indicate the vertex indices of the triangles. If this is None, then it is assumed that the vertices are already arranged in triangles order.
normals – a taichi 3D Vector field, where each element indicate the normal of a vertex. If this is none, normals will be automatically inferred from vertex positions.
color – a global color of the mesh as 3 floats representing RGB values. If per_vertex_color is provided, this is ignored.
per_vertex_color (Tuple[float]) – a taichi 3D vector field, where each element indicate the RGB color of a vertex.
two_sided (bool) – whether or not the triangles should be able to be seen from both sides.
- particles(self, centers, radius, color=(0.5, 0.5, 0.5), per_vertex_color=None)¶
Declare a set of particles within the scene.
- Parameters
centers – a taichi 3D Vector field, where each element indicate the 3D location of the center of a triangle.
color – a global color for the particles as 3 floats representing RGB values. If per_vertex_color is provided, this is ignored.
per_vertex_color (Tuple[float]) – a taichi 3D vector field, where each element indicate the RGB color of a particle.
two_sided (bool) – whether or not the triangles should be able to be seen from both sides.
- point_light(self, pos, color)¶