Control the display of all GSDisplay objects for a given GE. The GE is commonly implied by the use of GravitySceneController, otherwise it can be set via a script.
More...
|
void | ActiveSet (bool value) |
| Change the active status.
|
|
void | DisplayBodyRemoveByBodyId (int id) |
| Remove all GSDisplayObjects with the given bodyId.
|
|
delegate void | DisplayInScene (GECore ge, MapToSceneFn mapToScene, double timeWorld, bool alwaysUpdate=false, bool maintainCoRo=false) |
|
void | DisplayObjectAdd (GSDisplayObject gdo) |
| Add a GSDisplayObject (typically a GSDisplayBody or GSDisplayOrbit). Different display objects may have different update methods or choose to register custom display functions so they are asked to "add themselves" via AddToSceneDisplay(). As part of this they must call RegisterDisplayObject() [which is where the "book-keeping" is done.].
|
|
void | DisplayObjectRemove (GSDisplayObject gdo) |
| Remove a GSDisplayObject (e.g. GSDisplayBody, GSDisplayOrbit etc.)
|
|
virtual void | DisplayUpdate (GECore ge, double elapsedWorldTime) |
| Main update loop for display of bodies and orbits in the scene. (Internal)
|
|
string | DumpAll () |
|
virtual List< int > | Init () |
| Initialize the objects for this display controller. This is called by GSController init as part of its Start()
|
|
virtual Vector3 | MapToScene (Vector3 rWorld, double time=-1) |
| Map from the world space to the display space:
|
|
delegate Vector3 | MapToSceneFn (Vector3 rWorld, double time=-1) |
|
void | ParticleSetup (double dt, double timeStart, GBUnits.GEScaler geScaler) |
|
void | ParticlesUpdate (double lenPhysToWorld) |
|
List< GSParticles > | ParticleSystems () |
|
int | RegisterDisplayObject (GSDisplayObject gdo, int bodyId, Transform transform=null, DisplayInScene displayInScene=null, bool trajectory=false, LineRenderer trajLine=null) |
|
void | UpdateDisplayObjectBody (long displayId, int bodyId) |
| Update the internal state of GSDisplayObject. Can be used to designate a new bodyId to track.
|
|
Control the display of all GSDisplay objects for a given GE. The GE is commonly implied by the use of GravitySceneController, otherwise it can be set via a script.
This is the typical display component used. It will display all objects with a GSDisplayObject (or extending class such as GSDisplayBody, GSDisplayOrbit etc.) in a scaled fashion but will not apply any other transformations or limitations.
GSDisplayObject bodies are typically arranged in the heirarchy to be children of this object. If not, then they must add themselves by registering with AddGSDisplayObject(). This will register them to have a state or COE update when appropriate. The state or COE update mode is specified at the time of registration.
This class may be extended to produce a different visual result while taking advantage of all the "plumbing" implemented here. This is typically done by over-riding MapToScene delegate GSDMapToScene().
virtual void GravityEngine2.GSDisplay.DisplayUpdate |
( |
GECore | ge, |
|
|
double | elapsedWorldTime ) |
|
virtual |
Main update loop for display of bodies and orbits in the scene. (Internal)
Bodies will generally be set to have their transforms updated directly by this code.
Display of orbits is done by delegates that determine how to poulate their line renderers.
There is code to allow objects with dlegates to limit how often they are caled which can be useful for orbit display, since computing all the points in an orbit can cost CPU.
- Parameters
-
virtual Vector3 GravityEngine2.GSDisplay.MapToScene |
( |
Vector3 | rWorld, |
|
|
double | time = -1 ) |
|
virtual |
Map from the world space to the display space:
- if XZ orbit mode, then flip YZ coords
- apply scale from world to display
- add position offset and rotation from the GSDisplay transform
Extensions of this class will commonly override this method to produce a different mapping e.g. GSDisplayMercator
Typically the time is not required, but some display controllers may elect to show things in a rotating frame and the time is needed in those cases.
- Parameters
-
rWorld | Position in world space and default world units |
time | world time for this point |
- Returns
Reimplemented in GravityEngine2.GSDisplay2D, GravityEngine2.GSDisplay2DCoro, GravityEngine2.GSLaunchDisplay, and GravityEngine2.GSMapDisplay.
virtual void GravityEngine2.GSDisplay.TrajectoryUpdate |
( |
GECore | geTrajectory | ) |
|
|
protectedvirtual |
Trajectories are computed by a "look-ahead" GECore instance that has a circular recording buffer in GE scale units. This look-ahead instance is managed by the gsController.
To display this we read out from the current point in the buffer accounting for the wrap-around. Since the reading of a buffer with scaling would change the buffer contents we need to do the scaling here (otherwise we'd scale the scaled version next time through).
- Parameters
-
Reimplemented in GravityEngine2.GSDisplay2D, GravityEngine2.GSLaunchDisplay, and GravityEngine2.GSMapDisplay.