Package spyre ::
Module spyre
|
|
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. |
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). |
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).
-
|
__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:
|
__program__
-
- Type:
-
str
- Value:
|
__url__
-
- Type:
-
str
- Value:
'http://pduel.sourceforge.net/'
|
|
__version__
-
- Type:
-
str
- Value:
|
degreesToRadians
-
- Type:
-
float
- Value:
|
piOverOneEighty
-
- Type:
-
float
- Value:
|
piOverTwo
-
- Type:
-
float
- Value:
|
radiansToDegrees
-
- Type:
-
float
- Value:
|
REDRAW_TIMER
-
- Type:
-
int
- Value:
|
sqrtTwo
-
- Type:
-
float
- Value:
|