fix pipe rotation + test blocks
This commit is contained in:
parent
cb13b42960
commit
ae10ca248d
@ -9,7 +9,7 @@ file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
|||||||
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
|
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
|
||||||
|
|
||||||
if(MSVC)
|
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")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /source-charset:UTF-8")
|
||||||
else()
|
else()
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -lstdc++fs
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -lstdc++fs
|
||||||
|
|||||||
16
res/content/base/blocks/torch.json
Normal file
16
res/content/base/blocks/torch.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
16
res/content/base/blocks/wallpaper.json
Normal file
16
res/content/base/blocks/wallpaper.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
@ -24,6 +24,8 @@
|
|||||||
"blue_lamp",
|
"blue_lamp",
|
||||||
"pane",
|
"pane",
|
||||||
"pipe",
|
"pipe",
|
||||||
"lightbulb"
|
"lightbulb",
|
||||||
|
"torch",
|
||||||
|
"wallpaper"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
res/textures/blocks/torch_bottom.png
Normal file
BIN
res/textures/blocks/torch_bottom.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 129 B |
BIN
res/textures/blocks/torch_side.png
Normal file
BIN
res/textures/blocks/torch_side.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 163 B |
BIN
res/textures/blocks/torch_top.png
Normal file
BIN
res/textures/blocks/torch_top.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 131 B |
BIN
res/textures/blocks/transparent.png
Normal file
BIN
res/textures/blocks/transparent.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 126 B |
BIN
res/textures/blocks/wallpaper_s.png
Normal file
BIN
res/textures/blocks/wallpaper_s.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 171 KiB |
BIN
res/textures/blocks/white.png
Normal file
BIN
res/textures/blocks/white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 B |
@ -117,12 +117,12 @@ void CameraControl::update(PlayerInput& input, float delta, Chunks* chunks) {
|
|||||||
player->currentViewCamera = camera;
|
player->currentViewCamera = camera;
|
||||||
}
|
}
|
||||||
if (player->currentViewCamera == player->SPCamera) {
|
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->dir = -camera->dir;
|
||||||
player->SPCamera->front = -camera->front;
|
player->SPCamera->front = -camera->front;
|
||||||
}
|
}
|
||||||
else if (player->currentViewCamera == player->TPCamera) {
|
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->dir = camera->dir;
|
||||||
player->TPCamera->front = camera->front;
|
player->TPCamera->front = camera->front;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,11 +14,11 @@ void CoordSystem::transform(AABB& aabb) {
|
|||||||
aabb.b += fix2;
|
aabb.b += fix2;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BlockRotProfile BlockRotProfile::PIPE {"pipe", {
|
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
|
{ { 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
|
{ { 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 }, { 0, 1, 0 }, { 0, 0, 1 } }, // South
|
{ { -1, 0, 0 }, { 0, 0,-1 }, { 0, -1, 0 }, { 1, 0, 0 }, { 1, 1, 1 } }, // South
|
||||||
{ { 0,-1, 0 }, { 1, 0, 0 }, { 0, 0, 1 }, { 0, 1, 0 }, { 0, 1, 0 } }, // West
|
{ { 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, 0, 0 }, { 0, 0, 0 } }, // Up
|
||||||
{ { 1, 0, 0 }, { 0,-1, 0 }, { 0, 0,-1 }, { 0, 1,-1 }, { 0, 1, 1 } }, // Down
|
{ { 1, 0, 0 }, { 0,-1, 0 }, { 0, 0,-1 }, { 0, 1,-1 }, { 0, 1, 1 } }, // Down
|
||||||
}};
|
}};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user