Link Search Menu Expand Document

Class OGLScene

About :

	An OGLScene is a handle to graphic nodes and ligths The scene is sharable by several canvas in charge to display the scene The scene has no camera nor observer since the displays can provide a specific point of view about the same scene.
Class diagram of class of OGLScene.

Functions

Function summury
__init__(self) Create a OGLScene (more…)
get_free_index(self) Get a free index for object (more…)
free_index(self, index) Free a used index (more…)
set_ambient_light(self, r, g, b)  
get_keys(self, node, keys) Get all exist keys (more…)
add_texture(self, texture) Create a dictionnary of texture associated with the canvas correponding to the scene. (more…)
compile_update_data(self, key, offset, data)  
compile_single_node(self, k, node, key, DATA={}, PREV={}, data_only=False, cpt=0)  
compile_group(self, node, key, DATA={}, PREV={}, active=False, data_only=False, cpt=0) Sub method of compile to enter recursively in the compilation of groups (more…)
compile(self, key=’main’, data_only=False, what=None, add=True) update VBOs of associated canvas (more…)
compilation_on(self, compile=True, data_only=False) switch on/of the compilation of objects (more…)
is_compilation_on(self)  
add_node(self, node, space=0, compile=True) Add a graphic node to the scene in a specific space (more…)
remove_node(self, space, key=None, compile=True) Remove a graphic node from a specific space of the scene (more…)
move_node_space(self, node, newspace) move a node from one space to a new one (more…)
set_node_space(self, gr, space, compile=True) put a graphic node in a specific space (more…)
get_nodes(self, space=0) Get scene nodes from a given space (more…)
get_nb_nodes(self)  
bounding_box(self, space=0) Get the bounding box of the scene nodes from a given space (more…)
add_canvas(self, canvas) Associate a canvas to the scene (more…)
remove_canvas(self, canvas) Detach the scene from a canvas (more…)
render(self) Redraw the scene in all its associated canvas (more…)

Methods desciption :

init

def __init__(self)

Create a OGLScene

get_free_index

def get_free_index(self)

Get a free index for object

free_index

def free_index(self, index)

Free a used index

  • → index : the object indexed removed

set_ambient_light

def set_ambient_light(self, r, g, b)

get_keys

def get_keys(self, node, keys)

Get all exist keys

add_texture

def add_texture(self, texture)

Create a dictionnary of texture associated with the canvas correponding to the scene.

compile_update_data

def compile_update_data(self, key, offset, data)

compile_single_node

def compile_single_node(self, k, node, key, DATA={}, PREV={}, data_only=False, cpt=0)

compile_group

def compile_group(self, node, key, DATA={}, PREV={}, active=False, data_only=False, cpt=0)

Sub method of compile to enter recursively in the compilation of groups

compile

def compile(self, key='main', data_only=False, what=None, add=True)

update VBOs of associated canvas

  • → key : compile the scene object if the VBO associate to this key

compilation_on

def compilation_on(self, compile=True, data_only=False)

switch on/of the compilation of objects when a big set of new objects is added we can switch of compilation, add the objects in the scene and switch on compilation to ensure we do not compile for nothing

  • → compile : boolean to switch on or off
  • ← a boolean to tell if the status change

is_compilation_on

def is_compilation_on(self)

add_node

def add_node(self, node, space=0, compile=True)

Add a graphic node to the scene in a specific space

  • → node : graphic node : OGLNode
  • → space: projection space
  • space = 0 : the node is projected in the global 3D space
  • space = 1 : the node is projected in the camera space
  • space = 2 : the node is projected in the screen space

remove_node

def remove_node(self, space, key=None, compile=True)

Remove a graphic node from a specific space of the scene

  • → space: projection space
  • space = 0 : the node is projected in the global 3D space
  • space = 1 : the node is projected in the camera space
  • space = 2 : the node is projected in the screen space
  • → key : the reference to the application object; any pythonic instance

move_node_space

def move_node_space(self, node, newspace)

move a node from one space to a new one avoid recompiling node for GPU. Just space information is changed

set_node_space

def set_node_space(self, gr, space, compile=True)

put a graphic node in a specific space obsolete : use move_node_space . It avoid recompiling object for GPU only

get_nodes

def get_nodes(self, space=0)

Get scene nodes from a given space

  • → space : projection space
  • space = 0 : the node is projected in the global 3D space
  • space = 1 : the node is projected in the camera space
  • space = 2 : the node is projected in the screen space

get_nb_nodes

def get_nb_nodes(self)

bounding_box

def bounding_box(self, space=0)

Get the bounding box of the scene nodes from a given space

  • → space : projection space
  • space = 0 : the node is projected in the global 3D space
  • space = 1 : the node is projected in the camera space
  • space = 2 : the node is projected in the screen space
  • ← xm,XM : in the given space : 2 3-tuples

add_canvas

def add_canvas(self, canvas)

Associate a canvas to the scene This method must be called by the canvas itself when the scene is associated to the canvas

  • → canvas the associated canvas

remove_canvas

def remove_canvas(self, canvas)

Detach the scene from a canvas This method must be called by the canvas itself when the scene is disconnected from the canvas

  • → canvas the detached canvas

render

def render(self)

Redraw the scene in all its associated canvas