Package spyre :: Module spyre :: Class Camera
[frames | no frames]

Type Camera

Known Subclasses:
BasicCamera

Abstract camera base class. A usable camera would inherit from this, and from FrustumCam or OrthoCam.

Each engine must have at least one camera. If none are provided by programmer, the interface will install its preferred camera.

Each camera tracks its own viewport, which is by default the size of the window.
Method Summary
  __init__(self, engine, eye, center, up, left, right, bottom, top, near, far)
Initialize new camera.
  setup(self)
Overridable for things to be done before use, but after engine and interface are initialized.
  zoomIn(self, factor)
Zoom in.
  zoomOut(self, factor)
Zoom out.
  setViewport(self, left, top, right, bottom)
Record desired viewport (left, top, right, bottom).
  displayViewport(self)
Push the viewport params to OpenGL.
  displayBackground(self)
Clear the display, or alternate prelim treatment.
  refresh(self)
Refresh the position of the camera.
  restoreInit(self)
Restore previously saved initialization state.
  saveInit(self)
Save state of initialization internally for later restoration.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
  eye: Track eye position
  center: Track center position

Instance Variable Summary
  objects: Each camera keeps a list of displayable objects.

Method Details

__init__(self, engine, eye, center, up, left, right, bottom, top, near, far)
(Constructor)

Initialize new camera.
Parameters:
engine - the engine
eye - x,y,z tuple with eye position
center - x,y,z tuple with center of view
up - x,y,z tuple pointing up
left - left edge of viewing box, in eyespace (float)
right - right edge of viewing box, in eyespace (float)
bottom - bottom edge of viewing box, in eyespace (float)
top - top edge of viewing box, in eyespace (float)
near - near edge of viewing box, in eyespace (float)
far - far edge of viewing box, in eyespace (float)
Overrides:
__builtin__.object.__init__

setup(self)

Overridable for things to be done before use, but after engine and interface are initialized.

zoomIn(self, factor=1.4142135623730951)

Zoom in. Narrows the viewing box.
Parameters:
factor - ratio of old width to new width.

zoomOut(self, factor=1.4142135623730951)

Zoom out. Widens the viewing box.
Parameters:
factor - ratio of new width to old width.

setViewport(self, left, top, right, bottom)

Record desired viewport (left, top, right, bottom). Each value is in range 0-1, representing fraction of window. The default (0,0,1,1) is entire window.

displayViewport(self)

Push the viewport params to OpenGL.

displayBackground(self)

Clear the display, or alternate prelim treatment. Always clears depth buffer, clears color if background attribute is set. This method can be overridden for multiviewport effects.

refresh(self)

Refresh the position of the camera.

restoreInit(self)

Restore previously saved initialization state.

saveInit(self)

Save state of initialization internally for later restoration.

Property Details

eye

Track eye position

center

Track center position

Instance Variable Details

objects

Each camera keeps a list of displayable objects. By default this is a reference to the engines list, and all objects are displayed for each camera. This behavior can be overriden such that each camera displays a subset of displayable objects.

Generated by Epydoc 2.1 on Sat Jan 07 17:58:17 2006 http://epydoc.sf.net