X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fsky.h;h=f1989177351a7c9420459353b5165851ac1e9789;hb=65c09a96f41705bb8e75fc5ff4276342be91ed11;hp=06a99310371f8b37de242806dd850d8f66091a6c;hpb=86a6cca3cf641fc2c88184ad26d2be3d7e7460f7;p=minetest.git diff --git a/src/sky.h b/src/sky.h index 06a993103..f19891773 100644 --- a/src/sky.h +++ b/src/sky.h @@ -19,27 +19,31 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes_extrabloated.h" #include -#include "localplayer.h" +#include "camera.h" #ifndef SKY_HEADER #define SKY_HEADER -#define SKY_MATERIAL_COUNT 3 +#define SKY_MATERIAL_COUNT 5 #define SKY_STAR_COUNT 200 +class ITextureSource; + // Skybox, rendered with zbuffer turned off, before all other nodes. class Sky : public scene::ISceneNode { public: //! constructor - Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, LocalPlayer* player); + Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, + ITextureSource *tsrc); virtual void OnRegisterSceneNode(); //! renders the node. virtual void render(); - virtual const core::aabbox3d& getBoundingBox() const; + virtual const aabb3f &getBoundingBox() const + { return m_box; } // Used by Irrlicht for optimizing rendering virtual video::SMaterial& getMaterial(u32 i) @@ -50,7 +54,8 @@ class Sky : public scene::ISceneNode { return SKY_MATERIAL_COUNT; } void update(float m_time_of_day, float time_brightness, - float direct_brightness, bool sunlight_seen); + float direct_brightness, bool sunlight_seen, CameraMode cam_mode, + float yaw, float pitch); float getBrightness(){ return m_brightness; } @@ -70,7 +75,7 @@ class Sky : public scene::ISceneNode } private: - core::aabbox3d Box; + aabb3f m_box; video::SMaterial m_materials[SKY_MATERIAL_COUNT]; // How much sun & moon transition should affect horizon color @@ -78,7 +83,8 @@ class Sky : public scene::ISceneNode { if (!m_sunlight_seen) return 0; - float x; m_time_of_day >= 0.5 ? x = (1 - m_time_of_day) * 2 : x = m_time_of_day * 2; + float x = m_time_of_day >= 0.5 ? (1 - m_time_of_day) * 2 : m_time_of_day * 2; + if (x <= 0.3) return 0; if (x <= 0.4) // when the sun and moon are aligned @@ -125,9 +131,11 @@ class Sky : public scene::ISceneNode video::SColor m_skycolor; video::SColorf m_cloudcolor_f; v3f m_stars[SKY_STAR_COUNT]; - u16 m_star_indices[SKY_STAR_COUNT*4]; video::S3DVertex m_star_vertices[SKY_STAR_COUNT*4]; - LocalPlayer* m_player; + video::ITexture* m_sun_texture; + video::ITexture* m_moon_texture; + video::ITexture* m_sun_tonemap; + video::ITexture* m_moon_tonemap; }; #endif