Commit Graph
1722 Commits
Author SHA1 Message Date
MihailRisandGitHub ba046a52c0 Revert "fix: optimization: Various PVS-Studio warnings" 2024-08-02 14:51:44 +03:00
Vyacheslav Ivanov 3a78746185 fix: render: Fix WorldRenderer::renderBlockSelection
Block selection clears before new selection be drawn
Added a call to LineBatch::flush() to ensure that all buffered data is correctly uploaded to the GPU and rendered. The missing flush() was causing rendering artifacts, such as flickering of block outlines, which has now been resolved by ensuring that all accumulated data is processed and rendered properly.
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 07:46:13 +03:00
Vyacheslav Ivanov 35d26a771f fix: optimization: PVS-Studio warning V801
Redefined the second function argument as a const reference instead of by value to improve performance.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 06:18:05 +03:00
Vyacheslav Ivanov c3e4341a04 fix: optimization: PVS-Studio warning V802
Rearranged structure fields in decreasing order of size to reduce structure size from 32 to 24 and 12 to 8 bytes on 64-bit platforms.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 06:12:30 +03:00
Vyacheslav Ivanov c4cc71623d fix: optimization: PVS-Studio warning V807
Created references to avoid using repeated expressions, improving performance across multiple instances.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 06:07:50 +03:00
Vyacheslav Ivanov 3d21b7ba6a fix: optimization: PVS-Studio warning V810
Cached the result of 'glm::vec3(size * 0.63f)' in a temporary variable to avoid multiple identical function calls and improve performance.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 05:41:47 +03:00
Vyacheslav Ivanov 2c1103307f fix: optimization: PVS-Studio warning V813
Passing large objects by const reference avoids unnecessary copying and enhances efficiency.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 05:35:55 +03:00
Vyacheslav Ivanov 5b325ac2bc fix: optimization: PVS-Studio warning V815
The 'empty()' method is more efficient for checking if a string is empty compared to comparing it with an empty string literal.

The default constructor 'std::wstring()' is more efficient for creating an empty string compared to using a string literal.

The 'clear()' method is more efficient for clearing a std::wstring compared to assigning it an empty string literal.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 05:35:55 +03:00
Vyacheslav Ivanov 1068c3f4f4 fix: optimization: PVS-Studio warning V820
Replaced copying of the 'sources' variable with move semantics to improve performance.

By moving instead of copying, we avoid unnecessary copying of data and enhance efficiency.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 05:35:55 +03:00
Vyacheslav Ivanov 6b3146f98a fix: optimization: PVS-Studio warning V821
Creating variables in a more localized scope can enhance performance and make the code easier to understand.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 05:35:53 +03:00
Vyacheslav Ivanov e9a5f18bc3 fix: optimization: PVS-Studio warning V830
Replaced 'std::optional::value()' with '*' operator to improve performance.

Using 'std::optional::value()' involves additional overhead compared to using the '*' or '->' operators. This change ensures more efficient access to the underlying value of the optional when you are certain that it contains a value.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 02:38:54 +03:00
Vyacheslav Ivanov f3f872c7a3 fix: optimization: PVS-Studio warning V831
Replaced 'at()' method with 'operator[]' to improve performance.

The 'at()' method performs bounds checking, which can introduce overhead. Using 'operator[]' bypasses this check and can improve performance when you are certain that the index is within bounds.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 02:38:54 +03:00
Vyacheslav Ivanov 1bdc9cf759 fix: optimization: PVS-Studio warning V835
Passing cheap-to-copy arguments by reference can sometimes lead to decreased performance. This change ensures that the argument is passed by value, which is more efficient in cases where the argument is inexpensive to copy.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 02:38:54 +03:00
Vyacheslav Ivanov 307ffc3c8f fix: optimization: PVS-Studio warning V837
Replaced 'emplace' with 'try_emplace' to avoid unnecessary copies or moves when insertion fails.

The 'emplace' function does not guarantee that arguments will not be copied or moved if insertion is not successful. Using 'try_emplace' ensures that arguments are only copied or moved if the insertion actually takes place, thus improving performance.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 02:38:54 +03:00
Vyacheslav Ivanov 7fbd32b8df fix: optimization: PVS-Studio warning V823
Replaced 'push_back' with 'emplace_back' for better performance in containers.

Reported by: PVS-Studio

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 02:38:53 +03:00
Vyacheslav Ivanov 818fd716cc fix: optimization: PVS-Studio warning V825
The 'current.reset(lang.release())' expression is equivalent to 'current = std::move(lang)'.
Changed 'current.reset(lang.release())' to 'current = std::move(lang)' to improve code clarity and performance.

