aboutsummaryrefslogtreecommitdiff
path: root/src/mapblock_mesh.cpp
Commit message (Expand)AuthorAge
* Mapblock mesh: Fix updateFastFaceRow tiling issueobneq2016-08-18
* Mapblock mesh: Allow to use VBORealBadAngel2016-02-26
* Dont make fastface if tile is not seamlessRealBadAngel2016-02-21
* Mapblock mesh: Eliminate meshgen lagsRealBadAngel2016-02-16
* Use vertices with tangents only when its needed.RealBadAngel2016-02-15
* Cleanup selection mesh code, add shaders for halo and selection boxesRealBadAngel2016-02-08
* Use tangent space meshes only when shaders are enabledRealBadAngel2016-02-07
* Change i++ to ++iDavid Jones2015-08-25
* Fixed minimap memory leakBřetislav Štec2015-07-27
* Fix relief mapping issuesRealBadAngel2015-07-16
* Clean-up Minimap codekwolekr2015-07-08
* Add minimap featureRealBadAngel2015-06-27
* Automated whitespace error fix for last commitest312015-06-14
* Improved parallax mapping. Generate heightmaps on the fly.RealBadAngel2015-06-14
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
* Move texture_min_size even further down the pipe. Now, textures are JIT-upsca...Aaron Suen2015-03-31
* Optimise MapBlockMesh related functionsgregorycu2015-02-23
* Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" se...Craig Robbins2015-02-11
* Revert "Remove workaround in itemdef.cpp to enable/disable/enable "enable_sha...Craig Robbins2015-02-11
* Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" se...Craig Robbins2015-02-11
* Fix potential out-of-bounds array indexCraig Robbins2015-01-16
* Added configurable ambient_occlusion_gamma. Default is 2.2 (same as previous ...TriBlade92015-01-14
* Removed superfluous facedir check in mapblock_mesh.cppCraig Robbins2015-01-10
* Change TileSpec::frames to be std::vector not std::mapunknown2014-12-21
* Increase performance of getLight() by at least 2xCraig Robbins2014-12-10
* Restore finalColorBlend implementation in shaders.RealBadAngel2014-12-07
* Fix smooth lighting (ambient occlusion)Craig Robbins2014-11-22
* Optimise functions from CNodeDefManager and VoxelManipulatorCraig Robbins2014-11-21
* Optimise getTileInfo()Craig Robbins2014-11-21
* Implement WieldMeshSceneNode which improves wield mesh renderingKahrl2014-11-08
* Various uninitialised variable fixesCraig Robbins2014-10-19
* Add meshnode drawtype.RealBadAngel2014-10-18
* Node highlighting.RealBadAngel2014-09-17
* Pass light sources in blue channel of vertex color instead of decoded light f...RealBadAngel2014-08-21
* Let lighting be done only CPU side. Remove finalColorBlend implementation fro...RealBadAngel2014-08-16
* Make faces shading correct for all possible modes.RealBadAngel2014-08-14
* Speedup mapblock_meshRealBadAngel2014-07-17
* Faces shading fixesRealBadAngel2014-07-07
* Fix non-smooth non-shader node shading (Fixes #1436, regression by commit a0f...Perttu Ahola2014-07-06
* Fix regression in light calculationsapier2014-06-30
* Minor fix in check ordersapier2014-06-23
* Speedup getTileInfo by up to 30%sapier2014-06-23
* Improved faces shading with and without shaders.RealBadAngel2014-06-17
* Unite nodes shaders.RealBadAngel2014-06-15
* Fixed wrong node texture rotation for facedirs 5 and 7MetaDucky2014-04-23
* Pass pointer to nodedef directly to avoid recalculation in quite often called...sapier2014-04-06
* Normal maps generation on the fly.RealBadAngel2014-03-21
* Fix rendering glitches when far from the center of the mapNovatux2014-03-04
* Optimize shaders code. Add settings at compile time.RealBadAngel2013-12-09
* Shaders rework.RealBadAngel2013-12-03
l kwd">lua_getfield(L, -1, "registered_on_newplayers"); // Call callbacks objectrefGetOrCreate(L, player); runCallbacks(1, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiPlayer::on_dieplayer(ServerActiveObject *player, const PlayerHPChangeReason &reason) { SCRIPTAPI_PRECHECKHEADER // Get callback table lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_dieplayers"); // Push arguments objectrefGetOrCreate(L, player); pushPlayerHPChangeReason(L, reason); // Run callbacks runCallbacks(2, RUN_CALLBACKS_MODE_FIRST); } bool ScriptApiPlayer::on_punchplayer(ServerActiveObject *player, ServerActiveObject *hitter, float time_from_last_punch, const ToolCapabilities *toolcap, v3f dir, s16 damage) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_punchplayers lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_punchplayers"); // Call callbacks objectrefGetOrCreate(L, player); objectrefGetOrCreate(L, hitter); lua_pushnumber(L, time_from_last_punch); push_tool_capabilities(L, *toolcap); push_v3f(L, dir); lua_pushnumber(L, damage); runCallbacks(6, RUN_CALLBACKS_MODE_OR); return readParam<bool>(L, -1); } s32 ScriptApiPlayer::on_player_hpchange(ServerActiveObject *player, s32 hp_change, const PlayerHPChangeReason &reason) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Get core.registered_on_player_hpchange lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_player_hpchange"); lua_remove(L, -2); // Push arguments objectrefGetOrCreate(L, player); lua_pushnumber(L, hp_change); pushPlayerHPChangeReason(L, reason); // Call callbacks PCALL_RES(lua_pcall(L, 3, 1, error_handler)); hp_change = lua_tointeger(L, -1); lua_pop(L, 2); // Pop result and error handler return hp_change; } bool ScriptApiPlayer::on_respawnplayer(ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_respawnplayers lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_respawnplayers"); // Call callbacks objectrefGetOrCreate(L, player); runCallbacks(1, RUN_CALLBACKS_MODE_OR); return readParam<bool>(L, -1); } bool ScriptApiPlayer::on_prejoinplayer( const std::string &name, const std::string &ip, std::string *reason) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_prejoinplayers lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_prejoinplayers"); lua_pushstring(L, name.c_str()); lua_pushstring(L, ip.c_str()); runCallbacks(2, RUN_CALLBACKS_MODE_OR); if (lua_isstring(L, -1)) { reason->assign(readParam<std::string>(L, -1)); return true; } return false; } bool ScriptApiPlayer::can_bypass_userlimit(const std::string &name, const std::string &ip) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_prejoinplayers lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_can_bypass_userlimit"); lua_pushstring(L, name.c_str()); lua_pushstring(L, ip.c_str()); runCallbacks(2, RUN_CALLBACKS_MODE_OR); return lua_toboolean(L, -1); } void ScriptApiPlayer::on_joinplayer(ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_joinplayers lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_joinplayers"); // Call callbacks objectrefGetOrCreate(L, player); runCallbacks(1, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiPlayer::on_leaveplayer(ServerActiveObject *player, bool timeout) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_leaveplayers lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_leaveplayers"); // Call callbacks objectrefGetOrCreate(L, player); lua_pushboolean(L, timeout); runCallbacks(2, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiPlayer::on_cheat(ServerActiveObject *player, const std::string &cheat_type) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_cheats lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_cheats"); // Call callbacks objectrefGetOrCreate(L, player); lua_newtable(L); lua_pushlstring(L, cheat_type.c_str(), cheat_type.size()); lua_setfield(L, -2, "type"); runCallbacks(2, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player, const std::string &formname, const StringMap &fields) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_player_receive_fields lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_player_receive_fields"); // Call callbacks // param 1 objectrefGetOrCreate(L, player); // param 2 lua_pushstring(L, formname.c_str()); // param 3 lua_newtable(L); StringMap::const_iterator it; for (it = fields.begin(); it != fields.end(); ++it) { const std::string &name = it->first; const std::string &value = it->second; lua_pushstring(L, name.c_str()); lua_pushlstring(L, value.c_str(), value.size()); lua_settable(L, -3); } runCallbacks(3, RUN_CALLBACKS_MODE_OR_SC); } void ScriptApiPlayer::on_auth_failure(const std::string &name, const std::string &ip) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_auth_failure lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_auth_fail"); lua_pushstring(L, name.c_str()); lua_pushstring(L, ip.c_str()); runCallbacks(2, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiPlayer::pushMoveArguments( const MoveAction &ma, int count, ServerActiveObject *player) { lua_State *L = getStack(); objectrefGetOrCreate(L, player); // player lua_pushstring(L, "move"); // action InvRef::create(L, ma.from_inv); // inventory lua_newtable(L); { // Table containing the action information lua_pushstring(L, ma.from_list.c_str()); lua_setfield(L, -2, "from_list"); lua_pushstring(L, ma.to_list.c_str()); lua_setfield(L, -2, "to_list"); lua_pushinteger(L, ma.from_i + 1); lua_setfield(L, -2, "from_index"); lua_pushinteger(L, ma.to_i + 1); lua_setfield(L, -2, "to_index"); lua_pushinteger(L, count); lua_setfield(L, -2, "count"); } } void ScriptApiPlayer::pushPutTakeArguments( const char *method, const InventoryLocation &loc, const std::string &listname, int index, const ItemStack &stack, ServerActiveObject *player) { lua_State *L = getStack(); objectrefGetOrCreate(L, player); // player lua_pushstring(L, method); // action InvRef::create(L, loc); // inventory lua_newtable(L); { // Table containing the action information lua_pushstring(L, listname.c_str()); lua_setfield(L, -2, "listname"); lua_pushinteger(L, index + 1); lua_setfield(L, -2, "index"); LuaItemStack::create(L, stack); lua_setfield(L, -2, "stack"); } } // Return number of accepted items to be moved int ScriptApiPlayer::player_inventory_AllowMove( const MoveAction &ma, int count, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_allow_player_inventory_actions"); pushMoveArguments(ma, count, player); runCallbacks(4, RUN_CALLBACKS_MODE_OR_SC); return lua_type(L, -1) == LUA_TNUMBER ? lua_tonumber(L, -1) : count; } // Return number of accepted items to be put int ScriptApiPlayer::player_inventory_AllowPut( const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_allow_player_inventory_actions"); pushPutTakeArguments("put", ma.to_inv, ma.to_list, ma.to_i, stack, player); runCallbacks(4, RUN_CALLBACKS_MODE_OR_SC); return lua_type(L, -1) == LUA_TNUMBER ? lua_tonumber(L, -1) : stack.count; } // Return number of accepted items to be taken int ScriptApiPlayer::player_inventory_AllowTake( const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_allow_player_inventory_actions"); pushPutTakeArguments("take", ma.from_inv, ma.from_list, ma.from_i, stack, player); runCallbacks(4, RUN_CALLBACKS_MODE_OR_SC); return lua_type(L, -1) == LUA_TNUMBER ? lua_tonumber(L, -1) : stack.count; } // Report moved items void ScriptApiPlayer::player_inventory_OnMove( const MoveAction &ma, int count, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_player_inventory_actions"); pushMoveArguments(ma, count, player); runCallbacks(4, RUN_CALLBACKS_MODE_FIRST); } // Report put items void ScriptApiPlayer::player_inventory_OnPut( const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_player_inventory_actions"); pushPutTakeArguments("put", ma.to_inv, ma.to_list, ma.to_i, stack, player); runCallbacks(4, RUN_CALLBACKS_MODE_FIRST); } // Report taken items void ScriptApiPlayer::player_inventory_OnTake( const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_player_inventory_actions"); pushPutTakeArguments("take", ma.from_inv, ma.from_list, ma.from_i, stack, player); runCallbacks(4, RUN_CALLBACKS_MODE_FIRST); }