Gleb Mazovetskiy
54e30ff210
light_render: Use an std::span for light tables
...
1. There is no need to store the light table width as it is always 256.
2. Use a fixed-extent `std::span` rather than a pointer for readability.
This should optimize to the exact same code.
8 months ago
Gleb Mazovetskiy
8c6b2853ca
Make light render benchmark standalone
9 months ago
Gleb Mazovetskiy
f1a9db8f59
Extract the vision algorithm to a separate library
...
This allows us to test it without depending on all of DevilutionX.
Also fixes all clang-tidy warnings in the algorithm.
11 months ago
Roman Penyaev
efc46f3fab
lighting: make `DoVision()` more generic
...
This change does not have any functional impact. Instead, it separates
dungeon-dependent data from the vision algorithm, making the
`DoVision()` function suitable to be called from the test case, which
comes next.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
11 months ago
Gleb Mazovetskiy
d7647d6c63
More dependency untangling
...
1. Moves more assets-related stuff from `init` to `engine/assets`.
2. Removes `SDL_audiolib` dependency from `soundsample.h`.
3. Cleans up some unused/missing includes.
1 year ago
Gleb Mazovetskiy
c31836eab8
Split up `engine.{h,cpp}`
...
Untangles dependencies by splitting up `engine.{h,cpp}` into 3 files:
1. `primitive_render`
2. `ticks` -- only contains `GetAnimationFrame` for now.
3. `GetWidth2` renamed to `CalculateSpriteTileCenterX` and moved to `levels/dun_tile.hpp`.
1 year ago
Gleb Mazovetskiy
7b0558146e
Async load: Handle errors
1 year ago
Gleb Mazovetskiy
3d716f74d3
Add dun_render_benchmark
...
Results from a single run (a bit noisy) on my machine:
```
tools/build_and_run_benchmark.py dun_render_benchmark
```
```
------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------
DunRenderBenchmark/LeftTriangle_Solid_FullyLit 98297 ns 98282 ns 8840 items_per_second=15.1096M/s
DunRenderBenchmark/LeftTriangle_Solid_FullyDark 124727 ns 124701 ns 6973 items_per_second=11.9085M/s
DunRenderBenchmark/LeftTriangle_Solid_PartiallyLit 514869 ns 514747 ns 1700 items_per_second=2.88491M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyLit 520312 ns 520216 ns 1682 items_per_second=2.85458M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyDark 524440 ns 524331 ns 1664 items_per_second=2.83218M/s
DunRenderBenchmark/LeftTriangle_Transparent_PartiallyLit 532300 ns 532162 ns 1647 items_per_second=2.7905M/s
DunRenderBenchmark/RightTriangle_Solid_FullyLit 92387 ns 92363 ns 8840 items_per_second=16.7275M/s
DunRenderBenchmark/RightTriangle_Solid_FullyDark 85680 ns 85662 ns 9884 items_per_second=18.0361M/s
DunRenderBenchmark/RightTriangle_Solid_PartiallyLit 538347 ns 538250 ns 1626 items_per_second=2.87041M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyLit 548800 ns 548760 ns 1598 items_per_second=2.81544M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyDark 540450 ns 540369 ns 1620 items_per_second=2.85916M/s
DunRenderBenchmark/RightTriangle_Transparent_PartiallyLit 555061 ns 555003 ns 1575 items_per_second=2.78377M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyLit 700849 ns 700751 ns 1320 items_per_second=3.68176M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyDark 664927 ns 664872 ns 1389 items_per_second=3.88045M/s
DunRenderBenchmark/TransparentSquare_Solid_PartiallyLit 1131702 ns 1131559 ns 822 items_per_second=2.28004M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyLit 1022384 ns 1022267 ns 916 items_per_second=2.5238M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyDark 1023193 ns 1023057 ns 900 items_per_second=2.52185M/s
DunRenderBenchmark/TransparentSquare_Transparent_PartiallyLit 1033573 ns 1033496 ns 895 items_per_second=2.49638M/s
DunRenderBenchmark/Square_Solid_FullyLit 53532 ns 53524 ns 10000 items_per_second=30.8272M/s
DunRenderBenchmark/Square_Solid_FullyDark 41993 ns 41987 ns 19794 items_per_second=47.1573M/s
DunRenderBenchmark/Square_Solid_PartiallyLit 842772 ns 842615 ns 1108 items_per_second=1.56655M/s
DunRenderBenchmark/Square_Transparent_FullyLit 834105 ns 834026 ns 1119 items_per_second=1.58269M/s
DunRenderBenchmark/Square_Transparent_FullyDark 831912 ns 831823 ns 1122 items_per_second=1.58688M/s
DunRenderBenchmark/Square_Transparent_PartiallyLit 924638 ns 924536 ns 1010 items_per_second=1.42774M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyLit 33728 ns 33725 ns 24962 items_per_second=18.8583M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyDark 31088 ns 31085 ns 27444 items_per_second=20.4601M/s
DunRenderBenchmark/LeftTrapezoid_Solid_PartiallyLit 268792 ns 268768 ns 3254 items_per_second=1.97196M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyLit 277990 ns 277965 ns 3140 items_per_second=1.90672M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyDark 268952 ns 268912 ns 3250 items_per_second=1.9709M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_PartiallyLit 288869 ns 288826 ns 3056 items_per_second=1.83501M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyLit 29581 ns 29576 ns 28347 items_per_second=21.0984M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyDark 25315 ns 25312 ns 32250 items_per_second=24.6523M/s
DunRenderBenchmark/RightTrapezoid_Solid_PartiallyLit 259977 ns 259960 ns 3312 items_per_second=2.0003M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyLit 263079 ns 263056 ns 3322 items_per_second=1.97677M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyDark 259849 ns 259824 ns 3364 items_per_second=2.00136M/s
DunRenderBenchmark/RightTrapezoid_Transparent_PartiallyLit 279623 ns 279594 ns 3127 items_per_second=1.85984M/s
```
2 years ago
Gleb Mazovetskiy
624afafe58
Extract Crawl to a library
...
Also adds a test and a benchmark
2 years ago
obligaron
4b7424949f
Make IsFullyDark/IsFullyLit respect hell and hellfire levels
2 years ago
Anders Jenbo
af295b9f48
Fix warnings with conversion between size_t and int for playerId
2 years ago
Gleb Mazovetskiy
5cc1f98b8d
Remove utils/stdcompat/invoke_result_t.hpp
3 years ago
Gleb Mazovetskiy
14540164a7
Remove utils/stdcompat/optional.hpp
3 years ago
qndel
3500dc1861
code cleanup
3 years ago
Gleb Mazovetskiy
5bf0b8bc96
Add more missing <cstdint> includes
...
https://github.com/diasurgical/devilutionX/pull/6095 only added includes
for `uint32_t`, this PR also adds the includes for the remaining
integral types.
3 years ago
Anders Jenbo
b7424a0068
Clean up PmChangeLightOff()
3 years ago
Anders Jenbo
124cc71800
Update realtime lighting when static lights are changed
3 years ago
Anders Jenbo
828a52dc6d
Clean up ProcessLightsList()
3 years ago
Anders Jenbo
e969a8ad01
Invert player to vision relation
3 years ago
Anders Jenbo
382212b98c
Remove DisableLighting from release builds
3 years ago
Anders Jenbo
13c5c09990
Clean up Light related naming
...
A few are left unchanged as they will be removed in a later commit
3 years ago
Anders Jenbo
dc2d97c112
Split lighting shades from trn tables
3 years ago
Vladimir Olteanu
8fd3be67b5
Refactor VisionCrawlTable
4 years ago
Anders Jenbo
2d21fc372e
Remove more miniwin code
4 years ago
Andrew James
593a9f3b4b
Pull distinct points from VisionCrawlTable used by guardians ( #4844 )
4 years ago
Gleb Mazovetskiy
c8ddf7df65
Crawl: Move implementation from header to cpp
4 years ago
Andrew James
c479488fd7
Remove unnecessary assert ( #4911 )
4 years ago
Vladimir Olteanu
bed5bd9ec1
Eliminate CrawlTable
4 years ago
Gleb Mazovetskiy
3b2e560fa0
Non-int versions of `Point` and `Displacement` ( #4824 )
...
* Non-int versions of `Point` and `Displacement`
This will allow us to make some structs, such as `ActorPosition`, much
smaller.
* ActorPosition: Use smaller types
`Monsters`: 56K -> 46K
* player.cpp: Reduce size of `DirectionSettings`
* CrawlTable: Displacement -> DisplacementOf<int8_t>
* CrawlTable: vector<vector> -> array<vector>
Also only allocate one vector during construction instead of two.
A bit less indirection.
* Monster#enemyPosition: Point -> WorldTilePosition
sizeof(Monster): 240 -> 232
* Monster: Further optimize field layout and sizes
sizeof(Monster): 232 -> 208
`Monsters` is down to 40,000 bytes
* DMonsterStr: _mx/_my -> position
4 years ago
Vladimir Olteanu
5a5111f1d8
Refactor CrawlTable ( #4833 )
4 years ago
Anders Jenbo
fd98aff9f1
Move shared dungeon level code to common function
4 years ago
Andrew James
1047e408bd
Simplify logic of UpdateMissilePos using helpers from 4620 ( #4621 )
4 years ago
qndel
9ba64ad08b
TRN rewrite + bugfix ( #4056 )
...
* working new TRN system
* apply TRNs to all unique missiles
4 years ago
qndel
b7b01ce1fd
remove InitLightMax
4 years ago
Gleb Mazovetskiy
076b0c0c05
Overhaul tests
...
1. Adds a `libdevilution_so` target when tests are enabled.
2. Each test file is now a separate binary target linked against `libdevilutionx_so` (can now run tests in parallel).
3. Tests are now defined in a separate `test/CMakeLists.txt` file.
4. Building the tests is now controlled by the standard `BUILD_TESTING` option (defined by CTest).
5. Tests are now built by default.
6. On CI, test errors are now reported.
Also:
* `.clang-format`: Enable SortIncludes in tests
* `path_test.cpp`: Fix -Wsign-compare
4 years ago
qndel
e567953bc9
Sharing automap exploration in multiplayer
4 years ago
obligaron
1b3381ce8e
Move CrawlNum to CrawlTable and make it extern visible
5 years ago
Juliano Leal Goncalves
a91074d470
🚚 Rename 'LightStruct' struct to 'Light'
5 years ago
Anders Jenbo
ef6275caac
Clean up private function names
5 years ago
Anders Jenbo
4bf4e42230
Move local symbols to anonymous namespace
5 years ago
Anders Jenbo
dce78dde62
Rename lighting globals
5 years ago
Anders Jenbo
bc59218d0d
More clang-tidy/Android Studio cleanups
5 years ago
qndel
dadf418fe0
fix typo ( #2266 )
5 years ago
Gleb Mazovetskiy
f9f301b054
🚚 engine.h: Extract `Point`, `Direction`, `clamp`
...
`engine.h` is getting quite bloated. Moves this code to their own files.
5 years ago
Juliano Leal Goncalves
b3ec79af4f
Leverage 'Point' in Lighting and Player functions ( #2048 )
5 years ago
Gleb Mazovetskiy
0bfc147b78
🧹 Remove `DiabloAllocPtr` and friends ( #1824 )
5 years ago
Anders Jenbo
2bd13451a1
♻️ Apply point positioning to all remaning entities
5 years ago
Anders Jenbo
373f28736f
🎨 Acceptable parts of modernize-*
5 years ago
Anders Jenbo
8c821e98d3
🚚 Restructure files
5 years ago
Anders Jenbo
997c1dba55
🚚 Split up all.h in to proper header relations
5 years ago