Make tools compile successfully under MSVC
This commit is contained in:
parent
b3ecbab352
commit
19a60a7a06
10 changed files with 32 additions and 20 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,7 +1,11 @@
|
||||||
extern/SPIRV-Cross/external/
|
extern/SPIRV-Cross/external/
|
||||||
|
|
||||||
|
out/
|
||||||
|
.vs/
|
||||||
|
|
||||||
build/
|
build/
|
||||||
*build/
|
*build/
|
||||||
|
CMakeSettings.json
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.17)
|
cmake_minimum_required(VERSION 3.17)
|
||||||
project(PrismEngine
|
project(PrismEngine)
|
||||||
LANGUAGES CXX)
|
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
||||||
|
|
||||||
|
|
0
data/dummy
Normal file
0
data/dummy
Normal file
10
extern/CMakeLists.txt
vendored
10
extern/CMakeLists.txt
vendored
|
@ -97,3 +97,13 @@ target_link_libraries(opusfile
|
||||||
|
|
||||||
add_subdirectory(portaudio)
|
add_subdirectory(portaudio)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_TOOLS)
|
||||||
|
FetchContent_Declare(
|
||||||
|
assimp
|
||||||
|
GIT_REPOSITORY https://github.com/assimp/assimp
|
||||||
|
GIT_TAG v5.0.1
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(assimp)
|
||||||
|
endif()
|
|
@ -42,6 +42,8 @@ wchar_t* convertToUnicode(const char* str) {
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform::force_quit() {}
|
||||||
|
|
||||||
int platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
int platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
||||||
RECT wr = {rect.offset.x, rect.offset.y, rect.extent.width, rect.extent.height};
|
RECT wr = {rect.offset.x, rect.offset.y, rect.extent.width, rect.extent.height};
|
||||||
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
|
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
|
||||||
|
|
|
@ -181,14 +181,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXTexture* get_asset_thumbnail(const file::Path path) {
|
GFXTexture* get_asset_thumbnail(const file::Path path) {
|
||||||
if(asset_thumbnails.count(path)) {
|
if(asset_thumbnails.count(path.string())) {
|
||||||
return asset_thumbnails[path];
|
return asset_thumbnails[path.string()];
|
||||||
} else {
|
} else {
|
||||||
auto [asset, block] = assetm->load_asset_generic(path);
|
auto [asset, block] = assetm->load_asset_generic(path);
|
||||||
|
|
||||||
// store as dummy texture, as to stop infinite reload because of failure (e.g. out of date model)
|
// store as dummy texture, as to stop infinite reload because of failure (e.g. out of date model)
|
||||||
if(asset == nullptr) {
|
if(asset == nullptr) {
|
||||||
asset_thumbnails[path] = engine->get_renderer()->dummyTexture;
|
asset_thumbnails[path.string()] = engine->get_renderer()->dummyTexture;
|
||||||
|
|
||||||
return engine->get_renderer()->dummyTexture;
|
return engine->get_renderer()->dummyTexture;
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ inline void editPath(const char* label, std::string& path, bool editable = true,
|
||||||
|
|
||||||
if(ImGui::Button("...")) {
|
if(ImGui::Button("...")) {
|
||||||
platform::open_dialog(false, [&path, &on_selected](std::string p) {
|
platform::open_dialog(false, [&path, &on_selected](std::string p) {
|
||||||
path = file::get_relative_path(file::Domain::App, p);
|
path = file::get_relative_path(file::Domain::App, p).string();
|
||||||
|
|
||||||
if(on_selected != nullptr)
|
if(on_selected != nullptr)
|
||||||
on_selected();
|
on_selected();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class Command {
|
class Command {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -51,13 +51,13 @@ CommonEditor::CommonEditor(std::string id) : id(id) {
|
||||||
#ifdef PLATFORM_MACOS
|
#ifdef PLATFORM_MACOS
|
||||||
file::set_domain_path(file::Domain::App, "../../../data");
|
file::set_domain_path(file::Domain::App, "../../../data");
|
||||||
#else
|
#else
|
||||||
file::set_domain_path(Domain::App, "data");
|
file::set_domain_path(file::Domain::App, "data");
|
||||||
#endif
|
#endif
|
||||||
file::set_domain_path(file::Domain::Internal, "{resource_dir}/shaders");
|
file::set_domain_path(file::Domain::Internal, "{resource_dir}/shaders");
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
iniFileName = file::get_writeable_directory() / "imgui.ini";
|
iniFileName = (file::get_writeable_directory() / "imgui.ini").string();
|
||||||
|
|
||||||
io.IniFilename = iniFileName.c_str();
|
io.IniFilename = iniFileName.c_str();
|
||||||
|
|
||||||
|
@ -805,7 +805,7 @@ void CommonEditor::drawAssets() {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if(ImGui::Button("Regenerate thumbnail")) {
|
if(ImGui::Button("Regenerate thumbnail")) {
|
||||||
asset_thumbnails.erase(asset_thumbnails.find(file::app_domain / p));
|
asset_thumbnails.erase(asset_thumbnails.find((file::app_domain / p).string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
|
|
|
@ -226,7 +226,7 @@ void DebugPass::draw_arrow(GFXCommandBuffer* commandBuffer, Vector3 color, Matri
|
||||||
commandBuffer->set_vertex_buffer(arrowMesh->position_buffer, 0, 0);
|
commandBuffer->set_vertex_buffer(arrowMesh->position_buffer, 0, 0);
|
||||||
commandBuffer->set_index_buffer(arrowMesh->index_buffer, IndexType::UINT32);
|
commandBuffer->set_index_buffer(arrowMesh->index_buffer, IndexType::UINT32);
|
||||||
|
|
||||||
commandBuffer->draw_indexed(arrowMesh->num_indices, 0, 0);
|
commandBuffer->draw_indexed(arrowMesh->num_indices, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugPass::render_scene(Scene& scene, GFXCommandBuffer* commandBuffer) {
|
void DebugPass::render_scene(Scene& scene, GFXCommandBuffer* commandBuffer) {
|
||||||
|
@ -335,7 +335,7 @@ void DebugPass::render_scene(Scene& scene, GFXCommandBuffer* commandBuffer) {
|
||||||
commandBuffer->set_vertex_buffer(cubeMesh->position_buffer, 0, 0);
|
commandBuffer->set_vertex_buffer(cubeMesh->position_buffer, 0, 0);
|
||||||
commandBuffer->set_index_buffer(cubeMesh->index_buffer, IndexType::UINT32);
|
commandBuffer->set_index_buffer(cubeMesh->index_buffer, IndexType::UINT32);
|
||||||
|
|
||||||
commandBuffer->draw_indexed(cubeMesh->num_indices, 0, 0);
|
commandBuffer->draw_indexed(cubeMesh->num_indices, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
commandBuffer->set_graphics_pipeline(billboard_pipeline);
|
commandBuffer->set_graphics_pipeline(billboard_pipeline);
|
||||||
|
@ -352,7 +352,7 @@ void DebugPass::render_scene(Scene& scene, GFXCommandBuffer* commandBuffer) {
|
||||||
commandBuffer->bind_texture(bill.texture, 2);
|
commandBuffer->bind_texture(bill.texture, 2);
|
||||||
|
|
||||||
commandBuffer->set_push_constant(&pc, sizeof(BillPushConstant));
|
commandBuffer->set_push_constant(&pc, sizeof(BillPushConstant));
|
||||||
commandBuffer->draw_indexed(4, 0, 0);
|
commandBuffer->draw_indexed(4, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
commandBuffer->set_graphics_pipeline(arrow_pipeline);
|
commandBuffer->set_graphics_pipeline(arrow_pipeline);
|
||||||
|
@ -408,7 +408,7 @@ void DebugPass::render_scene(Scene& scene, GFXCommandBuffer* commandBuffer) {
|
||||||
|
|
||||||
if(renderable.mesh) {
|
if(renderable.mesh) {
|
||||||
for (auto& part : renderable.mesh->parts)
|
for (auto& part : renderable.mesh->parts)
|
||||||
commandBuffer->draw_indexed(part.index_count, part.index_offset, part.vertex_offset);
|
commandBuffer->draw_indexed(part.index_count, part.index_offset, part.vertex_offset, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ void DebugPass::get_selected_object(int x, int y, std::function<void(SelectableO
|
||||||
commandBuffer->set_push_constant(&pc, sizeof(PC));
|
commandBuffer->set_push_constant(&pc, sizeof(PC));
|
||||||
|
|
||||||
for (auto& part : mesh->parts)
|
for (auto& part : mesh->parts)
|
||||||
commandBuffer->draw_indexed(part.index_count, part.index_offset, part.vertex_offset);
|
commandBuffer->draw_indexed(part.index_count, part.index_offset, part.vertex_offset, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->get_gfx()->submit(commandBuffer);
|
engine->get_gfx()->submit(commandBuffer);
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
find_package(assimp REQUIRED)
|
|
||||||
|
|
||||||
add_platform_executable(
|
add_platform_executable(
|
||||||
TARGET ModelCompiler
|
TARGET ModelCompiler
|
||||||
APP_CLASS ModelEditor
|
APP_CLASS ModelEditor
|
||||||
|
@ -11,9 +9,7 @@ target_link_libraries(ModelCompiler PUBLIC
|
||||||
Core
|
Core
|
||||||
EditorCommon
|
EditorCommon
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${ASSIMP_LIBRARIES})
|
assimp)
|
||||||
target_include_directories(ModelCompiler PUBLIC
|
target_include_directories(ModelCompiler PUBLIC
|
||||||
include
|
include)
|
||||||
PRIVATE
|
|
||||||
${ASSIMP_INCLUDE_DIRS})
|
|
||||||
set_engine_properties(ModelCompiler)
|
set_engine_properties(ModelCompiler)
|
||||||
|
|
Reference in a new issue