X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fcamera.h;h=b0d190a3afc5710013f45b09d9b185c3932f50c3;hb=972d17baea81ffe6d508b291ef97207a4822e1da;hp=d1c3b59d4d177ba373b9d26ad74eaf703498c808;hpb=118e2ae865bd7a0020586ef72d05bf14d66f4eae;p=minetest.git diff --git a/src/camera.h b/src/camera.h index d1c3b59d4..b0d190a3a 100644 --- a/src/camera.h +++ b/src/camera.h @@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes_extrabloated.h" #include "inventory.h" #include "mesh.h" -#include "tile.h" +#include "client/tile.h" #include "util/numeric.h" #include @@ -32,8 +32,9 @@ with this program; if not, write to the Free Software Foundation, Inc., class LocalPlayer; struct MapDrawControl; class IGameDef; +class WieldMeshSceneNode; -enum CameraModes {CAMERA_MODE_FIRST, CAMERA_MODE_THIRD, CAMERA_MODE_THIRD_FRONT}; +enum CameraMode {CAMERA_MODE_FIRST, CAMERA_MODE_THIRD, CAMERA_MODE_THIRD_FRONT}; /* Client camera class, manages the player and camera scene nodes, the viewing distance @@ -109,7 +110,7 @@ class Camera } // Checks if the constructor was able to create the scene nodes - bool successfullyCreated(std::wstring& error_message); + bool successfullyCreated(std::string &error_message); // Step the camera: updates the viewing range and view bobbing. void step(f32 dtime); @@ -117,8 +118,7 @@ class Camera // Update the camera from the local player's position. // busytime is used to adjust the viewing range. void update(LocalPlayer* player, f32 frametime, f32 busytime, - v2u32 screensize, f32 tool_reload_ratio, - int current_camera_mode, ClientEnvironment &c_env); + f32 tool_reload_ratio, ClientEnvironment &c_env); // Render distance feedback loop void updateViewingRange(f32 frametime_in, f32 busytime_in); @@ -128,12 +128,28 @@ class Camera void setDigging(s32 button); // Replace the wielded item mesh - void wield(const ItemStack &item, u16 playeritem); + void wield(const ItemStack &item); // Draw the wielded tool. // This has to happen *after* the main scene is drawn. // Warning: This clears the Z buffer. - void drawWieldedTool(); + void drawWieldedTool(irr::core::matrix4* translation=NULL); + + // Toggle the current camera mode + void toggleCameraMode() { + if (m_camera_mode == CAMERA_MODE_FIRST) + m_camera_mode = CAMERA_MODE_THIRD; + else if (m_camera_mode == CAMERA_MODE_THIRD) + m_camera_mode = CAMERA_MODE_THIRD_FRONT; + else + m_camera_mode = CAMERA_MODE_FIRST; + } + + //read the current camera mode + inline CameraMode getCameraMode() + { + return m_camera_mode; + } private: // Nodes @@ -142,8 +158,8 @@ class Camera scene::ICameraSceneNode* m_cameranode; scene::ISceneManager* m_wieldmgr; - scene::IMeshSceneNode* m_wieldnode; - u8 m_wieldlight; + WieldMeshSceneNode* m_wieldnode; + scene::ILightSceneNode* m_wieldlightnode; // draw control MapDrawControl& m_draw_control; @@ -188,14 +204,17 @@ class Camera // If 1, right-click digging animation s32 m_digging_button; - //dummymesh for camera - irr::scene::IAnimatedMesh* m_dummymesh; - // Animation when changing wielded item f32 m_wield_change_timer; - scene::IMesh *m_wield_mesh_next; - u16 m_previous_playeritem; - std::string m_previous_itemname; + ItemStack m_wield_item_next; + + CameraMode m_camera_mode; + + f32 m_cache_fall_bobbing_amount; + f32 m_cache_view_bobbing_amount; + f32 m_cache_wanted_fps; + f32 m_cache_fov; + bool m_cache_view_bobbing; }; #endif