Merge branch 'develop' into fix-winderps

develop^2
Austin (SonosFuer) 2020-08-19 16:11:21 -07:00 committed by GitHub
commit 73fb80e37f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 20 deletions

View File

@ -1,6 +1,28 @@
cmake_minimum_required(VERSION 3.8)
project(Phoenix)
cmake_minimum_required(VERSION 3.12)
project(
Phoenix
VERSION 0.2
LANGUAGES CXX)
# Use folders.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Update git submodules.
find_package(Git QUIET)
if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
option(UPDATE_SUBMODULES "Update git submodules during build." ON)
if(UPDATE_SUBMODULES)
message(STATUS "Updating git submodules.")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMODULE_RESULT)
if(NOT GIT_SUBMODULE_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMODULE_RESULT}, please checkout submodules.")
endif()
else()
message(STATUS "Git submodules set to manual update only, this can be changed with the UPDATE_SUBMODULES option.")
endif()
endif()
add_subdirectory(Phoenix)

View File

@ -127,9 +127,10 @@ namespace phx::gfx
static std::vector<ShaderLayout> getRequiredShaderLayout();
/**
* @brief Gets the table of textures and how they are allocated on the
* GPU.
* @return The locations of the textures on the GPU.
* @brief Gets the table telling everything where each texture is in the
* GPU-side array.
* @return An associative table storing which textures are on which
* layers within the texture array.
*/
const AssociativeTextureTable& getTextureTable() const;

View File

@ -53,7 +53,8 @@ namespace phx::client
{
BlockRegistry()
{
textures.add(voxels::BlockType::UNKNOWN_BLOCK, {"Assets/unknown.png"});
textures.add(voxels::BlockType::UNKNOWN_BLOCK,
{"Assets/unknown.png"});
textures.setUnknownReturnVal(
textures.get(voxels::BlockType::UNKNOWN_BLOCK));
}

View File

@ -60,8 +60,13 @@ std::vector<voxels::Chunk*> PlayerView::update(entt::registry* registry,
math::vec3 chunkToCheck = {static_cast<float>(x + posX),
static_cast<float>(y + posY),
static_cast<float>(z + posZ)};
chunkToCheck = chunkToCheck *
static_cast<float>(voxels::Chunk::CHUNK_WIDTH);
// this will allow it to work if we choose to make chunks non cube.
chunkToCheck =
chunkToCheck * math::vec3 {voxels::Chunk::CHUNK_WIDTH,
voxels::Chunk::CHUNK_HEIGHT,
voxels::Chunk::CHUNK_DEPTH};
bool hasChunk = false;
for (const auto chunk : view.chunks)
{
@ -71,6 +76,7 @@ std::vector<voxels::Chunk*> PlayerView::update(entt::registry* registry,
break;
}
}
if (!hasChunk)
{
voxels::Chunk* chunk = view.map->getChunk(chunkToCheck);
@ -84,5 +90,6 @@ std::vector<voxels::Chunk*> PlayerView::update(entt::registry* registry,
}
}
}
return newChunks;
}

View File

@ -257,9 +257,9 @@ void Map::save(const phx::math::vec3& pos)
}
std::ofstream saveFile;
std::string position = "." + std::to_string(int(pos.x)) + "_" +
std::to_string(int(pos.y)) + "_" +
std::to_string(int(pos.z));
std::string position = "." + std::to_string(static_cast<int>(pos.x)) + "_" +
std::to_string(static_cast<int>(pos.y)) + "_" +
std::to_string(static_cast<int>(pos.z));
saveFile.open("Saves/" + m_save->getName() + "/" + m_mapName + position + ".save");
std::string saveString;

View File

@ -44,9 +44,7 @@ jobs:
# key: 'ccache | "$(Agent.JobName)"'
# path: $(CCACHE_DIR)
# displayName: 'CCache'
- script: git submodule update --init
displayName: 'Cloning Submodules'
- script: cmake -H. -BBuild
- script: cmake -S . -B Build
displayName: 'CMake Configure'
- script: cmake --build Build
displayName: 'CMake Build'
@ -62,9 +60,7 @@ jobs:
CMakeArgs: ''
steps:
- script: git submodule update --init
displayName: 'Cloning Submodules'
- script: cmake -H. -BBuild
- script: cmake -S . -B Build
displayName: 'CMake Configure'
- script: cmake --build Build
displayName: 'CMake Build'
@ -75,9 +71,7 @@ jobs:
vmImage: 'macOS-latest'
steps:
- script: git submodule update --init
displayName: 'Cloning Submodules'
- script: cmake -H. -BBuild
- script: cmake -S . -B Build
displayName: 'CMake Configure'
- script: cmake --build Build
displayName: 'CMake Build'