]> git.lizzy.rs Git - minetest.git/blobdiff - src/map.h
added dedicated server build without irrlicht
[minetest.git] / src / map.h
index 6944107dfeb57d05b2d1335698ed2926079a1263..581708a361efc2a0975be1e020bdc57450d6035a 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -224,6 +224,11 @@ class Map : public NodeContainer, public Heightmappish
                return MAPTYPE_BASE;
        }
 
+       virtual void drop()
+       {
+               delete this;
+       }
+
        void updateCamera(v3f pos, v3f dir)
        {
                JMutexAutoLock lock(m_camera_mutex);
@@ -333,25 +338,33 @@ class Map : public NodeContainer, public Heightmappish
                blockref->setNode(relpos, n);
        }*/
 
-       void unspreadLight(core::map<v3s16, u8> & from_nodes,
+       void unspreadLight(enum LightBank bank,
+                       core::map<v3s16, u8> & from_nodes,
                        core::map<v3s16, bool> & light_sources,
                        core::map<v3s16, MapBlock*> & modified_blocks);
 
-       void unLightNeighbors(v3s16 pos, u8 lightwas,
+       void unLightNeighbors(enum LightBank bank,
+                       v3s16 pos, u8 lightwas,
                        core::map<v3s16, bool> & light_sources,
                        core::map<v3s16, MapBlock*> & modified_blocks);
        
-       void spreadLight(core::map<v3s16, bool> & from_nodes,
+       void spreadLight(enum LightBank bank,
+                       core::map<v3s16, bool> & from_nodes,
                        core::map<v3s16, MapBlock*> & modified_blocks);
        
-       void lightNeighbors(v3s16 pos,
+       void lightNeighbors(enum LightBank bank,
+                       v3s16 pos,
                        core::map<v3s16, MapBlock*> & modified_blocks);
 
-       v3s16 getBrightestNeighbour(v3s16 p);
+       v3s16 getBrightestNeighbour(enum LightBank bank, v3s16 p);
 
        s16 propagateSunlight(v3s16 start,
                        core::map<v3s16, MapBlock*> & modified_blocks);
        
+       void updateLighting(enum LightBank bank,
+                       core::map<v3s16, MapBlock*>  & a_blocks,
+                       core::map<v3s16, MapBlock*> & modified_blocks);
+                       
        void updateLighting(core::map<v3s16, MapBlock*>  & a_blocks,
                        core::map<v3s16, MapBlock*> & modified_blocks);
                        
@@ -363,11 +376,20 @@ class Map : public NodeContainer, public Heightmappish
        void removeNodeAndUpdate(v3s16 p,
                        core::map<v3s16, MapBlock*> &modified_blocks);
        
+#ifndef SERVER
+       void expireMeshes(bool only_daynight_diffed);
+       
        /*
                Updates the faces of the given block and blocks on the
                leading edge.
        */
-       void updateMeshes(v3s16 blockpos);
+       void updateMeshes(v3s16 blockpos, u32 daynight_ratio);
+#endif
+
+       /*
+               Takes the blocks at the trailing edges into account
+       */
+       bool dayNightDiffed(v3s16 blockpos);
 
        //core::aabbox3d<s16> getDisplayedBlockArea();
 
@@ -515,6 +537,8 @@ class ServerMap : public Map
        bool m_map_saving_enabled;
 };
 
+#ifndef SERVER
+
 class Client;
 
 class ClientMap : public Map, public scene::ISceneNode
@@ -522,7 +546,9 @@ class ClientMap : public Map, public scene::ISceneNode
 public:
        ClientMap(
                        Client *client,
-                       video::SMaterial *materials,
+                       JMutex &range_mutex,
+                       s16 &viewing_range_nodes,
+                       bool &viewing_range_all,
                        scene::ISceneNode* parent,
                        scene::ISceneManager* mgr,
                        s32 id
@@ -535,6 +561,11 @@ class ClientMap : public Map, public scene::ISceneNode
                return MAPTYPE_CLIENT;
        }
 
+       void drop()
+       {
+               ISceneNode::drop();
+       }
+
        /*
                Forcefully get a sector from somewhere
        */
@@ -546,23 +577,13 @@ class ClientMap : public Map, public scene::ISceneNode
                ISceneNode methods
        */
 
-       virtual void OnRegisterSceneNode()
-       {
-               if(IsVisible)
-               {
-                       //SceneManager->registerNodeForRendering(this, scene::ESNRP_SKY_BOX);
-                       SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
-                       SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
-               }
-
-               ISceneNode::OnRegisterSceneNode();
-       }
+       virtual void OnRegisterSceneNode();
 
        virtual void render()
        {
                video::IVideoDriver* driver = SceneManager->getVideoDriver();
                driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
-               renderMap(driver, m_materials, SceneManager->getSceneNodeRenderPass());
+               renderMap(driver, SceneManager->getSceneNodeRenderPass());
        }
        
        virtual const core::aabbox3d<f32>& getBoundingBox() const
@@ -570,8 +591,7 @@ class ClientMap : public Map, public scene::ISceneNode
                return m_box;
        }
 
-       void renderMap(video::IVideoDriver* driver,
-               video::SMaterial *materials, s32 pass);
+       void renderMap(video::IVideoDriver* driver, s32 pass);
 
        // Update master heightmap mesh
        void updateMesh();
@@ -582,15 +602,19 @@ class ClientMap : public Map, public scene::ISceneNode
 private:
        Client *m_client;
        
-       video::SMaterial *m_materials;
-
        core::aabbox3d<f32> m_box;
        
        // This is the master heightmap mesh
        scene::SMesh *mesh;
        JMutex mesh_mutex;
+
+       JMutex &m_range_mutex;
+       s16 &m_viewing_range_nodes;
+       bool &m_viewing_range_all;
 };
 
+#endif
+
 class MapVoxelManipulator : public VoxelManipulator
 {
 public: