00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _CELENGINE_SIMULATION_H_
00011 #define _CELENGINE_SIMULATION_H_
00012
00013 #include <vector>
00014
00015 #include <celmath/vecmath.h>
00016 #include <celmath/quaternion.h>
00017 #include <celengine/texture.h>
00018 #include <celengine/mesh.h>
00019 #include <celengine/universe.h>
00020 #include <celengine/astro.h>
00021 #include <celengine/galaxy.h>
00022 #include <celengine/texmanager.h>
00023 #include <celengine/render.h>
00024 #include <celengine/frame.h>
00025 #include <celengine/observer.h>
00026
00027
00028 class Simulation
00029 {
00030 public:
00031 Simulation(Universe*);
00032 ~Simulation();
00033
00034 double getTime() const;
00035 void setTime(double t);
00036
00037 double getRealTime() const;
00038 double getArrivalTime() const;
00039
00040 void update(double dt);
00041 void render(Renderer&);
00042 void render(Renderer&, Observer&);
00043
00044 Selection pickObject(Vec3f pickRay, float tolerance = 0.0f);
00045
00046 Universe* getUniverse() const;
00047
00048 void orbit(Quatf q);
00049 void rotate(Quatf q);
00050 void changeOrbitDistance(float d);
00051 void setTargetSpeed(float s);
00052 float getTargetSpeed();
00053
00054 Selection getSelection() const;
00055 void setSelection(const Selection&);
00056 Selection getTrackedObject() const;
00057 void setTrackedObject(const Selection&);
00058
00059 void selectPlanet(int);
00060 Selection findObject(std::string s, bool i18n = false);
00061 Selection findObjectFromPath(std::string s, bool i18n = false);
00062 std::vector<std::string> getObjectCompletion(std::string s, bool withLocations = false);
00063 void gotoSelection(double gotoTime,
00064 Vec3f up, astro::CoordinateSystem upFrame);
00065 void gotoSelection(double gotoTime, double distance,
00066 Vec3f up, astro::CoordinateSystem upFrame);
00067 void gotoSelectionLongLat(double gotoTime,
00068 double distance,
00069 float longitude, float latitude,
00070 Vec3f up);
00071 void gotoLocation(const RigidTransform& transform, double duration);
00072 void getSelectionLongLat(double& distance,
00073 double& longitude,
00074 double& latitude);
00075 void gotoSurface(double duration);
00076 void centerSelection(double centerTime = 0.5);
00077 void centerSelectionCO(double centerTime = 0.5);
00078 void follow();
00079 void geosynchronousFollow();
00080 void phaseLock();
00081 void chase();
00082 void cancelMotion();
00083
00084 Observer& getObserver();
00085 void setObserverPosition(const UniversalCoord&);
00086 void setObserverOrientation(const Quatf&);
00087 void reverseObserverOrientation();
00088
00089 Observer* addObserver();
00090 void removeObserver(Observer*);
00091 Observer* getActiveObserver();
00092 void setActiveObserver(Observer*);
00093
00094 SolarSystem* getNearestSolarSystem() const;
00095
00096 double getTimeScale() const;
00097 void setTimeScale(double);
00098 bool getSyncTime() const;
00099 void setSyncTime(bool);
00100 void synchronizeTime();
00101
00102 float getFaintestVisible() const;
00103 void setFaintestVisible(float);
00104
00105 void setObserverMode(Observer::ObserverMode);
00106 Observer::ObserverMode getObserverMode() const;
00107
00108 void setFrame(astro::CoordinateSystem, const Selection&);
00109 void setFrame(const FrameOfReference&);
00110 FrameOfReference getFrame() const;
00111
00112 private:
00113 SolarSystem* getSolarSystem(const Star* star);
00114
00115 private:
00116 double realTime;
00117 double timeScale;
00118 bool syncTime;
00119
00120 Universe* universe;
00121
00122 SolarSystem* closestSolarSystem;
00123 Selection selection;
00124
00125 Observer* activeObserver;
00126 std::vector<Observer*> observers;
00127
00128 float faintestVisible;
00129 };
00130
00131 #endif // _CELENGINE_SIMULATION_H_