Reported by: PVS-Studio

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 01:57:43 +03:00
Vyacheslav Ivanov 5dd7a15c09 fix: optimization: PVS-Studio warning V832
It's better to use '= default;' syntax instead of empty constructor and destructor body.
Using '= default;' can help the compiler generate more optimal code.

Reported by: PVS-Studio

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 01:57:43 +03:00
Vyacheslav Ivanov 73e721513c fix: optimization: PVS-Studio warning V836
Expression's value is copied at variable declaration.
The variable is never modified. Consider declaring it as a reference.

Changed variables to be a reference to avoid unnecessary copy.

Reported by: PVS-Studio

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-01 23:40:28 +03:00
MihailRis 50a388c539 fix: access to deleted Sensor 2024-08-01 17:10:30 +03:00
MihailRis f8907f7db1 add on_update, on_render to docs & change entities tps to 20 2024-08-01 16:04:27 +03:00
MihailRis eefaafd1e7 update block.compose_state, block.decompose_state semantics 2024-07-31 14:56:42 +03:00
MihailRis 3a1ae57bbf fix: mat4.decompose (-Wmaybe-uninitialized) 2024-07-31 14:45:09 +03:00
MihailRis 10fa828bd7 update component 'ARGS' variable default value 2024-07-30 19:52:04 +03:00
MihailRis 63d0c8b01a fix: audio positioning when non-base camera active 2024-07-30 12:02:32 +03:00
MihailRis c50f564b80 fix: overlay 'on_close' not called on window close 2024-07-29 21:04:27 +03:00
MihailRis 8f26397e56 hide hotbar on overlays with inventory hidden 2024-07-29 20:36:49 +03:00
MihailRis a66228eb41 fix: 'gravity' does not work on hud overlays 2024-07-29 20:29:23 +03:00
MihailRis c947af904d increase debug-panel width 2024-07-29 17:03:51 +03:00
MihailRis 753fb6bf3b add vec2.angle(...) 2024-07-29 16:54:57 +03:00
MihailRis 2b7b68f3c2 add 'static' entity body-type 2024-07-29 15:45:28 +03:00
MihailRis d6696b54cb add 'normal' argument to on_use_on_block event 2024-07-29 15:23:04 +03:00
MihailRis 0f26d7c93a fix 2024-07-29 13:10:53 +03:00
MihailRis b021339a8a add window icon 2024-07-28 23:47:49 +03:00
MihailRis c0ba5be458 add framerate control 2024-07-28 22:31:27 +03:00
MihailRis a2f011fc96 Merge branch 'main' into framerate-control 2024-07-28 22:20:25 +03:00
MihailRis f46e4a7989 add trackbar 'sub-consumer' for value label refresh when 'change-on-release' 2024-07-28 22:15:18 +03:00
MihailRis 8ca12127db add 'change-on-release' trackbar property & fix mouseRelease event timing 2024-07-28 12:38:31 +03:00
MihailRis 3fee1072b7 fix 'block' model lights with AO turned-off 2024-07-27 22:59:06 +03:00
MihailRis 71e20ff805 add block 'ambient-occlusion' property 2024-07-27 18:37:18 +03:00
MihailRis f485ba5e54 fix: invalid block segment was not removed on hover 2024-07-27 14:46:52 +03:00
MihailRis adafc94fa1 add block.compose_state(...), block.decompose_state(...) 2024-07-27 13:23:35 +03:00
MihailRis 64ccf2a532 fix: thrid-person camera xray 2024-07-26 13:40:13 +03:00
MihailRis 3deb7ff830 fix: delta time plotter is interactive 2024-07-26 12:45:44 +03:00
MihailRis a856b4f140 add framerate control (WIP) 2024-07-25 22:33:21 +03:00
MihailRis 0a8de441b4 fix hud.* functions cause fatal error if incorrect arguments passes 2024-07-25 00:03:13 +03:00
MihailRis 0de4061253 refactor EngineController.cpp 2024-07-24 17:44:43 +03:00
MihailRis 18d473b673 improve parsing error alert 2024-07-24 17:11:43 +03:00
MihailRis fe1ac69b57 improve lua errors handling (traceback) & lua stack leaks fixes 2024-07-24 16:19:14 +03:00
MihailRis 2ec6c8b540 update component lua short name 2024-07-24 15:17:30 +03:00
MihailRis b23f7e996f fix skeleton:index(...) 2024-07-23 22:48:26 +03:00