Panda3DBaseRenderer¶
- class Panda3DBaseRenderer(self, rendererName: str)¶
Bases:
pybind11_object
Base class for a panda3D renderer. This class handles basic functionalities, such as loading object, changing camera parameters.
For a subclass to have a novel behaviour (e.g, display something else) These methods should be overriden:
setupScene: This is where you should apply your shaders.
setupCamera: This is where cameras are created and intrinsics parameters are applied
setupRenderTarget: This is where you should create the texture buffers, where the render results should be stored.
Methods
Add a node to the scene.
Compute the near and far planes for the camera at the current pose, given a certain node/part of the graph.
Retrieve the camera's pose, in the world frame.
Get the name of the renderer.
Overloaded function.
Get the rendering order of this renderer.
Get the scene root.
Initialize the whole Panda3D framework.
Overloaded function.
Returns true if this renderer process 3D data and its scene root can be interacted with.
Load a 3D object.
Set the behaviour when a Panda3D assertion fails.
Set the camera's pose.
Overloaded function.
Set new rendering parameters.
set whether vertical sync is enabled.
Inherited Methods
Operators
__doc__
__module__
Attributes
__annotations__
- addNodeToScene(self, object: NodePath) None ¶
Add a node to the scene. Its pose is set as the identity matrix.
- Parameters:
- object: NodePath¶
- computeNearAndFarPlanesFromNode(self, name: str, near: float, far: float, fast: bool) tuple[float, float] ¶
Compute the near and far planes for the camera at the current pose, given a certain node/part of the graph.
The near clipping value will be set to the distance to the closest point of the object. The far clipping value will be set to the distance to farthest vertex of the object.
Warning
Depending on geometry complexity, this may be an expensive operation.
Warning
if the object lies partly behind the camera, the near plane value will be zero. If it fully behind, the far plane will also be zero. If these near/far values are used to update the rendering parameters of the camera, this may result in an invalid projection matrix.
- Parameters:
- name: str¶
name of the node that should be used to compute near and far values.
- near: float¶
resulting near clipping plane distance
- far: float¶
resulting far clipping plane distance
- fast: bool¶
Whether to use the axis align bounding box to compute the clipping planes. This is faster than reprojecting the full geometry in the camera frame
- Returns:
A tuple containing:
near: resulting near clipping plane distance
far: resulting far clipping plane distance
- getCameraPose(self) visp._visp.core.HomogeneousMatrix ¶
Retrieve the camera’s pose, in the world frame. The pose is specified using the ViSP convention (Y-down right handed).
- getNodePose(*args, **kwargs)¶
Overloaded function.
getNodePose(self: visp._visp.ar.Panda3DBaseRenderer, name: str) -> visp._visp.core.HomogeneousMatrix
Get the pose of a Panda node, in world frame in the ViSP convention (Y-down right handed).
- Parameters:
- name
Node path to search for.
- Returns:
wTo, the pose of the object in world frame
getNodePose(self: visp._visp.ar.Panda3DBaseRenderer, object: NodePath) -> visp._visp.core.HomogeneousMatrix
Get the pose of a Panda node, in world frame in the ViSP convention (Y-down right handed). This version of the method directly uses the Panda Nodepath.
- getRenderOrder(self) int ¶
Get the rendering order of this renderer. If a renderer A has a lower order value than B, it will be rendered before B. This is useful, if for instance, B is a postprocessing filter that depends on the result of B.
- Returns:
int
- getRenderRoot(self) NodePath ¶
Get the scene root.
- initFramework(self) None ¶
Initialize the whole Panda3D framework. Create a new PandaFramework object and a new window.
Will also perform the renderer setup (scene, camera and render targets)
- initFromParent(*args, **kwargs)¶
Overloaded function.
initFromParent(self: visp._visp.ar.Panda3DBaseRenderer, framework: PandaFramework, window: PointerTo<WindowFramework>) -> None
initFromParent(self: visp._visp.ar.Panda3DBaseRenderer, renderer: visp._visp.ar.Panda3DBaseRenderer) -> None
- isRendering3DScene(self) bool ¶
Returns true if this renderer process 3D data and its scene root can be interacted with.
This value could be false, if for instance it is redefined in a subclass that performs postprocessing on a texture.
- loadObject(self, nodeName: str, modelPath: str) NodePath ¶
Load a 3D object. To load an .obj file, Panda3D must be compiled with assimp support.
Once loaded, the object will not be visible, it should be added to the scene.
- setAbortOnPandaError(self, abort: bool) None ¶
Set the behaviour when a Panda3D assertion fails. If abort is true, the program will stop. Otherwise, an error will be displayed in the console.
- setCameraPose(self, wTc: visp._visp.core.HomogeneousMatrix) None ¶
Set the camera’s pose. The pose is specified using the ViSP convention (Y-down right handed).
- Parameters:
- wTc: visp._visp.core.HomogeneousMatrix¶
the new pose of the camera, in world frame
- setNodePose(*args, **kwargs)¶
Overloaded function.
setNodePose(self: visp._visp.ar.Panda3DBaseRenderer, name: str, wTo: visp._visp.core.HomogeneousMatrix) -> None
Set the pose of a node. This node can be any Panda object (light, mesh, camera). The pose is specified using the ViSP convention (Y-down right handed).
- Parameters:
- name
Node path to search for, from the render root. This is the object that will be modified See https://docs.panda3d.org/1.10/python/programming/scene-graph/searching-scene-graph
- wTo
Pose of the object in the world frame
setNodePose(self: visp._visp.ar.Panda3DBaseRenderer, object: NodePath, wTo: visp._visp.core.HomogeneousMatrix) -> None
Set the pose of a node. The pose is specified using the ViSP convention (Y-down right handed). This node can be any Panda object (light, mesh, camera).
- Parameters:
- object
The object for which to set the pose
- wTo
Pose of the object in the world frame
- setRenderParameters(self, params: visp._visp.ar.Panda3DRenderParameters) None ¶
Set new rendering parameters. If the scene has already been initialized, the renderer camera is updated.
- Parameters:
- params: visp._visp.ar.Panda3DRenderParameters¶
the new rendering parameters
- setVerticalSyncEnabled(self, useVsync: bool) None ¶
set whether vertical sync is enabled. When vertical sync is enabled, render speed will be limited by the display’s refresh rate
- static vispPointToPanda(point: visp._visp.core.ColVector) visp._visp.core.ColVector ¶
- static vispVectorToPanda(vec: visp._visp.core.ColVector) visp._visp.core.ColVector ¶