Scene¶
-
class
pyrender.Scene(nodes=None, bg_color=None, ambient_light=None, name=None)[source]¶ Bases:
objectA hierarchical scene graph.
Parameters: Attributes Summary
ambient_lightThe ambient light in the scene. bg_colorThe scene background color. boundsThe axis-aligned bounds of the scene. camera_nodesThe nodes containing cameras in the scene. camerasThe cameras in the scene. centroidThe centroid of the scene’s axis-aligned bounding box (AABB). directional_light_nodesThe nodes containing directional lights. directional_lightsThe directional lights in the scene. extentsThe lengths of the axes of the scene’s AABB. light_nodesThe nodes containing lights. lightsThe lights in the scene. main_camera_nodeThe node containing the main camera in the scene. mesh_nodesThe nodes containing meshes. meshesThe meshes in the scene. nameThe user-defined name of this object. nodesSet of nodes in the scene. point_light_nodesThe nodes containing point lights. point_lightsThe point lights in the scene. scaleThe length of the diagonal of the scene’s AABB. spot_light_nodesThe nodes containing spot lights. spot_lightsThe 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 Scenefrom 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
Scenefrom 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
-