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

Module spyre.spyre

SPyRE -> Simple Pythonic Rendering Engine. A simple OpenGL rendering engine

Spyre has five types of objects which together make up the engine.

Engine:
   Includes main loop, handles event queue, passing input data to 
   interface, maintaining viewport and tracking and displaying 
   objects.
Interface:
   Controls the primary camera, the engine, and the timekeeper in 
   response to user input.
Camera:
   Maintains eye position and direction of view, as well as projection
   config (frustum or ortho).   Different cameras are suited to different
   interfaces, but MobileCamera is common.
Studio:
   Maintains lights, including fixed, mobile, and camera-mounted types; 
   and depth-cueing (fog) and some materials details.
TimeKeeper:
   Controls pace of engine run, can switch engine advancement on and
   off.  Also controls and monitors framerate.
Object:
   In addition to the above five elements of the engine assembly, there are 
   displayable objects.  These all descend from the Object class.
An ultra-simple example:
   This is not tested. See scripts in demos directory for
   tested code.
   =========================
   import spyre
   import OpenGL.GLU as oglu

   # create displayable object, subclassing Object
   def Sphere(spyre.Object):
       def __init__(self, diameter): self.rad = diameter/2.0 
       def display(self):
           quad   = oglu.gluNewQuadric()
           oglu.gluSphere(quad, self.rad, 60, 60)

   sph = Sphere()
       
   engine = Engine()
   engine.add(sph)

   engine.go()
   ===========================

Classes
    Engine
Engine The engine manages the window, handles high-level displaying and updating.
EngineFullScreen Generic engine, but full screen.
    Timekeeper
TimeKeeper Keeps track of time and engine progress.
    Studios
StudioColorMat Manage environmental effects such as lights and fog
Light Implements each light.
Sun Implements light that stays at infinite distance
Bulb Implements point light
Spot Implements a spotlight, with beam.
NullStudio Manage environmental effects such as lights and fog.
    Interfaces
Interface The interface encapsulates all the user interface behavior that an engine can exhibit.
BareBonesInterface A bare-bones interface supports quitting, and resizing.
BasicInterface A basic interface supports quitting, pausing, stepping, zooming, and resizing.
PivotingInterface A pivoting interface supports the basic interfaces and can be pivoted around the center point with the mouse.
PanningInterface A panning interface supports all the pivoting and basic behavior, but the pivoting point can be moved with the keyboard.
PedestrianInterface A pedestrian interface moves the camera on a roughly horizontal plane.
PedestrianInterfaceY PedestrianInterface for xz plane panning
CursorKeyInterface A cursorkey interface supports all the pivoting and basic behavior, but the pivoting is done by cursor keys rather than by mouse.
    Camera
Camera Abstract camera base class.
MobileCamera A mobile camera maintains a certain distance (rho) from the origin, but is user controllable.
MobileCameraFrustum A mobile camera with Frustum viewing projection
MobileCameraOrtho A mobile camera with Orthographic viewing projection
BasicCamera A basic camera views a center point from an eye position, with a reference up vector that points to the top of the screen.
BasicCameraOrtho  
BasicCameraFrustum  
PrecessingCamera A precessing camera orbits around the z axis at a given distance from it and height above the x-y plane.
PrecessingCameraOrtho A precessing camera with Orthographic viewing projection
RovingCamera A roving camera moves around the scene.
RovingCameraFrustum a roving camera with frustum projection
RovingCameraFrustumY RovingCameraY with Frustum
RovingCameraOrtho a roving camera with ortho projection
RovingCameraOrthoY RovingCameraY with Frustum
RovingCameraY A roving camera moves around the scene, panning on xz plane.
FrustumCam A FrustumCam is a mixin that provides for frustum (perspective) mode in descendant cameras.
OrthoCam An OrthoCam is a mixin that provides for ortho mode in descendant cameras.
    others
Object The fundamental object.
Group A group is an object which holds a collection of other objects.

Exceptions
EngineReInitException Exception can be raised anywhere to rerun engine initialization and setup code.
EngineReSetupException Exception can be raised anywhere to rerun engine setup code.
EngineShutdownException Exception can be raised anywhere to end engine immediately.

Function Summary
  cartesianToSpherical(x, y, z)
Convert cartesion coords (x,y,z) to spherical (rho,theta,phi).
  sphericalToCartesian(rho, theta, phi)
Convert spherical (rho,theta,phi) to cartesion coords (x,y,z).

Variable Summary
str __author__ = 'David Keeney <dkeeney@travelbyroad.net>'
str __copyright__ = 'Copyright (C) 2000-2004 Erik Max Franci...
str __license__ = 'LGPL'
str __program__ = 'SPyRE'
str __url__ = 'http://pduel.sourceforge.net/'
str __version__ = '0.7'
float degreesToRadians = 0.017453292519943295                                                  
float pi = 3.1415926535897931                                                    
float piOverOneEighty = 0.017453292519943295                                                  
float piOverTwo = 1.5707963267948966                                                    
float radiansToDegrees = 57.295779513082323                                                    
int REDRAW_TIMER = 25                                                                    
float sqrtTwo = 1.4142135623730951                                                    
float twoPi = 6.2831853071795862                                                    

Function Details

cartesianToSpherical(x, y, z)

Convert cartesion coords (x,y,z) to spherical (rho,theta,phi).

sphericalToCartesian(rho, theta, phi)

Convert spherical (rho,theta,phi) to cartesion coords (x,y,z).

Variable Details

__author__

Type:
str
Value:
'David Keeney <dkeeney@travelbyroad.net>'                              

__copyright__

Type:
str
Value:
'Copyright (C) 2000-2004 Erik Max Francis, 2004-2005 David Keeney'     

__license__

Type:
str
Value:
'LGPL'                                                                 

__program__

Type:
str
Value:
'SPyRE'                                                                

__url__

Type:
str
Value:
'http://pduel.sourceforge.net/'                                        

__version__

Type:
str
Value:
'0.7'                                                                  

degreesToRadians

Type:
float
Value:
0.017453292519943295                                                  

pi

Type:
float
Value:
3.1415926535897931                                                    

piOverOneEighty

Type:
float
Value:
0.017453292519943295                                                  

piOverTwo

Type:
float
Value:
1.5707963267948966                                                    

radiansToDegrees

Type:
float
Value:
57.295779513082323                                                    

REDRAW_TIMER

Type:
int
Value:
25                                                                    

sqrtTwo

Type:
float
Value:
1.4142135623730951                                                    

twoPi

Type:
float
Value:
6.2831853071795862                                                    

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