Fixing metal swapchain
This commit is contained in:
+10
-8
@@ -78,7 +78,6 @@ target_link_libraries(Engine PUBLIC crcpp)
|
||||
target_link_libraries(Engine PUBLIC fmt::fmt)
|
||||
target_link_libraries(Engine PUBLIC GPUOpen::VulkanMemoryAllocator)
|
||||
target_link_libraries(Engine PUBLIC slang)
|
||||
target_link_libraries(Engine PUBLIC spirv-cross-glsl spirv-cross-msl)
|
||||
target_link_libraries(Engine PUBLIC glslang::glslang)
|
||||
if(APPLE)
|
||||
target_include_directories(Engine PUBLIC /usr/local/include)
|
||||
@@ -108,11 +107,11 @@ if(MSVC)
|
||||
target_compile_options(Editor PUBLIC /std:c++20 /Zi /MP14 /W4 /DEBUG)
|
||||
target_sources(Engine INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Seele.natvis>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/Seele.natvis>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/Seele/Seele.natvis>
|
||||
)
|
||||
install(FILES
|
||||
Seele.natvis
|
||||
DESTINATION .)
|
||||
DESTINATION Seele/)
|
||||
else()
|
||||
target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-error -pedantic -std=c++20 -Wno-missing-field-initializers -Wno-unused-function -fsanitize=address)
|
||||
target_compile_options(Editor PUBLIC -g -Wall -Wextra -Wno-error -pedantic -std=c++20 -fsanitize=address)
|
||||
@@ -161,7 +160,7 @@ install(
|
||||
EXPORT
|
||||
EngineTargets
|
||||
FILE_SET HEADERS
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/Seele)
|
||||
|
||||
export(EXPORT EngineTargets
|
||||
FILE "${CMAKE_BINARY_DIR}/EngineTargets.cmake"
|
||||
@@ -179,19 +178,22 @@ install(EXPORT EngineTargets
|
||||
NAMESPACE
|
||||
Seele::
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
${CMAKE_INSTALL_PREFIX}/lib/cmake/Seele
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_BINARY_DIR}/SeeleConfig.cmake
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
${CMAKE_INSTALL_PREFIX}/lib/cmake/Seele
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY
|
||||
${CMAKE_SOURCE_DIR}/res
|
||||
${CMAKE_SOURCE_DIR}/res/cmake
|
||||
${CMAKE_SOURCE_DIR}/res/fonts
|
||||
${CMAKE_SOURCE_DIR}/res/shaders
|
||||
${CMAKE_SOURCE_DIR}/res/textures
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
${CMAKE_INSTALL_PREFIX}/bin
|
||||
)
|
||||
|
||||
@@ -39,12 +39,12 @@ add_library(crcpp INTERFACE)
|
||||
|
||||
target_include_directories(crcpp INTERFACE
|
||||
$<BUILD_INTERFACE:${CRCPP_ROOT}/inc>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<INSTALL_INTERFACE:include/Seele/>
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${CRCPP_ROOT}/inc/CRC.h
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/Seele
|
||||
)
|
||||
|
||||
add_library(metal INTERFACE)
|
||||
|
||||
@@ -31,5 +31,5 @@ float4 fragmentMain(in FragmentParameter params) : SV_Target
|
||||
//uint lightIndex = pLightCullingData.lightIndexList[startOffset + i];
|
||||
result += pLightEnv.pointLights[i].illuminate(lightingParams, brdf);
|
||||
}
|
||||
return float4(params.vertexColor, 1.0f);
|
||||
return float4(1.0f, 0.1f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
+247
-251
@@ -1,20 +1,17 @@
|
||||
#include "Graphics/Initializer.h"
|
||||
#include "Graphics/Metal/Graphics.h"
|
||||
#include "Window/WindowManager.h"
|
||||
#include "Window/SceneView.h"
|
||||
#include "Window/PlayView.h"
|
||||
#include "Window/InspectorView.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/AssetImporter.h"
|
||||
#include "Asset/TextureLoader.h"
|
||||
#include "Graphics/Vulkan/Graphics.h"
|
||||
#include "Graphics/Metal/Graphics.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/FontLoader.h"
|
||||
#include "Asset/MaterialLoader.h"
|
||||
#include "Asset/MeshLoader.h"
|
||||
#include "Asset/TextureLoader.h"
|
||||
#include "Asset/MaterialLoader.h"
|
||||
#include "Asset/FontLoader.h"
|
||||
#include "Asset/AssetImporter.h"
|
||||
#include "Graphics/Initializer.h"
|
||||
#include "Graphics/Metal/Graphics.h"
|
||||
#include "Graphics/StaticMeshVertexData.h"
|
||||
#include "Graphics/Vulkan/Graphics.h"
|
||||
#include "Window/InspectorView.h"
|
||||
#include "Window/PlayView.h"
|
||||
#include "Window/SceneView.h"
|
||||
#include "Window/WindowManager.h"
|
||||
#include <fmt/core.h>
|
||||
|
||||
using namespace Seele;
|
||||
@@ -23,256 +20,255 @@ using namespace Seele::Editor;
|
||||
// make it global so it gets deleted last and automatically
|
||||
static Gfx::OGraphics graphics;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
#ifdef WIN32
|
||||
std::filesystem::path outputPath = "C:/Users/Dynamitos/TrackClearGame";
|
||||
std::filesystem::path sourcePath= "C:/Users/Dynamitos/TrackClear";
|
||||
std::filesystem::path binaryPath = sourcePath / "bin" / "TrackClear.dll";
|
||||
std::filesystem::path outputPath = "C:/Users/Dynamitos/MeshShadingDemoGame";
|
||||
std::filesystem::path sourcePath = "C:/Users/Dynamitos/MeshShadingDemo";
|
||||
std::filesystem::path binaryPath = sourcePath / "bin" / "MeshShadingDemo.dll";
|
||||
#elif __APPLE__
|
||||
std::filesystem::path outputPath = "/Users/dynamitos/TrackClearGame";
|
||||
std::filesystem::path sourcePath= "/Users/dynamitos/TrackClear";
|
||||
std::filesystem::path binaryPath = sourcePath / "cmake" / "libTrackClear.dylib";
|
||||
std::filesystem::path outputPath = "/Users/dynamitos/MeshShadingDemoGame";
|
||||
std::filesystem::path sourcePath = "/Users/dynamitos/MeshShadingDemo";
|
||||
std::filesystem::path binaryPath = sourcePath / "cmake" / "libMeshShadingDemo.dylib";
|
||||
#else
|
||||
std::filesystem::path outputPath = "/home/dynamitos/TrackClearGame";
|
||||
std::filesystem::path sourcePath= "/home/dynamitos/TrackClear";
|
||||
std::filesystem::path binaryPath = sourcePath / "cmake" / "libTrackClear.so";
|
||||
std::filesystem::path outputPath = "/home/dynamitos/MeshShadingDemoGame";
|
||||
std::filesystem::path sourcePath = "/home/dynamitos/MeshShadingDemo";
|
||||
std::filesystem::path binaryPath = sourcePath / "cmake" / "libMeshShadingDemo.so";
|
||||
#endif
|
||||
std::string gameName = "TrackClear";
|
||||
std::filesystem::path cmakePath = outputPath / "cmake";
|
||||
std::string gameName = "MeshShadingDemo";
|
||||
std::filesystem::path cmakePath = outputPath / "cmake";
|
||||
|
||||
#ifdef __APPLE__
|
||||
graphics = new Metal::Graphics();
|
||||
graphics = new Metal::Graphics();
|
||||
#else
|
||||
graphics = new Vulkan::Graphics();
|
||||
graphics = new Vulkan::Graphics();
|
||||
#endif
|
||||
GraphicsInitializer initializer;
|
||||
graphics->init(initializer);
|
||||
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
||||
vd->init(graphics);
|
||||
OWindowManager windowManager = new WindowManager();
|
||||
AssetRegistry::init(sourcePath / "Assets", graphics);
|
||||
AssetImporter::init(graphics);
|
||||
AssetImporter::importFont(FontImportArgs{
|
||||
.filePath = "./fonts/Calibri.ttf",
|
||||
});
|
||||
//AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath = sourcePath / "old_resources/models/arena.fbx",
|
||||
// });
|
||||
AssetImporter::importMesh(MeshImportArgs{
|
||||
.filePath = sourcePath / "old_resources/models/frog.fbx",
|
||||
});
|
||||
AssetImporter::importMesh(MeshImportArgs{
|
||||
.filePath = sourcePath / "old_resources/models/train.fbx",
|
||||
});
|
||||
//AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/bird.fbx",
|
||||
// });
|
||||
AssetImporter::importMesh(MeshImportArgs{
|
||||
.filePath= sourcePath / "old_resources/models/cube.fbx",
|
||||
});
|
||||
//AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/flameThrower.fbx",
|
||||
// });
|
||||
//AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/player.fbx",
|
||||
// });
|
||||
//AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/shotgun.fbx",
|
||||
// });
|
||||
//AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/track.fbx",
|
||||
// });
|
||||
//AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/zombie.fbx",
|
||||
// });
|
||||
GraphicsInitializer initializer;
|
||||
graphics->init(initializer);
|
||||
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
||||
vd->init(graphics);
|
||||
OWindowManager windowManager = new WindowManager();
|
||||
AssetRegistry::init(sourcePath / "Assets", graphics);
|
||||
AssetImporter::init(graphics);
|
||||
AssetImporter::importFont(FontImportArgs{
|
||||
.filePath = "./fonts/Calibri.ttf",
|
||||
});
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath = sourcePath / "old_resources/models/arena.fbx",
|
||||
// });
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath = sourcePath / "old_resources/models/frog.fbx",
|
||||
// });
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath = sourcePath / "old_resources/models/train.fbx",
|
||||
// });
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/bird.fbx",
|
||||
// });
|
||||
AssetImporter::importMesh(MeshImportArgs{
|
||||
.filePath = sourcePath / "import/models/cube.fbx",
|
||||
});
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/flameThrower.fbx",
|
||||
// });
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/player.fbx",
|
||||
// });
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/shotgun.fbx",
|
||||
// });
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/track.fbx",
|
||||
// });
|
||||
// AssetImporter::importMesh(MeshImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/models/zombie.fbx",
|
||||
// });
|
||||
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Dirt.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/DirtGrass.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Grass.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Ice.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Lava.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Obsidian.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Rocks.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Sand.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Water.png",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/Wood.png",
|
||||
});
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Dirt.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/DirtGrass.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Grass.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Ice.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Lava.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Obsidian.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Rocks.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Sand.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Water.png",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/Wood.png",
|
||||
// });
|
||||
//
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level0/blendMap.png",
|
||||
// .importPath = "level0",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level0/heightMap.png",
|
||||
// .importPath = "level0",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level0/trackMap.png",
|
||||
// .importPath = "level0",
|
||||
// });
|
||||
// AssetImporter::importMaterial(MaterialImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/shaders/TerrainMaterial.json",
|
||||
// .importPath = "level0",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level1/blendMap.png",
|
||||
// .importPath = "level1",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level1/heightMap.png",
|
||||
// .importPath = "level1",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level1/trackMap.png",
|
||||
// .importPath = "level1",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level2/blendMap.png",
|
||||
// .importPath = "level2",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level2/heightMap.png",
|
||||
// .importPath = "level2",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level2/trackMap.png",
|
||||
// .importPath = "level2",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level3/blendMap.png",
|
||||
// .importPath = "level3",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level3/heightMap.png",
|
||||
// .importPath = "level3",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level3/trackMap.png",
|
||||
// .importPath = "level3",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level4/blendMap.png",
|
||||
// .importPath = "level4",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level4/heightMap.png",
|
||||
// .importPath = "level4",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level4/trackMap.png",
|
||||
// .importPath = "level4",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level5/blendMap.png",
|
||||
// .importPath = "level5",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level5/heightMap.png",
|
||||
// .importPath = "level5",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level5/trackMap.png",
|
||||
// .importPath = "level5",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level6/blendMap.png",
|
||||
// .importPath = "level6",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level6/heightMap.png",
|
||||
// .importPath = "level6",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level6/trackMap.png",
|
||||
// .importPath = "level6",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level7/blendMap.png",
|
||||
// .importPath = "level7",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level7/heightMap.png",
|
||||
// .importPath = "level7",
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/textures/level7/trackMap.png",
|
||||
// .importPath = "level7",
|
||||
// });
|
||||
//
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/skyboxes/FS000_Day_01.png",
|
||||
// .type = TextureImportType::TEXTURE_CUBEMAP,
|
||||
// });
|
||||
// AssetImporter::importTexture(TextureImportArgs{
|
||||
// .filePath= sourcePath / "old_resources/skyboxes/FS000_Night_01.png",
|
||||
// .type = TextureImportType::TEXTURE_CUBEMAP,
|
||||
// });
|
||||
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level0/blendMap.png",
|
||||
.importPath = "level0",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level0/heightMap.png",
|
||||
.importPath = "level0",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level0/trackMap.png",
|
||||
.importPath = "level0",
|
||||
});
|
||||
AssetImporter::importMaterial(MaterialImportArgs{
|
||||
.filePath= sourcePath / "old_resources/shaders/TerrainMaterial.json",
|
||||
.importPath = "level0",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level1/blendMap.png",
|
||||
.importPath = "level1",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level1/heightMap.png",
|
||||
.importPath = "level1",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level1/trackMap.png",
|
||||
.importPath = "level1",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level2/blendMap.png",
|
||||
.importPath = "level2",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level2/heightMap.png",
|
||||
.importPath = "level2",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level2/trackMap.png",
|
||||
.importPath = "level2",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level3/blendMap.png",
|
||||
.importPath = "level3",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level3/heightMap.png",
|
||||
.importPath = "level3",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level3/trackMap.png",
|
||||
.importPath = "level3",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level4/blendMap.png",
|
||||
.importPath = "level4",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level4/heightMap.png",
|
||||
.importPath = "level4",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level4/trackMap.png",
|
||||
.importPath = "level4",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level5/blendMap.png",
|
||||
.importPath = "level5",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level5/heightMap.png",
|
||||
.importPath = "level5",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level5/trackMap.png",
|
||||
.importPath = "level5",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level6/blendMap.png",
|
||||
.importPath = "level6",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level6/heightMap.png",
|
||||
.importPath = "level6",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level6/trackMap.png",
|
||||
.importPath = "level6",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level7/blendMap.png",
|
||||
.importPath = "level7",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level7/heightMap.png",
|
||||
.importPath = "level7",
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/textures/level7/trackMap.png",
|
||||
.importPath = "level7",
|
||||
});
|
||||
WindowCreateInfo mainWindowInfo;
|
||||
mainWindowInfo.title = "SeeleEngine";
|
||||
mainWindowInfo.width = 1920;
|
||||
mainWindowInfo.height = 1080;
|
||||
mainWindowInfo.preferredFormat = Gfx::SE_FORMAT_B8G8R8A8_SRGB;
|
||||
auto window = windowManager->addWindow(graphics, mainWindowInfo);
|
||||
ViewportCreateInfo sceneViewInfo;
|
||||
sceneViewInfo.dimensions.size.x = 1920;
|
||||
sceneViewInfo.dimensions.size.y = 1080;
|
||||
sceneViewInfo.dimensions.offset.x = 0;
|
||||
sceneViewInfo.dimensions.offset.y = 0;
|
||||
sceneViewInfo.numSamples = Gfx::SE_SAMPLE_COUNT_1_BIT;
|
||||
OGameView sceneView = new Editor::PlayView(graphics, window, sceneViewInfo, binaryPath.generic_string());
|
||||
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/skyboxes/FS000_Day_01.png",
|
||||
.type = TextureImportType::TEXTURE_CUBEMAP,
|
||||
});
|
||||
AssetImporter::importTexture(TextureImportArgs{
|
||||
.filePath= sourcePath / "old_resources/skyboxes/FS000_Night_01.png",
|
||||
.type = TextureImportType::TEXTURE_CUBEMAP,
|
||||
});
|
||||
// ViewportCreateInfo inspectorViewInfo;
|
||||
// inspectorViewInfo.dimensions.size.x = 640;
|
||||
// inspectorViewInfo.dimensions.size.y = 720;
|
||||
// inspectorViewInfo.dimensions.offset.x = 640;
|
||||
// inspectorViewInfo.dimensions.offset.y = 0;
|
||||
// PInspectorView inspectorView = new InspectorView(graphics, window, inspectorViewInfo);
|
||||
// window->addView(inspectorView);
|
||||
sceneView->setFocused();
|
||||
|
||||
WindowCreateInfo mainWindowInfo;
|
||||
mainWindowInfo.title = "SeeleEngine";
|
||||
mainWindowInfo.width = 1920;
|
||||
mainWindowInfo.height = 1080;
|
||||
mainWindowInfo.preferredFormat = Gfx::SE_FORMAT_B8G8R8A8_SRGB;
|
||||
auto window = windowManager->addWindow(graphics, mainWindowInfo);
|
||||
ViewportCreateInfo sceneViewInfo;
|
||||
sceneViewInfo.dimensions.size.x = 1920;
|
||||
sceneViewInfo.dimensions.size.y = 1080;
|
||||
sceneViewInfo.dimensions.offset.x = 0;
|
||||
sceneViewInfo.dimensions.offset.y = 0;
|
||||
sceneViewInfo.numSamples = Gfx::SE_SAMPLE_COUNT_1_BIT;
|
||||
OGameView sceneView = new Editor::PlayView(graphics, window, sceneViewInfo, binaryPath.generic_string());
|
||||
|
||||
//ViewportCreateInfo inspectorViewInfo;
|
||||
//inspectorViewInfo.dimensions.size.x = 640;
|
||||
//inspectorViewInfo.dimensions.size.y = 720;
|
||||
//inspectorViewInfo.dimensions.offset.x = 640;
|
||||
//inspectorViewInfo.dimensions.offset.y = 0;
|
||||
//PInspectorView inspectorView = new InspectorView(graphics, window, inspectorViewInfo);
|
||||
//window->addView(inspectorView);
|
||||
sceneView->setFocused();
|
||||
|
||||
|
||||
while (windowManager->isActive())
|
||||
{
|
||||
windowManager->render();
|
||||
}
|
||||
vd->destroy();
|
||||
//export game
|
||||
if (false)
|
||||
{
|
||||
std::filesystem::create_directories(outputPath);
|
||||
std::system(fmt::format("cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGAME_TITLE=\"{}\" -DGAME_DESTINATION=\"{}\" -DGAME_BINARY=\"{}\" -P ./cmake/ExportProject.cmake", gameName, outputPath.generic_string(), binaryPath.generic_string()).c_str());
|
||||
std::system(fmt::format("cmake -S {} -B {}", cmakePath.generic_string(), cmakePath.generic_string()).c_str());
|
||||
std::system(fmt::format("cmake --build {}", cmakePath.generic_string()).c_str());
|
||||
std::filesystem::copy(sourcePath / "Assets", outputPath / "Assets", std::filesystem::copy_options::recursive);
|
||||
std::filesystem::copy("shaders", outputPath / "shaders", std::filesystem::copy_options::recursive);
|
||||
std::filesystem::copy("textures", outputPath / "textures", std::filesystem::copy_options::recursive);
|
||||
while (windowManager->isActive()) {
|
||||
windowManager->render();
|
||||
}
|
||||
vd->destroy();
|
||||
// export game
|
||||
if (false) {
|
||||
std::filesystem::create_directories(outputPath);
|
||||
std::system(fmt::format("cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGAME_TITLE=\"{}\" -DGAME_DESTINATION=\"{}\" "
|
||||
"-DGAME_BINARY=\"{}\" -P ./cmake/ExportProject.cmake",
|
||||
gameName, outputPath.generic_string(), binaryPath.generic_string())
|
||||
.c_str());
|
||||
std::system(fmt::format("cmake -S {} -B {}", cmakePath.generic_string(), cmakePath.generic_string()).c_str());
|
||||
std::system(fmt::format("cmake --build {}", cmakePath.generic_string()).c_str());
|
||||
std::filesystem::copy(sourcePath / "Assets", outputPath / "Assets", std::filesystem::copy_options::recursive);
|
||||
std::filesystem::copy("shaders", outputPath / "shaders", std::filesystem::copy_options::recursive);
|
||||
std::filesystem::copy("textures", outputPath / "textures", std::filesystem::copy_options::recursive);
|
||||
#ifdef WIN32
|
||||
std::filesystem::copy_file("assimp-vc143-mt.dll", outputPath / "assimp-vc143-mt.dll");
|
||||
std::filesystem::copy_file("slang.dll", outputPath / "slang.dll");
|
||||
std::filesystem::copy_file("slang-glslang.dll", outputPath / "slang-glslang.dll");
|
||||
std::filesystem::copy_file("slang-llvm.dll", outputPath / "slang-llvm.dll");
|
||||
std::filesystem::copy_file("assimp-vc143-mt.dll", outputPath / "assimp-vc143-mt.dll");
|
||||
std::filesystem::copy_file("slang.dll", outputPath / "slang.dll");
|
||||
std::filesystem::copy_file("slang-glslang.dll", outputPath / "slang-glslang.dll");
|
||||
std::filesystem::copy_file("slang-llvm.dll", outputPath / "slang-llvm.dll");
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -25,6 +25,7 @@ void Command::beginRenderPass(PRenderPass renderPass) {
|
||||
blitEncoder->endEncoding();
|
||||
blitEncoder = nullptr;
|
||||
}
|
||||
renderPass->updateRenderPass();
|
||||
parallelEncoder = cmdBuffer->parallelRenderCommandEncoder(renderPass->getDescriptor());
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ void Graphics::init(GraphicsInitializer)
|
||||
queue = new CommandQueue(this);
|
||||
ioQueue = new IOCommandQueue(this);
|
||||
cache = new PipelineCache(this, "pipelines.metal");
|
||||
meshShadingEnabled = true;
|
||||
meshShadingEnabled = false;
|
||||
}
|
||||
|
||||
Gfx::OWindow Graphics::createWindow(const WindowCreateInfo &createInfo)
|
||||
|
||||
@@ -12,6 +12,7 @@ class RenderPass : public Gfx::RenderPass
|
||||
public:
|
||||
RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, Gfx::PViewport viewport);
|
||||
virtual ~RenderPass();
|
||||
void updateRenderPass();
|
||||
MTL::RenderPassDescriptor* getDescriptor() const
|
||||
{
|
||||
return renderPass;
|
||||
@@ -20,8 +21,6 @@ private:
|
||||
PGraphics graphics;
|
||||
Gfx::PViewport viewport;
|
||||
MTL::RenderPassDescriptor* renderPass;
|
||||
MTL::RenderPassDepthAttachmentDescriptor* depth;
|
||||
MTL::RenderPassStencilAttachmentDescriptor* stencil;
|
||||
};
|
||||
DEFINE_REF(RenderPass)
|
||||
} // namespace Metal
|
||||
|
||||
@@ -7,55 +7,53 @@
|
||||
using namespace Seele;
|
||||
using namespace Seele::Metal;
|
||||
|
||||
RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout,
|
||||
Array<Gfx::SubPassDependency> dependencies,
|
||||
RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies,
|
||||
Gfx::PViewport viewport)
|
||||
: Gfx::RenderPass(layout, dependencies), graphics(graphics),
|
||||
viewport(viewport) {
|
||||
renderPass = MTL::RenderPassDescriptor::alloc()->init();
|
||||
: Gfx::RenderPass(layout, dependencies), graphics(graphics), viewport(viewport) {
|
||||
renderPass = MTL::RenderPassDescriptor::renderPassDescriptor();
|
||||
renderPass->setRenderTargetArrayLength(1);
|
||||
renderPass->setRenderTargetWidth(viewport->getWidth());
|
||||
renderPass->setRenderTargetHeight(viewport->getHeight());
|
||||
renderPass->setDefaultRasterSampleCount(viewport->getSamples());
|
||||
|
||||
for (size_t i = 0; i < layout.colorAttachments.size(); ++i) {
|
||||
const auto &color = layout.colorAttachments[i];
|
||||
MTL::RenderPassColorAttachmentDescriptor *desc =
|
||||
renderPass->colorAttachments()->object(i);
|
||||
desc->setClearColor(MTL::ClearColor(
|
||||
color.clear.color.float32[0], color.clear.color.float32[1],
|
||||
color.clear.color.float32[2], color.clear.color.float32[3]));
|
||||
const auto& color = layout.colorAttachments[i];
|
||||
MTL::RenderPassColorAttachmentDescriptor* desc = renderPass->colorAttachments()->object(i);
|
||||
desc->setClearColor(MTL::ClearColor(color.clear.color.float32[0], color.clear.color.float32[1],
|
||||
color.clear.color.float32[2], color.clear.color.float32[3]));
|
||||
desc->setLoadAction(cast(color.getLoadOp()));
|
||||
desc->setStoreAction(cast(color.getStoreOp()));
|
||||
desc->setLevel(0);
|
||||
desc->setTexture(color.getTexture().cast<TextureBase>()->getTexture());
|
||||
if (!layout.resolveAttachments.empty()) {
|
||||
const auto &resolve = layout.resolveAttachments[i];
|
||||
const auto& resolve = layout.resolveAttachments[i];
|
||||
desc->setResolveLevel(0);
|
||||
desc->setStoreAction(MTL::StoreActionStoreAndMultisampleResolve);
|
||||
desc->setResolveTexture(
|
||||
resolve.getTexture().cast<TextureBase>()->getTexture());
|
||||
desc->setResolveTexture(resolve.getTexture().cast<TextureBase>()->getTexture());
|
||||
}
|
||||
}
|
||||
if (layout.depthAttachment.getTexture() != nullptr) {
|
||||
depth = MTL::RenderPassDepthAttachmentDescriptor::alloc()->init();
|
||||
auto depth = renderPass->depthAttachment();
|
||||
depth->setClearDepth(layout.depthAttachment.clear.depthStencil.depth);
|
||||
depth->setLoadAction(cast(layout.depthAttachment.getLoadOp()));
|
||||
depth->setStoreAction(cast(layout.depthAttachment.getStoreOp()));
|
||||
depth->setTexture(
|
||||
layout.depthAttachment.getTexture().cast<TextureBase>()->getTexture());
|
||||
|
||||
if (layout.depthResolveAttachment.getTexture() != nullptr) {
|
||||
depth->setResolveTexture(layout.depthResolveAttachment.getTexture()
|
||||
.cast<TextureBase>()
|
||||
->getTexture());
|
||||
depth->setResolveTexture(layout.depthResolveAttachment.getTexture().cast<TextureBase>()->getTexture());
|
||||
depth->setStoreAction(MTL::StoreActionStoreAndMultisampleResolve);
|
||||
}
|
||||
renderPass->setDepthAttachment(depth);
|
||||
}
|
||||
// TODO: stencil
|
||||
}
|
||||
RenderPass::~RenderPass() {
|
||||
depth->release();
|
||||
stencil->release();
|
||||
renderPass->release();
|
||||
RenderPass::~RenderPass() {}
|
||||
|
||||
void RenderPass::updateRenderPass() {
|
||||
for (size_t i = 0; i < layout.colorAttachments.size(); ++i) {
|
||||
const auto& color = layout.colorAttachments[i];
|
||||
auto desc = renderPass->colorAttachments()->object(i);
|
||||
desc->setTexture(color.getTexture().cast<TextureBase>()->getTexture());
|
||||
}
|
||||
if (layout.depthAttachment.getTexture() != nullptr) {
|
||||
auto depth = renderPass->depthAttachment();
|
||||
depth->setTexture(layout.depthAttachment.getTexture().cast<TextureBase>()->getTexture());
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "Foundation/NSAutoreleasePool.hpp"
|
||||
#include "Graphics.h"
|
||||
#include "Graphics/Window.h"
|
||||
#include "Resources.h"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Window.h"
|
||||
#include "Command.h"
|
||||
#include "Foundation/NSAutoreleasePool.hpp"
|
||||
#include "Graphics/Initializer.h"
|
||||
#include "Graphics/Metal/Enums.h"
|
||||
#include "Graphics/Texture.h"
|
||||
@@ -80,8 +81,6 @@ Window::Window(PGraphics graphics, const WindowCreateInfo& createInfo) : graphic
|
||||
metalLayer.drawableSize = CGSizeMake(createInfo.width, createInfo.height);
|
||||
metalWindow.contentView.layer = metalLayer;
|
||||
metalWindow.contentView.wantsLayer = YES;
|
||||
drawable = (__bridge CA::MetalDrawable*)[metalLayer nextDrawable];
|
||||
createBackBuffer();
|
||||
}
|
||||
|
||||
Window::~Window() { glfwDestroyWindow(static_cast<GLFWwindow*>(windowHandle)); }
|
||||
@@ -89,9 +88,6 @@ Window::~Window() { glfwDestroyWindow(static_cast<GLFWwindow*>(windowHandle)); }
|
||||
void Window::pollInput() { glfwPollEvents(); }
|
||||
|
||||
void Window::beginFrame() {
|
||||
if (drawable) {
|
||||
drawable->release();
|
||||
}
|
||||
drawable = (__bridge CA::MetalDrawable*)[metalLayer nextDrawable];
|
||||
createBackBuffer();
|
||||
}
|
||||
@@ -146,7 +142,7 @@ void Window::resize(int width, int height) {
|
||||
framebufferWidth = width;
|
||||
framebufferHeight = height;
|
||||
// Deallocate the textures if they have been created
|
||||
drawable = (__bridge CA::MetalDrawable*)[metalLayer nextDrawable];
|
||||
drawable = (__bridge CA::MetalDrawable*)[[metalLayer nextDrawable] autorelease];
|
||||
createBackBuffer();
|
||||
resizeCallback(width, height);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
|
||||
renderGraph.addPass(new DepthPrepass(graphics, scene));
|
||||
renderGraph.addPass(new LightCullingPass(graphics, scene));
|
||||
renderGraph.addPass(new BasePass(graphics, scene));
|
||||
renderGraph.addPass(new DebugPass(graphics, scene));
|
||||
//renderGraph.addPass(new DebugPass(graphics, scene));
|
||||
//renderGraph.addPass(new SkyboxRenderPass(graphics, scene));
|
||||
renderGraph.setViewport(viewport);
|
||||
renderGraph.createRenderPass();
|
||||
|
||||
Reference in New Issue
Block a user