]> git.lizzy.rs Git - minetest.git/blobdiff - src/sky.cpp
Set server_announce to world.mt and respect modes when changing subgame
[minetest.git] / src / sky.cpp
index 00072f17f37b27125a7db395a84d1c2130398152..01fb8ef860ed140e5d434d59139727c8ddbd71d8 100644 (file)
@@ -3,17 +3,17 @@
 #include "ISceneManager.h"
 #include "ICameraSceneNode.h"
 #include "S3DVertex.h"
-#include "tile.h" // getTexturePath
-#include "noise.h" // easeCurve
-#include "main.h" // g_profiler
+#include "client/tile.h"
+#include "noise.h"            // easeCurve
 #include "profiler.h"
-#include "util/numeric.h" // MYMIN
+#include "util/numeric.h"
 #include <cmath>
 #include "settings.h"
-#include "camera.h" // CameraModes
+#include "camera.h"           // CameraModes
 
 //! constructor
-Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):
+Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
+               ITextureSource *tsrc):
                scene::ISceneNode(parent, mgr, id),
                m_visible(true),
                m_fallback_bg_color(255,255,255,255),
@@ -46,19 +46,18 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):
        m_materials[1].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
 
        m_materials[2] = mat;
-       m_materials[2].setTexture(0, mgr->getVideoDriver()->getTexture(
-                       getTexturePath("sunrisebg.png").c_str()));
+       m_materials[2].setTexture(0, tsrc->getTextureForMesh("sunrisebg.png"));
        m_materials[2].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
        //m_materials[2].MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
 
-       m_sun_texture = mgr->getVideoDriver()->getTexture(
-                       getTexturePath("sun.png").c_str());
-       m_moon_texture = mgr->getVideoDriver()->getTexture(
-                       getTexturePath("moon.png").c_str());
-       m_sun_tonemap = mgr->getVideoDriver()->getTexture(
-                       getTexturePath("sun_tonemap.png").c_str());
-       m_moon_tonemap = mgr->getVideoDriver()->getTexture(
-                       getTexturePath("moon_tonemap.png").c_str());
+       m_sun_texture = tsrc->isKnownSourceImage("sun.png") ?
+               tsrc->getTextureForMesh("sun.png") : NULL;
+       m_moon_texture = tsrc->isKnownSourceImage("moon.png") ?
+               tsrc->getTextureForMesh("moon.png") : NULL;
+       m_sun_tonemap = tsrc->isKnownSourceImage("sun_tonemap.png") ?
+               tsrc->getTexture("sun_tonemap.png") : NULL;
+       m_moon_tonemap = tsrc->isKnownSourceImage("moon_tonemap.png") ?
+               tsrc->getTexture("moon_tonemap.png") : NULL;
 
        if (m_sun_texture){
                m_materials[3] = mat;