random code cleaning, shouldn't affect anything

This commit is contained in:
Perttu Ahola 2011-02-18 22:25:25 +02:00
parent 74f4a0ece8
commit 4c2b9ed516
4 changed files with 56 additions and 91 deletions

@ -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.

@ -277,15 +277,13 @@ Doing now (most important at the top):
placement and transfer
* only_from_disk might not work anymore - check and fix it.
* Check the fixmes in the list above
* When sending blocks to the client, the server takes way too much
CPU time (20-30% for single player), find out what it is doing.
- Make a simple profiler
=== Making it more portable
* Some MSVC: std::sto* are defined without a namespace and collide
with the ones in utility.h
=== Features
* Add mud underground
* Make an "environment metafile" to store at least time of day
* Move digging property stuff from material.{h,cpp} to mapnode.cpp...
- Or maybe move content_features to material.{h,cpp}?
@ -1794,7 +1792,7 @@ int main(int argc, char *argv[])
//driver->setMinHardwareBufferVertexCount(50);
scene::ISceneManager* smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
gui::IGUISkin* skin = guienv->getSkin();
gui::IGUIFont* font = guienv->getFont(porting::getDataPath("fontlucida.png").c_str());
@ -2104,7 +2102,7 @@ int main(int argc, char *argv[])
if(camera == NULL)
return 1;
//video::SColor skycolor = video::SColor(255,90,140,200);
//video::SColor skycolor = video::SColor(255,166,202,244);
video::SColor skycolor = video::SColor(255,120,185,244);
@ -2113,6 +2111,23 @@ int main(int argc, char *argv[])
// Just so big a value that everything rendered is visible
camera->setFarValue(100000*BS);
/*
Lighting test code. Doesn't quite work this way.
The CPU-computed lighting is good.
*/
/*
smgr->addLightSceneNode(NULL,
v3f(0, BS*1000000, 0),
video::SColorf(0.3,0.3,0.3),
BS*10000000);
smgr->setAmbientLight(video::SColorf(0.0, 0.0, 0.0));
scene::ILightSceneNode *light = smgr->addLightSceneNode(camera,
v3f(0, 0, 0), video::SColorf(0.5,0.5,0.5), BS*4);
*/
f32 camera_yaw = 0; // "right/left"
f32 camera_pitch = 0; // "up/down"

@ -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++)
{

@ -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