5 #include "VectorMath.h"
6 #include "ScreenProperties.h"
7 #include "SpaceHelpers.h"
8 #include "RenderCamera.h"
9 #include "IStreamingVolume.h"
10 #include "EarthConstants.h"
16 const double EVEREST_ALTITUDE_SQR = EVEREST_ALTITUDE*EVEREST_ALTITUDE;
21 class EegeoUpdateParameters
23 float m_frameDeltaSeconds;
25 dv3 m_ecefInterestPoint;
27 m44 m_projectionMatrix;
28 m44 m_viewProjectionMatrix;
29 Streaming::IStreamingVolume& m_streamingVolume;
30 Rendering::ScreenProperties m_screenProperties;
33 EegeoUpdateParameters(
float frameDeltaSeconds,
34 const dv3& ecefLocation,
35 const dv3& ecefInterestPoint,
36 const m44& viewMatrix,
37 const m44& projectionMatrix,
38 Streaming::IStreamingVolume& streamingVolume,
39 const Rendering::ScreenProperties& screenProperties)
40 : m_frameDeltaSeconds(frameDeltaSeconds)
41 , m_ecefLocation(ecefLocation)
42 , m_ecefInterestPoint(ecefInterestPoint)
43 , m_viewMatrix(viewMatrix)
44 , m_projectionMatrix(projectionMatrix)
45 , m_streamingVolume(streamingVolume)
46 , m_screenProperties(screenProperties)
50 Eegeo_ASSERT(m_ecefInterestPoint.LengthSq() <= EVEREST_ALTITUDE_SQR,
"Interest point altitude is too high. ");
51 Eegeo::m44::Mul(m_viewProjectionMatrix, ProjectionMatrix(), ViewMatrix());
54 float FrameDeltaSeconds()
const {
return m_frameDeltaSeconds; }
58 const dv3& EcefLocation()
const {
return m_ecefLocation; }
60 const dv3& EcefInterestPoint()
const {
return m_ecefInterestPoint; }
62 const m44& ViewMatrix()
const {
return m_viewMatrix; }
64 const m44& ProjectionMatrix()
const {
return m_projectionMatrix; }
66 Streaming::IStreamingVolume& StreamingVolume()
const {
return m_streamingVolume; }
68 const Rendering::ScreenProperties& ScreenProperties()
const {
return m_screenProperties; }
70 const m44& ViewProjectionMatrix()
const {
return m_viewProjectionMatrix; }
73 inline Camera::RenderCamera RenderCameraFromEegeoUpdateParameters(
const EegeoUpdateParameters& eegeoUpdateParameters)
75 Camera::RenderCamera renderCamera;
79 eegeoUpdateParameters.ScreenProperties().GetScreenWidth(),
80 eegeoUpdateParameters.ScreenProperties().GetScreenHeight());
82 m33 viewOrientation(eegeoUpdateParameters.ViewMatrix());
84 m33::Inverse(cameraModel, viewOrientation);
85 m44 projection(eegeoUpdateParameters.ProjectionMatrix());
86 dv3 ecefLocation(eegeoUpdateParameters.EcefLocation());
88 renderCamera.SetOrientationMatrix(cameraModel);
89 renderCamera.SetEcefLocation(ecefLocation);
90 renderCamera.SetProjectionMatrix(projection);