©2004,2008 Jim E. Brooks http://www.palomino3d.org
[2008/02]
The representation of the simulated world is factored into graphical and geodesic interface classes: World and Geo.
World is primarily a graphics object.
Geo is primarily a set of metric conversion functions.
[2008/05]
The graphics rendering code is based on world coordinates (object space). World coordinates are purely a graphical concept.
The simulator is designed to start with spherical coordinates. Spherical coordinates are (latitude,longitude,altitude) (degree,degree,meter).
Physical coordinates are (meter,meter,meter). Data files associated with 3D models define width,length,height in meters.
At startup, the simulation maps the Earth's actual measurements to 3D graphical coordinates (world coordinates). Once defined, world coordinates and their correlation to spherical coordinates remain constant. The simulator may seem to re-orient world space as the viewpoint moves over the spherical world, but this is just an illusion. Rather, the view matrix is recomputed every frame to be on a tangent (SuperView::ComputeViewMatrix) which instead changes the mapping world space and eye space.
[2008/04]
Latitude defines a semi-circle {0',...,180'}. lat=0' defines the north pole.
Longitude defines a full-circle {0',...,360'}. lon=0' defines Greenwich,UK.
Most methods have assertions to enforce correct range of both latitude and longitude. If out-of-range isn't really an error, modulate args using math::ModuloAbs(180.0f,lat) or (360.0f,lon).
[2008/06]
World encapsulates and hides either a FlatPlanet or SpherePlanet. World is a container of 3D Objects.
[2008/02]
Geo class (geodesic) converts between physical metrics, spherical coordinates, and graphical coordinates. The Geo class maintains a registered list of RigidBody objects bodies to support identifying contact forces for physics computations.
[2008/02]
Planet is an abstract class whose derivatives are FlatPlanet and SpherePlanet. Planet is a private implementation of World (World is a Facade over Planet).
FlatPlanet defines a single satellite image produced by osgdem (GoldenGate.osga). Despite being flat, thru Geo, it can be accessed in terms of spherical coordinates.
SpherePlanet is a Facade over an OSSIM planet which can automatically download satellite imagery and render the entire Earth as an ellipsoid.
[2008/02]
This is a matrix that is tangential to a point on the ellipsoid. Its Z axis is the "up vector". The view matrix is transformed thru the tangent matrix so that the horizon is level (the orientation a human pilot would expect). The tangent matrix is recomputed as the player moves around the globe.
[2008/02]
Obsoleted by collision-detection but RigidBody remains since it's flexible and possibly still useful.
The Geo class has a registered list of RigidBody objects. Geo::IfContactForce(GeoVertex) consults the list to determine if a rigid body exists at a physical coordinate.
See Contact Force.
[2008/08]
To keep the scene-graph optimally sorted by state,
a state parameter is passed with an Object when attached to the scene-graph
World::Attach( object, stateBits )
.
World has StateSorter objects which map osg::Group nodes with osg::StateSet settings.
osg::StateSet settings are abstracted by StateSorter::STATE_BIT_* bit fields.
At program startup, osg::Optimizer is run on the entire scene-graph.
Going beyond the limited set of pre-defined STATE_BIT_* enums, StateSorter::GetStateBitsId() returns a unique ID representing any combination of graphical states. For example, an stateBits ID can be allocated for a particular texture that is shared by child nodes.
stateBits,stateSet appears as pair in the code. The pair is somewhat of an idiom. stateBits is a value that exists on the app-side to state-sort the nodes of the scene-graph. stateSet is a object that affects graphical state (applied by OSG). Thru StateSorter, stateBits affects osg::StateSet. The caller can pass a osg::StateSet arg modified in ways not possible by StateBits.
Last modified: Tue Aug 19 18:19:07 EDT 2008