]> git.lizzy.rs Git - minetest.git/blobdiff - src/camera.h
This looks more like MC view bobbing, but still not even close
[minetest.git] / src / camera.h
index ba5d72bf41dd790613f6cad3487e1a8b8306aef2..dd9f30551cdc0a3816d7645c8e010e45174e2e34 100644 (file)
@@ -39,14 +39,21 @@ class Camera
        // Get player scene node.
        // This node is positioned at the player's torso (without any view bobbing),
        // as given by Player::m_position. Yaw is applied but not pitch.
-       // Things like wielded tools should be positioned relative to this node.
        inline scene::ISceneNode* getPlayerNode() const
        {
                return m_playernode;
        }
 
+       // Get head scene node.
+       // It has the eye transformation and pitch applied,
+       // but no view bobbing.
+       inline scene::ISceneNode* getHeadNode() const
+       {
+               return m_headnode;
+       }
+
        // Get camera scene node.
-       // It has the eye transformation and view bobbing applied.
+       // It has the eye transformation, pitch and view bobbing applied.
        inline scene::ICameraSceneNode* getCameraNode() const
        {
                return m_cameranode;
@@ -84,6 +91,9 @@ class Camera
                return MYMAX(m_fov_x, m_fov_y);
        }
 
+       // Checks if the constructor was able to create the scene nodes
+       bool successfullyCreated(std::wstring& error_message);
+
        // Step the camera: updates the viewing range and view bobbing.
        void step(f32 dtime);
 
@@ -101,6 +111,7 @@ class Camera
        // Scene manager and nodes
        scene::ISceneManager* m_smgr;
        scene::ISceneNode* m_playernode;
+       scene::ISceneNode* m_headnode;
        scene::ICameraSceneNode* m_cameranode;
 
        // draw control
@@ -136,8 +147,8 @@ class Camera
        // If 1, view bobbing is on (player is walking).
        // If 2, view bobbing is getting switched off.
        s32 m_view_bobbing_state;
-       // If true, view bobbing is slown down (player is swimming)
-       bool m_view_bobbing_slow;
+       // Speed of view bobbing animation
+       f32 m_view_bobbing_speed;
 };
 
 #endif