diff --git a/CMakeLists.txt b/CMakeLists.txt index c8429711..d8b2f632 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES}) if(MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4) + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /O2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /source-charset:UTF-8") else() target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -lstdc++fs diff --git a/res/content/base/blocks/torch.json b/res/content/base/blocks/torch.json new file mode 100644 index 00000000..93076841 --- /dev/null +++ b/res/content/base/blocks/torch.json @@ -0,0 +1,16 @@ +{ + "texture-faces": [ + "torch_side", + "torch_side", + "torch_bottom", + "torch_top", + "torch_side", + "torch_side" + ], + "emission": [13, 13, 12], + "model": "aabb", + "hitbox": [0.3, 0.0, 0.7, 0.125, 0.5, 0.125], + "light-passing": true, + "obstacle": false, + "rotation": "pipe" +} diff --git a/res/content/base/blocks/wallpaper.json b/res/content/base/blocks/wallpaper.json new file mode 100644 index 00000000..d8624071 --- /dev/null +++ b/res/content/base/blocks/wallpaper.json @@ -0,0 +1,16 @@ +{ + "texture-faces": [ + "white", + "white", + "wallpaper_s", + "wallpaper_s", + "white", + "white" + ], + "emission": [0, 0, 0], + "model": "aabb", + "hitbox": [0.0, 0.0, 0.0, 1.0, 0.01, 1.0], + "light-passing": true, + "obstacle": false, + "rotation": "pipe" +} diff --git a/res/content/base/package.json b/res/content/base/package.json index f131099f..8e16edd9 100644 --- a/res/content/base/package.json +++ b/res/content/base/package.json @@ -24,6 +24,8 @@ "blue_lamp", "pane", "pipe", - "lightbulb" + "lightbulb", + "torch", + "wallpaper" ] } diff --git a/res/textures/blocks/torch_bottom.png b/res/textures/blocks/torch_bottom.png new file mode 100644 index 00000000..415fa6c2 Binary files /dev/null and b/res/textures/blocks/torch_bottom.png differ diff --git a/res/textures/blocks/torch_side.png b/res/textures/blocks/torch_side.png new file mode 100644 index 00000000..d324bb9d Binary files /dev/null and b/res/textures/blocks/torch_side.png differ diff --git a/res/textures/blocks/torch_top.png b/res/textures/blocks/torch_top.png new file mode 100644 index 00000000..bd666b8a Binary files /dev/null and b/res/textures/blocks/torch_top.png differ diff --git a/res/textures/blocks/transparent.png b/res/textures/blocks/transparent.png new file mode 100644 index 00000000..dde5384b Binary files /dev/null and b/res/textures/blocks/transparent.png differ diff --git a/res/textures/blocks/wallpaper_s.png b/res/textures/blocks/wallpaper_s.png new file mode 100644 index 00000000..c13e1082 Binary files /dev/null and b/res/textures/blocks/wallpaper_s.png differ diff --git a/res/textures/blocks/white.png b/res/textures/blocks/white.png new file mode 100644 index 00000000..771c145c Binary files /dev/null and b/res/textures/blocks/white.png differ diff --git a/src/logic/PlayerController.cpp b/src/logic/PlayerController.cpp index da594c15..d0caf2ef 100644 --- a/src/logic/PlayerController.cpp +++ b/src/logic/PlayerController.cpp @@ -117,12 +117,12 @@ void CameraControl::update(PlayerInput& input, float delta, Chunks* chunks) { player->currentViewCamera = camera; } if (player->currentViewCamera == player->SPCamera) { - player->SPCamera->position = chunks->rayCastToObstacle(camera->position, camera->front, 3.0f); + player->SPCamera->position = chunks->rayCastToObstacle(camera->position, camera->front, 3.0f) - 0.2f*(camera->front); player->SPCamera->dir = -camera->dir; player->SPCamera->front = -camera->front; } else if (player->currentViewCamera == player->TPCamera) { - player->TPCamera->position = chunks->rayCastToObstacle(camera->position, -camera->front, 3.0f); + player->TPCamera->position = chunks->rayCastToObstacle(camera->position, -camera->front, 3.0f) + 0.2f * (camera->front); player->TPCamera->dir = camera->dir; player->TPCamera->front = camera->front; } diff --git a/src/voxels/Block.cpp b/src/voxels/Block.cpp index 5a83bfa2..8ffec617 100644 --- a/src/voxels/Block.cpp +++ b/src/voxels/Block.cpp @@ -14,11 +14,11 @@ void CoordSystem::transform(AABB& aabb) { aabb.b += fix2; } -const BlockRotProfile BlockRotProfile::PIPE {"pipe", { - { { 1, 0, 0 }, { 0, 0, 1 }, { 0,-1, 0 }, { 0, 0,-1 }, { 0, 1, 0 } }, // North - { { 0, 1, 0 }, {-1, 0, 0 }, { 0, 0, 1 }, { 1, 0, 0 }, { 1, 0, 0 } }, // East - { { 1, 0, 0 }, { 0, 0,-1 }, { 0, 1, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }, // South - { { 0,-1, 0 }, { 1, 0, 0 }, { 0, 0, 1 }, { 0, 1, 0 }, { 0, 1, 0 } }, // West +const BlockRotProfile BlockRotProfile::PIPE {"pipe", {//TODO consexpr or init-time fix and fix2 calculations + { { 1, 0, 0 }, { 0, 0, 1 }, { 0, -1, 0 }, { 0, 0, -1 }, { 0, 1, 0 } }, // North + { { 0, 0, 1 }, {-1, 0, 0 }, { 0, -1, 0 }, { 1, 0, -1 }, { 1, 1, 0 } }, // East + { { -1, 0, 0 }, { 0, 0,-1 }, { 0, -1, 0 }, { 1, 0, 0 }, { 1, 1, 1 } }, // South + { { 0, 0, -1 }, { 1, 0, 0 }, { 0, -1, 0 }, { 0, 0, 0 }, { 0, 1, 1 } }, // West { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }, // Up { { 1, 0, 0 }, { 0,-1, 0 }, { 0, 0,-1 }, { 0, 1,-1 }, { 0, 1, 1 } }, // Down }};