random code cleaning, shouldn't affect anything
authorPerttu Ahola <celeron55@gmail.com>
Fri, 18 Feb 2011 20:25:25 +0000 (22:25 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Fri, 18 Feb 2011 20:25:25 +0000 (22:25 +0200)
src/light.cpp
src/main.cpp
src/mapblock.cpp
src/server.cpp

index 1e4dfcdf12051f813d6e3354e6db7debd2b98287..5dade2e16e9177f793ed12b6b3f0ff66334e6d3c 100644 (file)
@@ -19,7 +19,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "light.h"
 
+// This is reasonable with classic lighting with a light source
+/*u8 light_decode_table[LIGHT_MAX+1] = 
+{
+2,
+3,
+4,
+6,
+9,
+13,
+18,
+25,
+32,
+35,
+45,
+57,
+69,
+79,
+255
+};*/
+
 
+// This is good
 // a_n+1 = a_n * 0.786
 // Length of LIGHT_MAX+1 means LIGHT_MAX is the last value.
 // LIGHT_SUN is read as LIGHT_MAX from here.
index b0fe59320548f6d57b16122e3fa07b4e4f606d0e..11ae9985c54a9e9e5a137a51c9f5abb000f54a9f 100644 (file)
@@ -277,15 +277,13 @@ Doing now (most important at the top):
   placement and transfer\r
 * only_from_disk might not work anymore - check and fix it.\r
 * Check the fixmes in the list above\r
-* When sending blocks to the client, the server takes way too much\r
-  CPU time (20-30% for single player), find out what it is doing.\r
-  - Make a simple profiler\r
 \r
 === Making it more portable\r
 * Some MSVC: std::sto* are defined without a namespace and collide\r
   with the ones in utility.h\r
 \r
 === Features\r
+* Add mud underground\r
 * Make an "environment metafile" to store at least time of day\r
 * Move digging property stuff from material.{h,cpp} to mapnode.cpp...\r
   - Or maybe move content_features to material.{h,cpp}?\r
@@ -1794,7 +1792,7 @@ int main(int argc, char *argv[])
        //driver->setMinHardwareBufferVertexCount(50);\r
 \r
        scene::ISceneManager* smgr = device->getSceneManager();\r
-       \r
+\r
        guienv = device->getGUIEnvironment();\r
        gui::IGUISkin* skin = guienv->getSkin();\r
        gui::IGUIFont* font = guienv->getFont(porting::getDataPath("fontlucida.png").c_str());\r
@@ -2104,7 +2102,7 @@ int main(int argc, char *argv[])
 \r
        if(camera == NULL)\r
                return 1;\r
-       \r
+\r
        //video::SColor skycolor = video::SColor(255,90,140,200);\r
        //video::SColor skycolor = video::SColor(255,166,202,244);\r
        video::SColor skycolor = video::SColor(255,120,185,244);\r
@@ -2113,6 +2111,23 @@ int main(int argc, char *argv[])
 \r
        // Just so big a value that everything rendered is visible\r
        camera->setFarValue(100000*BS);\r
+       \r
+       /*\r
+               Lighting test code. Doesn't quite work this way.\r
+               The CPU-computed lighting is good.\r
+       */\r
+\r
+       /*\r
+       smgr->addLightSceneNode(NULL,\r
+               v3f(0, BS*1000000, 0),\r
+               video::SColorf(0.3,0.3,0.3),\r
+               BS*10000000);\r
+\r
+       smgr->setAmbientLight(video::SColorf(0.0, 0.0, 0.0));\r
+\r
+       scene::ILightSceneNode *light = smgr->addLightSceneNode(camera,\r
+                       v3f(0, 0, 0), video::SColorf(0.5,0.5,0.5), BS*4);\r
+       */\r
 \r
        f32 camera_yaw = 0; // "right/left"\r
        f32 camera_pitch = 0; // "up/down"\r
index 1dbbe5c4ef43122b35a54e6abac7071e32c78005..a1e3c6694c5138b2d378677d1e11f0b7d2677472 100644 (file)
@@ -255,32 +255,18 @@ void MapBlock::makeFastFace(TileSpec tile, u8 light, v3f p,
 
        video::SColor c = video::SColor(alpha,li,li,li);
 
-       face.vertices[0] = video::S3DVertex(vertex_pos[0], zerovector, c,
-                       core::vector2d<f32>(abs_scale,1));
-       face.vertices[1] = video::S3DVertex(vertex_pos[1], zerovector, c,
-                       core::vector2d<f32>(0,1));
-       face.vertices[2] = video::S3DVertex(vertex_pos[2], zerovector, c,
-                       core::vector2d<f32>(0,0));
-       face.vertices[3] = video::S3DVertex(vertex_pos[3], zerovector, c,
-                       core::vector2d<f32>(abs_scale,0));
-       
-       /*float x0 = (float)tile.tx/256.0;
-       float y0 = (float)tile.ty/256.0;
-       float w = ((float)tile.tw + 1.0)/256.0;
-       float h = ((float)tile.th + 1.0)/256.0;*/
-
        float x0 = tile.texture.pos.X;
        float y0 = tile.texture.pos.Y;
        float w = tile.texture.size.X;
        float h = tile.texture.size.Y;
 
-       face.vertices[0] = video::S3DVertex(vertex_pos[0], zerovector, c,
+       face.vertices[0] = video::S3DVertex(vertex_pos[0], v3f(0,1,0), c,
                        core::vector2d<f32>(x0+w*abs_scale, y0+h));
-       face.vertices[1] = video::S3DVertex(vertex_pos[1], zerovector, c,
+       face.vertices[1] = video::S3DVertex(vertex_pos[1], v3f(0,1,0), c,
                        core::vector2d<f32>(x0, y0+h));
-       face.vertices[2] = video::S3DVertex(vertex_pos[2], zerovector, c,
+       face.vertices[2] = video::S3DVertex(vertex_pos[2], v3f(0,1,0), c,
                        core::vector2d<f32>(x0, y0));
-       face.vertices[3] = video::S3DVertex(vertex_pos[3], zerovector, c,
+       face.vertices[3] = video::S3DVertex(vertex_pos[3], v3f(0,1,0), c,
                        core::vector2d<f32>(x0+w*abs_scale, y0));
 
        face.tile = tile;
@@ -736,12 +722,11 @@ void MapBlock::updateMesh(u32 daynight_ratio)
                //TimeTaker timer2("updateMesh() mesh building");
 
                video::SMaterial material;
-               material.Lighting = false;
-               //material.BackfaceCulling = false;
+               material.setFlag(video::EMF_LIGHTING, false);
                material.setFlag(video::EMF_BILINEAR_FILTER, false);
+               material.setFlag(video::EMF_FOG_ENABLE, true);
                //material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
                //material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_SIMPLE);
-               material.setFlag(video::EMF_FOG_ENABLE, true);
 
                for(u32 i=0; i<fastfaces_new.size(); i++)
                {
index 31ebfacbb5d888294f6c09cb65351e38116f5866..26d0d5d75f98c4401ed5adcf926ec5d468cb1429 100644 (file)
@@ -2097,7 +2097,6 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                                if(content_features(n.d).wall_mounted)
                                        n.dir = packDir(p_under - p_over);
 
-#if 1
                                // Create packet
                                u32 replysize = 8 + MapNode::serializedLength(peer_ser_ver);
                                SharedBuffer<u8> reply(replysize);
@@ -2131,76 +2130,21 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                                */
                                core::map<v3s16, MapBlock*> modified_blocks;
                                m_env.getMap().addNodeAndUpdate(p_over, n, modified_blocks);
-#endif
-#if 0
-                               /*
-                                       Handle inventory
-                               */
-                               InventoryList *ilist = player->inventory.getList("main");
-                               if(g_settings.getBool("creative_mode") == false && ilist)
-                               {
-                                       // Remove from inventory and send inventory
-                                       if(mitem->getCount() == 1)
-                                               ilist->deleteItem(item_i);
-                                       else
-                                               mitem->remove(1);
-                                       // Send inventory
-                                       SendInventory(peer_id);
-                               }
-
-                               /*
-                                       Add node.
-
-                                       This takes some time so it is done after the quick stuff
-                               */
-                               core::map<v3s16, MapBlock*> modified_blocks;
-                               m_env.getMap().addNodeAndUpdate(p_over, n, modified_blocks);
-
+                               
                                /*
-                                       Set the modified blocks unsent for all the clients
+                                       Calculate special events
                                */
                                
-                               //JMutexAutoLock lock2(m_con_mutex);
-
-                               for(core::map<u16, RemoteClient*>::Iterator
-                                               i = m_clients.getIterator();
-                                               i.atEnd() == false; i++)
+                               /*if(n.d == CONTENT_MESE)
                                {
-                                       RemoteClient *client = i.getNode()->getValue();
-                                       
-                                       if(modified_blocks.size() > 0)
+                                       u32 count = 0;
+                                       for(s16 z=-1; z<=1; z++)
+                                       for(s16 y=-1; y<=1; y++)
+                                       for(s16 x=-1; x<=1; x++)
                                        {
-                                               // Remove block from sent history
-                                               client->SetBlocksNotSent(modified_blocks);
+                                               
                                        }
-                               }
-#endif
-
-#if 0
-                               /*
-                                       Update water
-                               */
-                               
-                               // Update water pressure around modification
-                               // This also adds it to m_flow_active_nodes if appropriate
-
-                               MapVoxelManipulator v(&m_env.getMap());
-                               v.m_disable_water_climb =
-                                               g_settings.getBool("disable_water_climb");
-                               
-                               VoxelArea area(p_over-v3s16(1,1,1), p_over+v3s16(1,1,1));
-
-                               try
-                               {
-                                       v.updateAreaWaterPressure(area, m_flow_active_nodes);
-                               }
-                               catch(ProcessingLimitException &e)
-                               {
-                                       dstream<<"Processing limit reached (1)"<<std::endl;
-                               }
-                               
-                               v.blitBack(modified_blocks);
-#endif
+                               }*/
                        }
                        /*
                                Handle other items