Programming Reference:Scene Class

From BCI2000 Wiki
Revision as of 16:41, 11 September 2008 by Mellinger (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Location

src/extlib/3DAPI

Synopsis

The Scene class provides a rectangular view on a 3D scene. Inheriting from GraphObject, a Scene object is drawn onto a GraphDisplay.

The scene itself consists of scene objects as defined by the 3D API.

Methods

Scene(GraphDisplay)

In the constructor, specify the GraphDisplay associated with the scene object.

Add(primObj pointer)

Adds a 3D API object to the scene.

Remove(primObj pointer)

Removes a 3D API object from the scene.

DeleteObjects()

Deletes all objects that are part of the scene.

Move(float deltaT)

Moves all 3D API objects one step forward in time, using their specified velocities, and tests for collisions.

Show()

Makes the object visible. Initially, objects are created in visible state.

Hide()

Makes the object invisible.

Invalidate()

Invalidates the object's bounding rectangle, i.e. marks it as needing to be repainted. Typically, this function is called from a derived class, indicating that a change in object properties has occurred that requires a repaint.

Paint()

Asks an object to paint itself by calling its OnPaint event handler.

Change()

Notifies an object of a change in display properties by calling its OnChange event handler.

bool Click(GUI::Point)

Tests whether the specified point is inside an object's bounding rectangle, and calls its OnClick event handler if this is the case.

Properties

OnCollideFunc OnCollide (w)

Specifies a callback function to be called for each collision between scene objects. The callback function takes references to a pair of scene objects as arguments. Collision testing is done from the Move() member function.

SetOfObjects Objects (r)

The objects contained in the scene, as a std::set of object pointers.

string ImagePath (rw)

Reference path for texture images specified using relative paths.

float CameraX, CameraY, CameraZ (rw)

Camera position in scene coordinates.

cameraNLight CameraAndLight (rw)

Provides access to the scene's 3D API cameraNLight object that defines details of projection and scene lighting.

int BitDepth (rw)

The scene's rendering bit depth. Typically, this is 16 or 24.

bool DoubleBuffering (rw)

Switch double buffering on or off. When switched on, the scene will be rendered into an offscreen buffer, and only displayed after rendering is finished.

bool DisableVsync (rw)

When double buffering is enabled, buffer switching will be synchronized to the display's vertical sync pulse. While this is desired for most purposes, it will affect BCI2000 system timing, and should thus be disabled. This will not work for all graphics cards.

bool HardwareAccelerated (r)

True if OpenGL rendering is realized in hardware, false in case of a software renderer.

See also

Programming Reference:3D API, Programming Reference:GraphObject Class, Programming Reference:GraphDisplay Class