109. opengl.scene
— OpenGL 3D scene.¶
109.1. Classes defined in module opengl.scene¶
- class opengl.scene.ItemList(scene)[source]¶
A list of drawn objects of the same kind.
This is used to collect the Actors, Decorations and Annotations in a scene. Currently the implementation does not check that the objects are of the proper type or are not occurring multiple times.
- class opengl.scene.Scene(canvas=None)[source]¶
An OpenGL scene.
The Scene is a class holding a collection of actors, annotations and decorations. It can also have a background. Actors are the 3D geometry constituting the actual scene. Annotations are explicatif objects attached to the geometry (actor name and id, element and node numbers, normals, …); they can be 2D or 3D but live in a 3D world. Decorations are 2D or 3D objects attached to the canvas. Background objects are 2D decorations that are drown when the canvas is cleared.
object
rendertype
view
attached
remarks
Actor
0
3D
3D
3D annot
4
3D
3D
no rendertype yet
2D annot
1
2D
3D
single attacment point
2D annot
-1
2D
3D
multiple attachment points
2D decor
2
2D
2D
3D decor
-2
3D
2D
axes display
background
3
2D
2D
See also
Drawable
base class for scene objects
- property annotations¶
Return all annotations
- property bbox¶
Return the bounding box of the scene.
The bounding box is normally computed automatically as the box enclosing all Actors in the scene. Decorations and Annotations are not included. The user can however set the bbox himself, in which case that value will be used. It can also be set to the special value None to force recomputing the bbox from all Actors.
- set_bbox(bb)[source]¶
Set the bounding box of the scene.
This can be used to set the scene bounding box to another value than the one autocomputed from all actors.
bb is a (2,3) shaped array specifying a bounding box. A special value None may be given to force recomputing the bbox from all Actors.
- changeMode(canvas, mode=None)[source]¶
This function is called when the rendering mode is changed
This method should be called to update the actors on a rendering mode change.
- addAny(actor)[source]¶
Add any actor type or a list thereof.
This will add any actor/annotation/decoration item or a list of any such items to the scene. This is the prefered method to add an item to the scene, because it makes sure that each item is added to the proper list.
- removeAny(actor)[source]¶
Remove a list of any actor/highlights/annotation/decoration items.
This will remove the items from any of the canvas lists in which the item appears. itemlist can also be a single item instead of a list. If None is specified, all items from all lists will be removed.
- drawn(obj)[source]¶
List the graphical representations of the given object.
Returns a list with the actors that point to the specifief object.
- removeDrawn(obj)[source]¶
Remove all graphical representations of the given object.
Removes all actors returned by
drawn(obj)()
.
109.2. Functions defined in module opengl.scene¶
- opengl.scene.sane_bbox(bb)[source]¶
Return a sane nonzero bbox.
bb should be a (2,3) float array or compatible Returns a (2,3) float array where the values of the second row are guaranteed larger than the first. A value 1 is added in the directions where the input bbox has zero size. Also, any NaNs will be transformed to numbers.