diff --git a/doc/en/scripting/builtins/libplayer.md b/doc/en/scripting/builtins/libplayer.md index dda4f450..015bf86a 100644 --- a/doc/en/scripting/builtins/libplayer.md +++ b/doc/en/scripting/builtins/libplayer.md @@ -12,6 +12,18 @@ player.set_pos(playerid: int, x: number, y: number, z: number) Set player position +``` python +player.get_vel(playerid: int) -> number, number, number +``` + +Returns the x, y, z linear velocity of the player + +``` python +player.set_vel(playerid: int, x: number, y: number, z: number) +``` + +Sets x, y, z player linear velocity + ```python player.get_rot(playerid: int) -> number, number, number ``` diff --git a/doc/en/scripting/ecs.md b/doc/en/scripting/ecs.md index df24663b..8763d981 100644 --- a/doc/en/scripting/ecs.md +++ b/doc/en/scripting/ecs.md @@ -51,7 +51,7 @@ tsf:set_size(size: vec3) -- Returns the entity rotation tsf:get_rot() -> mat4 -- Sets entity rotation -tsf:set_rot(size: mat4) +tsf:set_rot(rotation: mat4) ``` ### Rigidbody diff --git a/doc/ru/scripting/builtins/libplayer.md b/doc/ru/scripting/builtins/libplayer.md index 8b15d8df..b054e59f 100644 --- a/doc/ru/scripting/builtins/libplayer.md +++ b/doc/ru/scripting/builtins/libplayer.md @@ -12,6 +12,18 @@ player.set_pos(playerid: int, x: number, y: number, z: number) Устанавливает x, y, z координаты игрока +```python +player.get_vel(playerid: int) -> number, number, number +``` + +Возвращает x, y, z линейной скорости игрока + +```python +player.set_vel(playerid: int, x: number, y: number, z: number) +``` + +Устанавливает x, y, z линейной скорости игрока + ```python player.get_rot(playerid: int) -> number, number, number ``` diff --git a/doc/ru/scripting/ecs.md b/doc/ru/scripting/ecs.md index fef88b01..3e8e00e5 100644 --- a/doc/ru/scripting/ecs.md +++ b/doc/ru/scripting/ecs.md @@ -51,7 +51,7 @@ tsf:set_size(size: vec3) -- Возвращает вращение сущности tsf:get_rot() -> mat4 -- Устанавливает вращение сущности -tsf:set_rot(size: mat4) +tsf:set_rot(rotation: mat4) ``` ### Rigidbody diff --git a/res/content/base/package.json b/res/content/base/package.json index eeb24ed0..fc04da9c 100644 --- a/res/content/base/package.json +++ b/res/content/base/package.json @@ -1,6 +1,6 @@ { "id": "base", "title": "Base", - "version": "0.22", + "version": "0.23", "description": "basic content package" } diff --git a/src/constants.hpp b/src/constants.hpp index 59b00fb0..5189a359 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -7,7 +7,7 @@ #include inline constexpr int ENGINE_VERSION_MAJOR = 0; -inline constexpr int ENGINE_VERSION_MINOR = 22; +inline constexpr int ENGINE_VERSION_MINOR = 23; #ifdef NDEBUG inline constexpr bool ENGINE_DEBUG_BUILD = false; @@ -15,7 +15,7 @@ inline constexpr bool ENGINE_DEBUG_BUILD = false; inline constexpr bool ENGINE_DEBUG_BUILD = true; #endif // NDEBUG -inline const std::string ENGINE_VERSION_STRING = "0.22"; +inline const std::string ENGINE_VERSION_STRING = "0.23"; inline constexpr blockid_t BLOCK_AIR = 0; inline constexpr itemid_t ITEM_EMPTY = 0; diff --git a/src/graphics/render/WorldRenderer.cpp b/src/graphics/render/WorldRenderer.cpp index 4262f66b..894b5f9b 100644 --- a/src/graphics/render/WorldRenderer.cpp +++ b/src/graphics/render/WorldRenderer.cpp @@ -113,6 +113,10 @@ bool WorldRenderer::drawChunk( } void WorldRenderer::drawChunks(Chunks* chunks, Camera* camera, Shader* shader) { + auto assets = engine->getAssets(); + auto atlas = assets->get("blocks"); + + atlas->getTexture()->bind(); renderer->update(); // [warning] this whole method is not thread-safe for chunks @@ -122,8 +126,8 @@ void WorldRenderer::drawChunks(Chunks* chunks, Camera* camera, Shader* shader) { if (chunks->chunks[i] == nullptr) continue; indices.emplace_back(i); } - float px = camera->position.x / (float)CHUNK_W - 0.5f; - float pz = camera->position.z / (float)CHUNK_D - 0.5f; + float px = camera->position.x / static_cast(CHUNK_W) - 0.5f; + float pz = camera->position.z / static_cast(CHUNK_D) - 0.5f; std::sort(indices.begin(), indices.end(), [chunks, px, pz](auto i, auto j) { const auto a = chunks->chunks[i].get(); const auto b = chunks->chunks[j].get(); @@ -186,21 +190,13 @@ void WorldRenderer::renderLevel( bool pause ) { auto assets = engine->getAssets(); - auto atlas = assets->get("blocks"); bool culling = engine->getSettings().graphics.frustumCulling.get(); float fogFactor = 15.0f / ((float)settings.chunks.loadDistance.get() - 2); - auto shader = assets->get("main"); - setupWorldShader(shader, camera, settings, fogFactor); - - skybox->bind(); - atlas->getTexture()->bind(); - - drawChunks(level->chunks.get(), camera, shader); - auto entityShader = assets->get("entity"); setupWorldShader(entityShader, camera, settings, fogFactor); + skybox->bind(); level->entities->render( assets, @@ -209,11 +205,16 @@ void WorldRenderer::renderLevel( delta, pause ); + modelBatch->render(); + + auto shader = assets->get("main"); + setupWorldShader(shader, camera, settings, fogFactor); + + drawChunks(level->chunks.get(), camera, shader); if (!pause) { scripting::on_frontend_render(); } - modelBatch->render(); skybox->unbind(); } diff --git a/src/physics/PhysicsSolver.cpp b/src/physics/PhysicsSolver.cpp index 89dd89e4..8f24b4cc 100644 --- a/src/physics/PhysicsSolver.cpp +++ b/src/physics/PhysicsSolver.cpp @@ -7,6 +7,7 @@ #include #include +#include #define GLM_ENABLE_EXPERIMENTAL #include diff --git a/src/settings.hpp b/src/settings.hpp index bd556766..23a35ac5 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -57,7 +57,7 @@ struct CameraSettings { struct GraphicsSettings { /// @brief Fog opacity is calculated as `pow(depth*k, fogCurve)` where k depends on chunksLoadDistance. /// 1.0 is linear, 2.0 is quadratic - NumberSetting fogCurve {1.6f, 1.0f, 6.0f}; + NumberSetting fogCurve {1.0f, 1.0f, 6.0f}; /// @brief Lighting gamma NumberSetting gamma {1.0f, 0.4f, 1.0f}; /// @brief Enable blocks backlight to prevent complete darkness diff --git a/src/window/Window.cpp b/src/window/Window.cpp index af9d4de5..984a23e8 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -130,9 +130,12 @@ int Window::initialize(DisplaySettings* settings) { Window::width = settings->width.get(); Window::height = settings->height.get(); - std::string title = "VoxelEngine-Cpp v" + + std::string title = "VoxelCore v" + std::to_string(ENGINE_VERSION_MAJOR) + "." + std::to_string(ENGINE_VERSION_MINOR); + if (ENGINE_DEBUG_BUILD) { + title += " [debug]"; + } glfwSetErrorCallback(error_callback); if (glfwInit() == GLFW_FALSE) {