Gravity Engine 2 3.0
Loading...
Searching...
No Matches
GravityEngine2.GSMapDisplay Class Reference

Display objects and trajectories on a map projection of a planet. More...

Inheritance diagram for GravityEngine2.GSMapDisplay:
GravityEngine2.GSDisplay

Public Member Functions

override List< int > Init ()
 Initialize the objects for this display controller. This is called by GSController init as part of its Start()
 
float float y MapProject (double theta, double phiIn)
 
override Vector3 MapToScene (Vector3 rWorldAbs, double time)
 Map from the world space to the display space:
 
- Public Member Functions inherited from GravityEngine2.GSDisplay
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)
 
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 ()
 
delegate Vector3 MapToSceneFn (Vector3 rWorld, double time=-1)
 
void ParticleSetup (double dt, double timeStart, GBUnits.GEScaler geScaler)
 
void ParticlesUpdate (double lenPhysToWorld)
 
List< GSParticlesParticleSystems ()
 
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.
 

Public Attributes

Vector3 aboveMapOffset
 
GSBody centerBody
 
LineRenderer debug3060
 
bool earthOffset
 
float height = 50.0f
 
Vector3 heightAxis = new Vector3(0, 0, 1)
 
Vector3 longitude0Axis = Vector3.right
 
float longitude0Deg = 0
 
float width = 100.0f
 
Vector3 widthAxis = new Vector3(1, 0, 0)
 
- Public Attributes inherited from GravityEngine2.GSDisplay
bool active = true
 
GSDisplayObject[] addBodies
 
AddMode addMode = AddMode.CHILDREN
 
CR3BP.ReferencePoint cr3bpRefPoint = CR3BP.ReferencePoint.NONE
 
DisplayMode displayMode = DisplayMode.INTERPOLATE
 
bool editorScalingFoldout = false
 
GSController gsController
 
float maxSceneDimension = 10000
 
float scale = 1.0f
 
GSBody wrtBody
 
bool xzOrbitPlane = true
 

Protected Member Functions

override void DisplayUpdateInit (GECore ge, double elapsedWorldTime)
 
override void TrajectoryUpdate (GECore geTrajectory)
 In a map display need to thread the trajectory under the map when we wrap off the edge (either horizontally or vertically). In this case we need to add more than one point for a given traj. point, hence the need to override the entire traj. update.
 

Additional Inherited Members

- Public Types inherited from GravityEngine2.GSDisplay
enum  AddMode { CHILDREN , LIST , SCENE }
 Mode the controller will use to find GSBody objects to add CHILDREN: Scan all children of this controller for GSBody LIST: Add objects explicitly listed SCENE: Find all objects in the scene with GSBody components.
 
enum  DisplayMode { DIRECT , INTERPOLATE }
 
- Protected Attributes inherited from GravityEngine2.GSDisplay
int[] displayIndices
 
GSDisplayObjectInfo[] displayObjects
 displayObjects may be sparsely filled. The empty slots are managed by a Stack and the allocated slots are listed in an array of indices.
 
Queue< int > displayOptQueue
 
Vector3 displayPosition
 
Quaternion displayRotation
 
bool maintainCoRo
 
int numDO
 
float queueConsumeRate
 
float queueConsumeTokens
 
Vector3 wrtWorldPosition
 

Detailed Description

Display objects and trajectories on a map projection of a planet.

NOTE: to have the usual Cartesian X, Y plane need to have the camera located at -Z looking toward the origin, since Unity has a LH coordinate system.

Member Function Documentation

◆ DisplayUpdateInit()

override void GravityEngine2.GSMapDisplay.DisplayUpdateInit ( GECore ge,
double elapsedWorldTime )
protectedvirtual
Parameters
ge
elapsedWorldTime

Reimplemented from GravityEngine2.GSDisplay.

◆ Init()

override List< int > GravityEngine2.GSMapDisplay.Init ( )
virtual

Initialize the objects for this display controller. This is called by GSController init as part of its Start()

  • find the GSDisplayObject implementations (mostly GSDisplayBody)
  • find the GSDisplayOrbit
  • arrange internal data structure by having above objects register with this class
  • determine if any bodies want trajectory recording and pass their ids back
Returns
List of trajectories

Reimplemented from GravityEngine2.GSDisplay.

◆ MapToScene()

override Vector3 GravityEngine2.GSMapDisplay.MapToScene ( Vector3 rWorld,
double time )
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
rWorldPosition in world space and default world units
timeworld time for this point
Returns

Reimplemented from GravityEngine2.GSDisplay.

◆ TrajectoryUpdate()

override void GravityEngine2.GSMapDisplay.TrajectoryUpdate ( GECore geTrajectory)
protectedvirtual

In a map display need to thread the trajectory under the map when we wrap off the edge (either horizontally or vertically). In this case we need to add more than one point for a given traj. point, hence the need to override the entire traj. update.

Since this is the only use case, C&P the common code for now.

Parameters
geTrajectory

Reimplemented from GravityEngine2.GSDisplay.


The documentation for this class was generated from the following file: