GLScenegraph
Note: GLScenegraph is now long-since obsolete. See the OpenGLContext
project for the successor.
GLScenegraph is, effectively, the rendering part of the mcf.vrml library, but since the code is more general
than just displaying VRML, I've split the package into it's own distribution.
GLScenegraph currently supports a fairly useful subset of VRML's nodes.
It is not an optimised large-scene renderer, but rather a straightforward
system from which real systems might be created.
Here's the obligatory screenshot (note: this particular geometry is pre-lit
(i.e. colour-per-vertex) stuff, and the background is mis-rendered (the sky
should be a pale cyan, not blue (this is the pathological case where the sphere's
points are actually inside the near clipping plane, so get excluded, it's
also very common)))...
What is it?
General OpenGL Support
- GLPanel -- a wxPython GLCanvas providing basic hooks for interacting
with the rest of the system (mostly the viewplatform), eventually this
will be a base class and derived (GLPanel and wxGLPanel), with the
wxPython code isolated from the generic stuff.
- ViewPlatform -- navigation support, currently "walk" and "examine"
modes, very intuitive trackball for the examine mode, general controls for
"logo"-style movements (forward/back/turn(left/right/up/down/arbitrary))
- wx -- beginnings of the wxPython re-factoring of the wxPanel, currently
only has the one module browserframe, which just creates a glPanel and a
combo-box for loading VRML files from disk (populates the combo-box with
the VRML files in the test directory, incidentally).
- test -- testing code and examples, mostly VRML files for loading,
the old test modules are there, but I don't use them much any more
SceneGraph Objects
- render.* -- "core" rendering nodes, eventually to be translated to
C++, effectively the server side of a scenegraph engine. Currently supports:
- trianglegeometry
- Supports IndexedFaceSet, IndexedLineSet, PointSet, supports colour-per-vertex
and colour-per-face (for IFS) VRML nodes (uses colour-per-vertex internally,
though). Renders using glDrawArrays, supports textureCoordinate array.
- imagetexture
- Simple PIL-supported texture loading, currently don't support TextureTransforms
- light
- Point, spot, directional, most of the semantics of VRML equivalents,
directional largely untested.
- quadrics
- Currently only Sphere, needs lots of work :)
- shape
- (Follows VRML conventions) shape, appearance, material, lit/unlit/textured/untextured
as defined by the VRML nodes of the same names.
- transform
- Transform/group support, includes the basic machinery for
"sensitive" geometry (such as mouse Sensors)
- background
- Work-in-progress support for VRML-style backgrounds (eventually
plan to support both the background sphere and the texture-cube)
- loaders.vrml -- the (rather ugly and inefficient) interface to the
mcf.vrml parser/renderer, includes processors which (hopefully) correctly
generate normals for IFS objects based on creaseAngles, expands VRML-style
coordinates, colours, textureCoordinates and indicies into arrays for
glDrawArrays calls. Eventually want to have other loaders in here.
Dependencies
Download
tar.gz file 2000/08/14 release -- to
install, expand into a directory on your Python path. You will need to have
installed _all_ of the dependencies (sorry about that, but it's a rather involved
system). To test, run glscenegraph/wx/browserframe.py, and choose one of
the demo files from the drop-down list. sphere.wrl or test_texcoord2.wrl are
good first tests.
Plans (hopes)
- Background node fixes and completion [ minor for fixes, somewhat involved
for image cube I'm guessing ]
- Viewpoint nodes (interacting with the viewplatform object) [ involved
thought, simple execution ]
- Refactoring of the GLPanel, versions for other GUI toolkits, provision
of common application feature hooks (status line, log/console window,
download monitors, threaded download, url/urn resolution) and implementations
for wxPython [ lots of work, nothing difficult ]
- Mouse-based walk, pan, slide, etceteras [ trivial, just interpret the
mouse-deltas according to current navigation mode, see examine mode
implementation ]
- Mouse Sensors (Anchors, TouchSensor, Sphere, Cylinder, Plane) [ minor,
mostly just tell the system you've "caught" the mouse and interpret
the delta-x/y values, would benefit from an event model, of course :)
]
- Get the transparency rendering working [ no idea, going to require
sorting triangles on every rendering run by the look of it!? ]
- Static-group support (display-list based) [ trivial ]
- Switch nodes [ trivial ]
- Prototype support (effectively, render the PROTO scenegraph root node,
but requires resolving IS fields (currently not done in mcf.vrml, so
requires a revision there)) [ involved ]
- Possibly a Portal or BSP-tree scenegraph optimisation node structure
[ unconnected to anything else, really ]
- C++ version of the rendering nodes, preferably still able to use Python
nodes in the hierarchy, but with optimised handling of other C++ nodes
[ minor, for the right person ;o) ]
- Bounding box calculation, graph pruning based on BBox [ trivial to
calculate, modestly involved to use properly ]
- Mip-map (potentially scale non-power-of-2) textures (maybe allow
multi-texturing as well?) [ minor ]
- Billboard, LOD, Fog [ minor effort, some involved thinking/optimisation
]
- Text (both polygonal and texture, possibly an "overlay" text drawn
directly only the pixels for high-quality, low-overhead lables) [ involved
]
- Spotlight penumbra support [ no clue ]
- Cone, Box, Cylinder, etceteras nodes [ very low priority ]
- Elevation Grids [ low priority for me, though a VIPM or ROAM system
might be interesting ]
More toward the hopes side...
- Possibly some collision detection/terrain following
- Possibly some particle systems support
- Possibly add subdivision surfaces (maybe NURBs if someone else wants
to add them)
- Provide for VRML binding/unbinding of nodes
- Shadow casting would be nice :o)
- Some form of script support (likely restricted-mode Python SAI or EAI-style
with Python) (requires an event model)
- Interpolators, TimeSensors (requires an event model)
- Event model ;-P
- Other geometry loaders (hopefully from other people)
Back to mcfletch homepage...