Scene¶
-
class
pyrender.
Scene
(nodes=None, bg_color=None, ambient_light=None, name=None)[source]¶ Bases:
object
A hierarchical scene graph.
Parameters: Attributes Summary
ambient_light
The ambient light in the scene. bg_color
The scene background color. bounds
The axis-aligned bounds of the scene. camera_nodes
The nodes containing cameras in the scene. cameras
The cameras in the scene. centroid
The centroid of the scene’s axis-aligned bounding box (AABB). directional_light_nodes
The nodes containing directional lights. directional_lights
The directional lights in the scene. extents
The lengths of the axes of the scene’s AABB. light_nodes
The nodes containing lights. lights
The lights in the scene. main_camera_node
The node containing the main camera in the scene. mesh_nodes
The nodes containing meshes. meshes
The meshes in the scene. name
The user-defined name of this object. nodes
Set of nodes in the scene. point_light_nodes
The nodes containing point lights. point_lights
The point lights in the scene. scale
The length of the diagonal of the scene’s AABB. spot_light_nodes
The nodes containing spot lights. spot_lights
The spot lights in the scene. Methods Summary
add
(obj[, name, pose, parent_node, parent_name])Add an object (mesh, light, or camera) to the scene. add_node
(node[, parent_node])Add a Node to the scene. clear
()Clear out all nodes to form an empty scene. from_trimesh_scene
(trimesh_scene[, …])Create a Scene
from atrimesh.scene.scene.Scene
.get_nodes
([node, name, obj, obj_name])Search for existing nodes. get_pose
(node)Get the world-frame pose of a node in the scene. has_node
(node)Check if a node is already in the scene. remove_node
(node)Remove a node and all its children from the scene. set_pose
(node, pose)Set the local-frame pose of a node in the scene. Attributes Documentation
-
cameras
¶ The cameras in the scene.
Type: set of Camera
-
directional_lights
¶ The directional lights in the scene.
Type: set of DirectionalLight
-
lights
¶ The lights in the scene.
Type: set of Light
-
point_lights
¶ The point lights in the scene.
Type: set of PointLight
-
spot_lights
¶ The spot lights in the scene.
Type: set of SpotLight
Methods Documentation
-
add
(obj, name=None, pose=None, parent_node=None, parent_name=None)[source]¶ Add an object (mesh, light, or camera) to the scene.
Parameters: - obj (
Mesh
,Light
, orCamera
) – The object to add to the scene. - name (str) – A name for the new node to be created.
- pose ((4,4) float) – The local pose of this node relative to its parent node.
- parent_node (
Node
) – The parent of this Node. If None, the new node is a root node. - parent_name (str) – The name of the parent node, can be specified instead of parent_node.
Returns: node – The newly-created and inserted node.
Return type: - obj (
-
static
from_trimesh_scene
(trimesh_scene, bg_color=None, ambient_light=None)[source]¶ Create a
Scene
from atrimesh.scene.scene.Scene
.Parameters: Returns: scene_pr – A scene containing the same geometry as the trimesh scene.
Return type:
-
get_nodes
(node=None, name=None, obj=None, obj_name=None)[source]¶ Search for existing nodes. Only nodes matching all specified parameters is returned, or None if no such node exists.
Parameters: Returns: nodes – The nodes that match all query terms.
Return type: set of
Node
-
get_pose
(node)[source]¶ Get the world-frame pose of a node in the scene.
Parameters: node ( Node
) – The node to find the pose of.Returns: pose – The transform matrix for this node. Return type: (4,4) float
-
has_node
(node)[source]¶ Check if a node is already in the scene.
Parameters: node ( Node
) – The node to be checked.Returns: has_node – True if the node is already in the scene and false otherwise. Return type: bool
-