summaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
Commit message (Collapse)AuthorAge
* TileLayer: use shared_ptr for FrameSpec vector (#6171)Loïc Blot2017-07-26
| | | | | | | | | | | | * TileLayer: use shared_ptr for vector framespec This reduce memory copy of TileLayer from (4 to 16) * FrameSpec where FrameSpec = (sizeof(int) + 3 * sizeof(ptr)) to int + sizeof(ptr) Callgrind difference Before: https://lut.im/RGkiJqQb8T/LeQIEXpAuRzfl7gd.png After: https://lut.im/bcqmwee1xu/cTwtptY5tRuS9lp0.png * Fix one push_back to use vector::emplace_back & optimize inclusions
* Add 'plantlike_rooted' drawtypenumber Zero2017-07-11
| | | | | | | Useful for underwater plants. Node consists of a base cube plus a plantlike extension that can pass through liquid nodes above without creating air bubbles or interfering with liquid flow. Uses paramtype2 'leveled', param2 defines height of plantlike extension.
* Tile material: Add 'TILE_MATERIAL_OPAQUE', use for drawtype 'NDT_NORMAL'stujones112017-07-01
| | | | | Prevents normal drawtype nodes having transparency. Avoids clients cheating by using 'x-ray' texture packs with transparent textures.
* Isolate irrlicht references and use a singleton (#6041)Loïc Blot2017-06-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Device3D class which will contain IrrlichtDevice interface move getSupportedVideoDrivers to Device3D Add Device3D singleton & use it in various places Rename Device3D to Rendering engine & add helper functions to various device pointers More singleton work RenderingEngine owns draw_load_screen move draw functions to RenderingEngine Reduce IrrlichtDevice exposure and guienvironment RenderingEngine: Expose get_timer_time() to remove device from guiEngine Make irrlichtdevice & scene manager less exposed * Code style fixes * Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly * enum paralax => enum parallax
* Cpp11 patchset 11: continue working on constructor style migration (#6004)Loïc Blot2017-06-18
|
* Fix the serialization error by ff73c7a (#5964)Rui2017-06-11
|
* Sound: Add pitch option (#5960)Rui2017-06-11
| | | | * Sound: Add pitch option
* C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821)Loïc Blot2017-06-04
|
* Various code cleanup & little performance improvement on HTTP download (#5772)Loïc Blot2017-05-20
| | | | | | * Disable or remove unused enum members/functions * Tiny code style fixes * Make some functions const * Replace ClientMediaDownloader std::unordered_map with std::map
* Fix alpha for liquid nodes (#5494)Dániel Juhász2017-05-19
|
* Shaders: Remove unused water surface shaderparamat2017-05-08
| | | | | | | | | | Also remove hardcoded MTGame node. The 'water surface shader' was duplicated shader code in preparation for intended new water surface shaders. For development purposes the MTGame node 'default:water_source' had it's top tile assigned to 'water surface shader'. Due to shader duplication this commit does not cause any change to shader behaviour.
* Allow mesh and nodeboxes to wave like plants or leaves. (#3497)Auke Kok2017-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce a new value for "waving" - 2: 0 - waving disabled 1 - wave like a plant 2 - wave like a leave Plantlike nodes will only allow waving = 1, but for leaves we will permit both 1 and 2 since current minetest_game sets it to 1 for all leaves. This makes it somewhat backwards compatible. For mesh and nodebox, values 1 and 2 are both valid, and the node can wave in both fashions as desired. I've tested this with the crops:corn plants, which are mesh nodes, and the results are really good. The code change is trivial as well, so I've opted to document the waving parameter in lua_api.txt because it was missing from there. Nodeboxes likely will not wave properly unless waving = 2. However it's possible that waving=1 may be desired by some mod developers for geometries I have not tried, so the code will not prohibit either value for mesh and nodebox drawtypes. Add lua_api.txt documentation for this feature and document both the existing functionality and the expansion to mesh and nodebox drawtypes.
* Fix various points reported by cppcheck (#5656)Loïc Blot2017-04-25
| | | | | | | | | | | | * Fix various performance issues reported by cppcheck + code style (CI) * Make CI happy with code style on master * guiFileSelectMenu: remove useless includes * some performance fixes pointed by cppcheck * remove some useless casts * TextDest: remove unused setFormSpec function * Fix various iterator post-increment reported by cppcheck
* Soft node overlay (#5186)Dániel Juhász2017-04-21
| | | | This commit adds node overlays, which are tiles that are drawn on top of other tiles.
* Only use palette if param_type2 is correctDániel Juhász2017-04-13
|
* Hardware coloring for itemstacksDániel Juhász2017-04-08
| | | | | | | | | | Adds the possibility to colorize item stacks based on their metadata. In the item/node definition you can specify palette (an image file) and color (fallback color if the item has no palette or metadata). Then you can add palette_index to the metadata. Dropped itemstacks with different colors do not merge.
* Some performance optimizations (#5424)Loïc Blot2017-03-22
| | | | | | | | | | | | | | | | | | | * Some performance optimizations This is globally removing some memory useless copy * use a const ref return on std::string Settings::get to prevent data copy on getters which doesn't need to copy it * pass some stack created strings to static const as they are not modified anywhere * Camera: return nametags per const ref instead of a list pointer, we only need to read it * INodeDefManager: getAll should be a result ref writer instead of a return copy * INodeDefManager: getAlias should return a const std::string ref * Minimap: unroll a Scolor creation in blitMinimapPixersToImageRadar to prvent many variable construct/destruct which are unneeded (we rewrite the content in the loop) * CNodeDefManager::updateAliases: prevent a idef getall copy * Profiler: constness * rollback_interface: create real_name later, and use const ref * MapBlockMesh updateFastFaceRow: unroll TileSpec next_tile, which has a cost of 1.8% CPU due to variable allocation/destruction, * MapBlockMesh updateFastFaceRow: copy next_tile to tile only if it's a different tilespec * MapBlockMesh updateFastFaceRow: use memcpy to copy next_lights to lights to do it in a single cpu operation
* Update server min protocol version to v24 (#5411)Loïc Blot2017-03-19
| | | | | | | | | | * Update server min protocol version to v24 It's based on @sfan5 stats. See https://kitsunemimi.pw/tmp/serverlist_stats_2017-03-17.txt v24 was bumped 25/08/14 and 0.4.11 was released 25/12/14 * Drop protocol v23 and lesser code
* Plantlike: Fix visual_scale being applied squaredparamat2017-02-10
| | | | | | | | | | | | | | | | | | This re-applies 2 commits that were reverted. Visual_scale was applied twice to plantlike by accident sometime between 2011 and 2013, squaring the requested scale value. Visual_scale is correctly applied once in it's other uses in signlike and torchlike. Two lines of code are removed, they also had no effect for the vast majority of nodes with the default visual_scale of 1.0. The texture continues to have it's base at ground level. Send sqrt(visual_scale) to old clients. Keep compatibility with protocol < 30 clients now that visual_scale is no longer applied twice to plantlike drawtype and mods are being updated to a new value.
* Revert "Plantlike visual scale: Send sqrt(visual_scale) to old clients"Craig Robbins2017-02-10
| | | | This reverts commit cdc538e0a242167cd7031d40670d2d4464b87f2c.
* Plantlike visual scale: Send sqrt(visual_scale) to old clientsparamat2017-01-30
| | | | | | Keep compatibility with protocol < 30 clients now that visual_scale is no longer applied twice to plantlike drawtype and mods are being updated to a new value.
* Add smooth lighting for all nodesnumber Zero2017-01-24
| | | | Note: Smooth lighting disables the mesh cache.
* Add hardware node coloring. Includes:Dániel Juhász2017-01-23
| | | | | | - Increase ContentFeatures serialization version - Color property and palettes for nodes - paramtype2 = "color", "colored facedir" or "colored wallmounted"
* Add particle animation, glowsfan52017-01-18
| | | | | This is implemented by reusing and extending the TileAnimation code for the methods used by particles.
* Environment & IGameDef code refactoring (#4985)Ner'zhul2017-01-09
| | | | | | | | | | | | | | | | | | | | | * Environment code refactoring * Cleanup includes & class declarations in client & server environment to improve build speed * ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts. * Cleanup IGameDef * Move ITextureSource* IGameDef::getTextureSource() to Client only. * Also move ITextureSource *IGameDef::tsrc() helper * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call * drop unused emerge() call * cleanup server unused functions (mentionned before) * Drop one unused parameter from ContentFeatures::updateTextures * move checkLocalPrivilege to Client * Remove some unnecessary casts * create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it * Fix some comments * Change required IGameDef to Server/Client pointers * Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects * Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu * drop ClientMap::sectorWasDrawn which is unused
* Improve getPointedThing() (#4346)Dániel Juhász2017-01-04
| | | | | | | | | | | | | | | | | | | * Improved getPointedThing() The new algorithm checks every node exactly once. Now the point and normal vector of the collision is also returned in the PointedThing (currently they are not used outside of the function). Now the CNodeDefManager keeps the union of all possible nodeboxes, so the raycast won't miss any nodes. Also if there are only small nodeboxes, getPointedThing() is exceptionally fast. Also adds unit test for VoxelLineIterator. * Cleanup, code move This commit moves getPointedThing() and Client::getSelectedActiveObject() to ClientEnvironment. The map nodes now can decide which neighbors they are connecting to (MapNode::getNeighbors()).
* Add 2D sheet animation for nodessfan52017-01-02
|
* Move TileAnimation code to seperate filesfan52017-01-02
|
* Limit light_source in the engine (#4814)juhdanad2016-11-28
| | | Since light_source>15 causes crash, it must be limited.
* Revert "Adding particle blend, glow and animation (#4705)"sfan52016-11-14
| | | | This reverts commit 93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.
* Adding particle blend, glow and animation (#4705)Foghrye42016-11-15
|
* Speed up emerge thread by using unordered map in a few places. Looking at ↵gregorycu2016-10-08
| | | | 25% speedup in Emerge thread on Just Test.
* Textures: Ignore unknown node in override.txtSmallJoker2016-10-08
|
* Add minetest.unregister_item and minetest.register_alias_forcepaly22016-09-08
|
* Make plantlike drawtype more funAuke Kok2016-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds several new ways that the plantlike drawtype mesh can be changed. This requires paramtype2 = "meshoptions" to be set in the node definition. The drawtype for these nodes should be "plantlike". These modifications are all done using param2. This field is now a complex bitfield that allows some or more of the combinations to be chosen, and the mesh draw code will choose the options based as neeeded for each plantlike node. bit layout: bits 0, 1 and 2 (values 0x1 through 0x7) are for choosing the plant mesh shape: 0 - ordinary plantlike plant ("x" shaped) 1 - ordinary plant, but rotated 45 degrees ("+" shaped) 2 - a plant with 3 faces ("*" shaped) 3 - a plant with 4 faces ("#" shaped) 4 - a plant with 4 faces ("#" shaped, leaning outwards) 5 through 7 are unused and reserved for future mesh shapes. bit 3 (0x8) causes the plant to be randomly offset in the x,z plane. The plant should fall within the 1x1x1 nodebox if regularly sized. bit 4 (0x10) causes the plant mesh to grow by sqrt(2), and will cause the plant mesh to fill out 1x1x1, and appear slightly larger. Texture makers will want to make their plant texture 23x16 pixels to have the best visual fit in 1x1x1 size. bit 5 (0x20) causes each face of the plant to have a slight negative Y offset in position, descending up to 0.125 downwards into the node below. Because this is per face, this causes the plant model to be less symmetric. bit 6 (0x40) through bit 7 (0x80) are unused and reserved for future use. !(https://youtu.be/qWuI664krsI)
* Move unknown node message when applying texture overrides to infostream (#4218)Yutao Yuan2016-06-14
| | | Texture packs have no way to know what nodes are available, so this shouldn't be a error message.
* Move updateTextures and fillTileAttribs to ContentFeaturesEkdohibs2016-05-23
|
* Connected nodes: fix 2 minor bugsAuke Kok2016-03-14
| | | | | | | | | | | | | | | 1. Copy-paste error: properly test for back-connection. In the case of two different connected nodebox types, we want to assure that if A connects to B, that B also connects to A. This test was accidentally not implemented correctly. 2. Clear the connects_to_ids before deserializing. With each new connected node, the deserialization code added more and more targets to the map, since the map wasn't cleared in between deserialization steps. This caused e.g. wall blocks to connect to things in the fence connects_to map.
* Allow nodes to specify which sides to connect to.Auke Kok2016-03-12
| | | | | | | | | | | | | | | | NDT_CONNECTED attempts to connect to any side of nodes that it can connect to, which is troublesome for FACEDIR type nodes that generally may only have one usable face, and can be rotated. We introduce a node parameter `connect_sides` that is valid for any node type. If specified, it lists faces of the node (in "top", "bottom", "front", "left", "back", "right", form, as array) that connecting nodeboxes can connect to. "front" corresponds to the south facing side of a node with facedir = 0. If the node is rotatable using *simple* FACEDIR, then the attached face is properly rotated before checking. This allows e.g. a chest to be attached to only from the rear side.
* Nodebox: Allow nodeboxes to "connect"Auke Kok2016-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce a new nodebox type "connected", and allow these nodes to have optional nodeboxes that connect it to other connecting nodeboxes. This is all done at scenedraw time in the client. The client will inspect the surrounding nodes and if they are to be connected to, it will draw the appropriate connecting nodeboxes to make those connections. In the node_box definition, we have to specify separate nodeboxes for each valid connection. This allows us to make nodes that connect only horizontally (the common case) by providing optional nodeboxes for +x, -x, +z, -z directions. Or this allows us to make wires that can connect up and down, by providing nodeboxes that connect it up and down (+y, -y) as well. The optional nodeboxes can be arrays. They are named "connect_top, "connect_bottom", "connect_front", "connect_left", "connect_back" and "connect_right". Here, "front" means the south facing side of the node that has facedir = 0. Additionally, a "fixed" nodebox list present will always be drawn, so one can make a central post, for instance. This "fixed" nodebox can be omitted, or it can be an array of nodeboxes. Collision boxes are also updated in exactly the same fashion, which allows you to walk over the upper extremities of the individual node boxes, or stand really close to them. You can also walk up node noxes that are small in height, all as expected, and unlike the NDT_FENCELIKE nodes. I've posted a screenshot demonstrating the flexibility at http://i.imgur.com/zaJq8jo.png In the screenshot, all connecting nodes are of this new subtype. Transparent textures render incorrectly, Which I don't think is related to this text, as other nodeboxes also have issues with this. A protocol bump is performed in order to be able to send older clients a nodeblock that is usable for them. In order to avoid abuse of users we send older clients a "full-size" node, so that it's impossible for them to try and walk through a fence or wall that's created in this fashion. This was tested with a pre-bump client connected against a server running the new protocol. These nodes connect to other nodes, and you can select which ones those are by specifying node names (or group names) in the connects_to string array: connects_to = { "group:fence", "default:wood" } By default, nodes do not connect to anything, allowing you to create nodes that always have to be paired in order to connect. lua_api.txt is updated to reflect the extension to the node_box API. Example lua code needed to generate these nodes can be found here: https://gist.github.com/sofar/b381c8c192c8e53e6062
* Add minetest.register_lbm() to run code on block load onlyest312016-03-07
|
* Nodedef: Restore smooth lighting to waterparamat2016-02-27
|
* Remove new_style_waterRealBadAngel2016-02-26
|
* Fix backface culling when connecting to new servers.Auke Kok2016-02-10
| | | | | | | | | | | | | | | Introduce a new contentfeatures version (8). When clients connect using v27 protocol version, they can assume that the tiledef.backface_culling is trustable, but if clients connect to servers providing contentfeatures version 7, then the v27 clients know that backface culling settings provided by the server in tiledefs are bogus for mesh, plantlike, firelike or liquid drawtype nodes. thanks to hmmmm, est31, nerzhul. Tested on new client - new server, new client - old server old client - new server.
* Cleanup selection mesh code, add shaders for halo and selection boxesRealBadAngel2016-02-08
|
* Backface culling: Ignore setting in tiledef from old servers.Auke Kok2016-01-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Outdated servers are always sending tiledefs with culling enabled no matter what, as the value was previously entirely ignored. To compensate, we must (1) detect that we're running against an old server with a new client, and (2) disable culling for mesh, plantlike, firelike and liquid draw types no matter what the server is telling us. In order to achieve this, we need to bump the protocol version since we cannot rely on the tiledef version, and test for it being older. I've bumped the protocol version, although that should have likely happened in the actual change that introduced the new backface_culling PR #3578. Fortunately that's only 2 commits back at this point. We also explicitly test for the drawtype to assure we are not changing the culling value for other nodes, where it should remain enabled. This was tested against various pub servers, including 0.4.13 and 0.4.12. Fixes #3598
* Allow per-tiles culling.Auke Kok2016-01-20
| | | | | | | | | | | | | | | | | | | | | | | | Backface culling is enabled by default for all tiles, as this is how the lua parser initializes each tiledef. We revert to always using the value from the tiledef since it is always read and serialized. Mods that wish to enable culling for e.g. mesh nodes, now can specify the following to enable backface culling: tiles = {{ name = "tex.png", backface_culling = true }}, Note the double '{' and use of 'name' key here! In the same fashion, backface_culling can be disabled for any node now. I've tested this against the new door models and this properly allows me to disable culling per node. I've also tested this against my crops mod which uses mesh nodes where culling needs to be disabled, and tested also with plantlike drawtype nodes where we want this to continue to be disabled. No default setting has changed. The defaults are just migrated from nodedef.cpp to c_content.cpp.
* Liquids: Flow into and destroy 'floodable' nodesparamat2016-01-07
| | | | | Add new node property 'floodable', default false Define "air" as floodable = true in C++ and lua
* Use warningstream for log messages with WARNINGShadowNinja2015-10-14
| | | | Remove DTIME macro and its uses, too
* Change i++ to ++iDavid Jones2015-08-25
|