X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fitemdef.cpp;h=10e1afe2dbaedcf160e1ad692a5030d0ffda3b8e;hb=58e6d25e033c76dc91aaac18fdeda92ac23fe0e1;hp=c520ea902736f4c355710d0755c7a2119f58e3be;hpb=dc407e219f8b0394f3a4d10ea8379b8678d98d1c;p=oweals%2Fminetest.git diff --git a/src/itemdef.cpp b/src/itemdef.cpp index c520ea902..10e1afe2d 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -38,6 +38,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +#ifdef __ANDROID__ +#include +#endif + /* ItemDefinition */ @@ -390,16 +394,18 @@ public: /* Make a mesh from the node */ + bool reenable_shaders = false; + if(g_settings->getBool("enable_shaders")){ + reenable_shaders = true; + g_settings->setBool("enable_shaders",false); + } MeshMakeData mesh_make_data(gamedef); MapNode mesh_make_node(id, param1, 0); mesh_make_data.fillSingleNode(&mesh_make_node); - MapBlockMesh mapblock_mesh(&mesh_make_data); - + MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0)); scene::IMesh *node_mesh = mapblock_mesh.getMesh(); assert(node_mesh); video::SColor c(255, 255, 255, 255); - if(g_settings->getBool("enable_shaders")) - c = MapBlock_LightColor(255, 0xffff, decode_light(f.light_source)); setMeshColor(node_mesh, c); /* @@ -431,6 +437,11 @@ public: params.light_color.set(1.0, 0.5, 0.5, 0.5); params.light_radius = 1000; +#ifdef __ANDROID__ + params.camera_position.set(0, -1.0, -1.5); + params.camera_position.rotateXZBy(45); + params.light_position.set(10, -100, -50); +#endif cc->inventory_texture = tsrc->generateTextureFromMesh(params); @@ -455,6 +466,9 @@ public: //no way reference count can be smaller than 2 in this place! assert(cc->wield_mesh->getReferenceCount() >= 2); + + if (reenable_shaders) + g_settings->setBool("enable_shaders",true); } // Put in cache @@ -477,21 +491,24 @@ public: else { // We're gonna ask the result to be put into here - ResultQueue result_queue; + static ResultQueue result_queue; + // Throw a request in m_get_clientcached_queue.add(name, 0, 0, &result_queue); try{ - // Wait result for a second - GetResult + while(true) { + // Wait result for a second + GetResult result = result_queue.pop_front(1000); - // Check that at least something worked OK - assert(result.key == name); - // Return it - return result.item; + + if (result.key == name) { + return result.item; + } + } } catch(ItemNotFoundException &e) { - errorstream<<"Waiting for clientcached timed out."<