Commit Graph

32 Commits

Author SHA1 Message Date
DS 5a07f5a652
Fix inconsistent rounding in VoxelLineIterator::VoxelLineIterator (#14555)
floatToInt rounds 0.5 differently depending on sign.
2024-04-20 13:03:34 +02:00
sfan5 bf987bf58a Handle blit_back_with_light with empty area
fixes #13306
2023-07-13 20:42:39 +02:00
Jude Melton-Houghton 8f996e4a7c Remove unused MapBlock functionality 2022-10-09 13:43:48 -04:00
Jude Melton-Houghton 9676364c1f
Optimize lighting calculation (#12797) 2022-10-09 10:50:26 -04:00
Jude Melton-Houghton f916398a54
Add lighting test and benchmark (#12802) 2022-09-26 06:49:08 -04:00
sfan5 f0bad0e2ba
Reserve vectors before pushing and other code quality changes (#11161) 2021-04-05 13:38:31 +02:00
Jozef Behran 86d7f84b89 Merge pull request #8776 from osjc/FixGetNode
Finish getNode cleanup
2019-08-10 19:45:44 +02:00
SmallJoker ee20433425 Fix typo in lighting code since bcdb3d5 2018-03-10 09:37:43 +01:00
Loic Blot 12d1e4ff04 VoxelArea: add_{x,y,z,p} must be static
Fix some documentations issues
Use getNodeNoCheck(v3s16, ...) in some cases instead of getNodeNoCheck(x, y, z, ...)
2018-03-09 23:27:26 +01:00
Loic Blot bcdb3d56c0 Variable name fix + structure creation unrolling in lighting code 2018-03-09 23:27:26 +01:00
Dániel Juhász 3face01a20 Node definition manager refactor (#7016)
* Rename IWritableNodeDefManager to NodeDefManager
* Make INodeDefManager functions const
* Use "const *NodeDefManager" instead of "*INodeDefManager"
* Remove unused INodeDefManager class
* Merge NodeDefManager and CNodeDefManager
* Document NodeDefManager
2018-02-10 21:04:16 +01:00
Dániel Juhász 735fc2a1f2 Remove unused light updating code
Also remove the unit test that tests the removed algorithms.
2018-02-04 03:16:45 +00:00
Loïc Blot 1c1c97cbd1 Modernize source code: last part (#6285)
* Modernize source code: last par

* Use empty when needed
* Use emplace_back instead of push_back when needed
* For range-based loops
* Initializers fixes
* constructors, destructors default
* c++ C stl includes
2017-08-20 13:30:50 +02:00
Dániel Juhász 3caad3f3c9 Expose getPointedThing to Lua
This commit introduces Raycast, a Lua user object, which can be
used to perform a raycast on the map. The ray is continuable, so one can
also get hidden nodes (for example to see trough glass).
2017-07-07 22:28:23 +01:00
Loïc Blot 1425c6def1 Cpp11 initializers: last src root changeset (#6022)
* Cpp11 initializers: last src root changeset

Finish to migrate all src root folder files to C++11 constructor initializers
2017-06-21 11:51:29 +02:00
Dániel Juhász 57e5aa6628 Light update for map blocks
This is not really different from the light update of a voxel
manipulator. This update does not assume that the lighting was correct
before, therefore it is useful for correction.

Also expose this function to the Lua API for light correction, and
allow voxel manipulators not to update the light.
2017-04-20 05:39:14 +02:00
Dániel Juhász 6d1e6f8898 Split light update into two parts
The common part can be reused.
2017-04-20 05:31:50 +02:00
Dániel Juhász ab371cc934 Light calculation: New bulk node lighting code
This commit introduces a new bulk node lighting algorithm to minimize
lighting bugs during l-system tree generation, schematic placement and
non-mapgen-object lua voxelmanip light calculation.

If the block above the changed area is not loaded, it gets loaded to avoid
lighting bugs.
Light is updated as soon as write_to_map is called on a voxel manipulator,
therefore update_map does nothing.
2017-03-11 02:06:18 +00:00
Dániel Juhász f17c9c45dc Lighting: Update lighting at block loading
This commit updates mapblocks' light if necessary when they are loaded.
This removes ghost lighting.
2017-02-13 00:05:49 +00:00
Dániel Juhász 3f8261830e Improve getPointedThing() (#4346)
* 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()).
2017-01-04 19:18:40 +01:00
juhdanad 2fe3bf5a18 Limit light_source in the engine (#4814)
Since light_source>15 causes crash, it must be limited.
2016-11-28 18:43:33 +10:00
Dániel Juhász bcb06aeb85 Cleanup 2016-10-27 08:04:42 +02:00
Dániel Juhász be39f61359 Use node lighting for liquid spreading
This commit modifies the liquid transforming procedure to light and
unlight nodes instead of whole map blocks.
2016-10-27 08:04:42 +02:00
Dániel Juhász c071efaa43 Improved lighting
This commit rewrites the procedure that is responsible for light
updating.

this commit
-provides iterative solutions for unlighting and light spreading
-introduces a new priority queue-like container for the iteration
-creates per-node MapBlock caching to reduce retrieving MapBlocks from
the map
-calculates with map block positions and in-block relative node
coordinates
-skips light updating if it is not necessary since the node's new light
will be the same as its old light was
2016-10-27 08:04:42 +02:00
sapier 8ad83767cf Remove emerge and speedup addArea by using memcopy instead of one by one assignment 2014-06-23 00:13:41 +02:00
Ilya Zhuravlev 6a1670dbc3 Migrate to STL containers/algorithms. 2013-03-11 19:08:39 -04:00
Sfan5 6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam 497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
kwolekr 11afcbff69 The new mapgen, noise functions, et al. 2013-01-21 21:41:33 +02:00
Perttu Ahola 037b259197 Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2/later, by agreement of major contributors 2012-06-05 18:54:07 +03:00
Perttu Ahola 0f3c2f6541 voxalgo::clearLightAndCollectSources 2012-03-27 19:01:51 +03:00
Perttu Ahola 56496ad5d8 Implement propagateSunlight for VoxelManipulator 2012-03-27 19:01:50 +03:00