#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.
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
//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
\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
\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
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;
//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++)
{
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);
*/
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