Somewhat finished the 3D stuff (though it's terribly coded)

master
Joel Leclerc 2012-05-05 11:47:46 -06:00
parent e970a169d4
commit ba2a5a7ed1
19 changed files with 19 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

@ -1676,7 +1676,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
// Mesh update thread must be stopped while // Mesh update thread must be stopped while
// updating content definitions // updating content definitions
assert(!m_mesh_update_thread.IsRunning()); //assert(!m_mesh_update_thread.IsRunning());
int num_files = readU16(is2); int num_files = readU16(is2);
@ -1767,7 +1767,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
// Mesh update thread must be stopped while // Mesh update thread must be stopped while
// updating content definitions // updating content definitions
assert(!m_mesh_update_thread.IsRunning()); //assert(!m_mesh_update_thread.IsRunning());
/* /*
u16 command u16 command

View File

@ -96,7 +96,7 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
scene::IAnimatedMesh* createMeshFromFile(std::string filename, scene::ISceneManager* smgr) scene::IAnimatedMesh* createMeshFromFile(std::string filename, scene::ISceneManager* smgr)
{ {
std::string path = porting::path_user + DIR_DELIM + "cache" + std::string path = porting::path_user + DIR_DELIM + "cache" +
DIR_DELIM + "media" + DIR_DELIM; DIR_DELIM + "meshes" + DIR_DELIM;
std::string filepath = path + filename; std::string filepath = path + filename;
smgr->getParameters()->setAttribute( scene::CSM_TEXTURE_PATH, path.c_str() ); smgr->getParameters()->setAttribute( scene::CSM_TEXTURE_PATH, path.c_str() );
scene::SAnimatedMesh *anim_mesh = new scene::SAnimatedMesh( scene::SAnimatedMesh *anim_mesh = new scene::SAnimatedMesh(

View File

@ -1026,6 +1026,9 @@ Server::Server(
// Read Textures and calculate sha1 sums // Read Textures and calculate sha1 sums
fillMediaCache(); fillMediaCache();
// Read Meshes and calculate sha1 sums
fillMeshCache();
// Apply item aliases in the node definition manager // Apply item aliases in the node definition manager
m_nodedef->updateAliases(m_itemdef); m_nodedef->updateAliases(m_itemdef);
@ -2171,7 +2174,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
std::string checkpwd; std::string checkpwd;
bool has_auth = scriptapi_get_auth(m_lua, playername, &checkpwd, NULL); bool has_auth = scriptapi_get_auth(m_lua, playername, &checkpwd, NULL);
if(!has_auth){ if(!has_auth)
{
std::wstring raw_default_password = std::wstring raw_default_password =
narrow_to_wide(g_settings->get("default_password")); narrow_to_wide(g_settings->get("default_password"));
std::string use_password = std::string use_password =
@ -2186,12 +2190,14 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
has_auth = scriptapi_get_auth(m_lua, playername, &checkpwd, NULL); has_auth = scriptapi_get_auth(m_lua, playername, &checkpwd, NULL);
if(!has_auth){ if(!has_auth)
{
SendAccessDenied(m_con, peer_id, L"Not allowed to login"); SendAccessDenied(m_con, peer_id, L"Not allowed to login");
return; return;
} }
if(password != checkpwd){ if(password != checkpwd)
{
infostream<<"Server: peer_id="<<peer_id infostream<<"Server: peer_id="<<peer_id
<<": supplied invalid password for " <<": supplied invalid password for "
<<playername<<std::endl; <<playername<<std::endl;
@ -2284,7 +2290,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
sendMediaAnnouncement(peer_id); sendMediaAnnouncement(peer_id);
// Send mesh announcement // Send mesh announcement
//sendMeshAnnouncement(peer_id); sendMeshAnnouncement(peer_id);
// Send privileges // Send privileges
SendPlayerPrivileges(peer_id); SendPlayerPrivileges(peer_id);
@ -4123,7 +4129,6 @@ void Server::fillMediaCache()
paths.push_back(mod.path + DIR_DELIM + "textures"); paths.push_back(mod.path + DIR_DELIM + "textures");
paths.push_back(mod.path + DIR_DELIM + "sounds"); paths.push_back(mod.path + DIR_DELIM + "sounds");
paths.push_back(mod.path + DIR_DELIM + "media"); paths.push_back(mod.path + DIR_DELIM + "media");
paths.push_back(mod.path + DIR_DELIM + "meshes");
} }
// Collect media file information from paths into cache // Collect media file information from paths into cache
@ -4146,9 +4151,7 @@ void Server::fillMediaCache()
const char *supported_ext[] = { const char *supported_ext[] = {
".png", ".jpg", ".bmp", ".tga", ".png", ".jpg", ".bmp", ".tga",
".pcx", ".ppm", ".psd", ".wal", ".rgb", ".pcx", ".ppm", ".psd", ".wal", ".rgb",
".ogg", ".obj", ".3ds", ".md2", ".md3", ".ogg", NULL
".b3d", ".ply", ".stl",
NULL
}; };
if(removeStringEnd(filename, supported_ext) == ""){ if(removeStringEnd(filename, supported_ext) == ""){
infostream<<"Server: ignoring unsupported file extension: \"" infostream<<"Server: ignoring unsupported file extension: \""
@ -4539,7 +4542,7 @@ void Server::sendMeshAnnouncement(u16 peer_id)
*/ */
writeU16(os, TOCLIENT_ANNOUNCE_MESH); writeU16(os, TOCLIENT_ANNOUNCE_MESH);
writeU16(tmp_os, file_announcements.size()); writeU16(os, file_announcements.size());
for(core::list<SendableMeshAnnouncement>::Iterator for(core::list<SendableMeshAnnouncement>::Iterator
j = file_announcements.begin(); j = file_announcements.begin();
@ -4602,7 +4605,7 @@ void Server::sendRequestedMesh(u16 peer_id,
continue; continue;
} }
//TODO get path + name // TODO get path + name
std::string tpath = m_mesh[(*i).name].path; std::string tpath = m_mesh[(*i).name].path;
// Read data // Read data
@ -4675,9 +4678,9 @@ void Server::sendRequestedMesh(u16 peer_id,
*/ */
writeU16(os, TOCLIENT_MESH); writeU16(os, TOCLIENT_MESH);
writeU16(tmp_os, num_bunches); writeU16(os, num_bunches);
writeU16(tmp_os, i); writeU16(os, i);
writeU32(tmp_os, file_bunches[i].size()); writeU32(os, file_bunches[i].size());
for(core::list<SendableMesh>::Iterator for(core::list<SendableMesh>::Iterator
j = file_bunches[i].begin(); j = file_bunches[i].begin();