An object that combines all the state that is relevant to looking into the scene from a particular point of view.
| 39 | /// An object that combines all the state that is relevant to looking into the |
| 40 | /// scene from a particular point of view. |
| 41 | class SceneCameraState |
| 42 | { |
| 43 | protected: |
| 44 | |
| 45 | /// The screen-space viewport rectangle. |
| 46 | RectI mViewport; |
| 47 | |
| 48 | /// The viewing frustum. |
| 49 | Frustum mFrustum; |
| 50 | |
| 51 | /// The inverse of the frustum's transform stored here for caching. |
| 52 | MatrixF mWorldViewMatrix; |
| 53 | |
| 54 | /// Actual head position (will be - eye pos) |
| 55 | MatrixF mHeadWorldViewMatrix; |
| 56 | |
| 57 | /// The projection matrix. |
| 58 | MatrixF mProjectionMatrix; |
| 59 | |
| 60 | /// World-space vector representing the view direction. |
| 61 | Point3F mViewDirection; |
| 62 | |
| 63 | /// Internal constructor. |
| 64 | SceneCameraState() {} |
| 65 | |
| 66 | public: |
| 67 | |
| 68 | /// Freeze the given viewing state. |
| 69 | /// |
| 70 | /// @param viewport Screen-space viewport rectangle. |
| 71 | /// @param frustum Camera frustum. |
| 72 | /// @param worldView World->view matrix. |
| 73 | /// @param projection Projection matrix. |
| 74 | SceneCameraState( const RectI& viewport, const Frustum& frustum, const MatrixF& worldView, const MatrixF& projection ); |
| 75 | |
| 76 | /// Capture the view state from the current GFX state. |
| 77 | static SceneCameraState fromGFX(); |
| 78 | |
| 79 | /// |
| 80 | static SceneCameraState fromGFXWithViewport( const RectI& viewport ); |
| 81 | |
| 82 | /// Return the screen-space viewport rectangle. |
| 83 | const RectI& getViewport() const { return mViewport; } |
| 84 | |
| 85 | /// Return the camera frustum. |
| 86 | const Frustum& getFrustum() const { return mFrustum; } |
| 87 | |
| 88 | /// Return the view position. This is a shortcut for getFrustum().getPosition(). |
| 89 | const Point3F& getViewPosition() const { return mFrustum.getPosition(); } |
| 90 | |
| 91 | /// Return the world-space view vector. |
| 92 | const Point3F& getViewDirection() const { return mViewDirection; } |
| 93 | |
| 94 | /// Returns the world->view transform for the head (used to calculate various display metrics) |
| 95 | const MatrixF& getHeadWorldViewMatrix() const { return mHeadWorldViewMatrix; } |
| 96 | |
| 97 | /// Return the view->world transform. This is a shortcut for getFrustum().getTransform(). |
| 98 | const MatrixF& getViewWorldMatrix() const { return mFrustum.getTransform(); } |
nothing calls this directly
no test coverage detected