Prepped for NixOS with clang.
This commit is contained in:
parent
14f4ac39be
commit
596f0c601f
|
|
@ -2,3 +2,4 @@
|
||||||
.cache/
|
.cache/
|
||||||
build/
|
build/
|
||||||
.vs/
|
.vs/
|
||||||
|
.direnv/
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,22 @@
|
||||||
"rhs": "Linux"
|
"rhs": "Linux"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "nixos",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "${sourceDir}/build",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
|
||||||
|
"CMAKE_MAKE_PROGRAM": "ninja",
|
||||||
|
"CMAKE_C_COMPILER": "$env{CC}",
|
||||||
|
"CMAKE_CXX_COMPILER": "$env{CXX}"
|
||||||
|
},
|
||||||
|
"condition": {
|
||||||
|
"type": "equals",
|
||||||
|
"lhs": "${hostSystemName}",
|
||||||
|
"rhs": "Linux"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "windows-debug",
|
"name": "windows-debug",
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
|
|
|
||||||
8
run.sh
8
run.sh
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ -d "out" ]; then
|
if [ -d "build" ]; then
|
||||||
pushd ./build/ > /dev/null || exit
|
pushd ./build/samples/04_scenes/ > /dev/null || exit
|
||||||
if echo "$@" | grep -e "debug" -q
|
if echo "$@" | grep -e "debug" -q
|
||||||
then
|
then
|
||||||
lldb aster-exe
|
lldb ./scene_render
|
||||||
else
|
else
|
||||||
./aster-exe
|
./scene_render
|
||||||
fi
|
fi
|
||||||
popd > /dev/null || exit
|
popd > /dev/null || exit
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ Init(const Context *context, const Device *device, const Window *window, vk::For
|
||||||
CreateContext();
|
CreateContext();
|
||||||
ImGuiIO &io = GetIO();
|
ImGuiIO &io = GetIO();
|
||||||
(void)io;
|
(void)io;
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
// io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
// io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Viewports bad
|
// io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Viewports bad
|
||||||
|
|
||||||
StyleColorsDark();
|
StyleColorsDark();
|
||||||
|
|
@ -108,16 +108,16 @@ StartBuild()
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
NewFrame();
|
NewFrame();
|
||||||
|
|
||||||
static ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_PassthruCentralNode;
|
// static ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_PassthruCentralNode;
|
||||||
|
|
||||||
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
|
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
|
||||||
// because it would be confusing to have two docking targets within each others.
|
// because it would be confusing to have two docking targets within each others.
|
||||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDocking;
|
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_None; // ImGuiWindowFlags_NoDocking;
|
||||||
|
|
||||||
const ImGuiViewport *viewport = GetMainViewport();
|
const ImGuiViewport *viewport = GetMainViewport();
|
||||||
SetNextWindowPos(viewport->WorkPos);
|
SetNextWindowPos(viewport->WorkPos);
|
||||||
SetNextWindowSize(viewport->WorkSize);
|
SetNextWindowSize(viewport->WorkSize);
|
||||||
SetNextWindowViewport(viewport->ID);
|
// SetNextWindowViewport(viewport->ID);
|
||||||
PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||||
PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||||
windowFlags |=
|
windowFlags |=
|
||||||
|
|
@ -130,18 +130,18 @@ StartBuild()
|
||||||
// all active windows docked into it will lose their parent and become undocked.
|
// all active windows docked into it will lose their parent and become undocked.
|
||||||
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
|
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
|
||||||
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
|
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
|
||||||
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
// PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
Begin("DockSpace Demo", nullptr, windowFlags);
|
// Begin("DockSpace Demo", nullptr, windowFlags);
|
||||||
PopStyleVar();
|
// PopStyleVar();
|
||||||
|
|
||||||
PopStyleVar(2);
|
// PopStyleVar(2);
|
||||||
|
|
||||||
// DockSpace
|
// DockSpace
|
||||||
if (GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
// if (GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||||
{
|
// {
|
||||||
const ImGuiID dockspaceId = GetID("MyDockSpace");
|
// const ImGuiID dockspaceId = GetID("MyDockSpace");
|
||||||
DockSpace(dockspaceId, ImVec2(0.0f, 0.0f), dockspaceFlags);
|
// DockSpace(dockspaceId, ImVec2(0.0f, 0.0f), dockspaceFlags);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -151,13 +151,13 @@ EndBuild()
|
||||||
Render();
|
Render();
|
||||||
|
|
||||||
EndFrame();
|
EndFrame();
|
||||||
if (GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
// if (GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||||
{
|
// {
|
||||||
GLFWwindow *backupCurrentContext = glfwGetCurrentContext();
|
// GLFWwindow *backupCurrentContext = glfwGetCurrentContext();
|
||||||
UpdatePlatformWindows();
|
// UpdatePlatformWindows();
|
||||||
RenderPlatformWindowsDefault();
|
// RenderPlatformWindowsDefault();
|
||||||
glfwMakeContextCurrent(backupCurrentContext);
|
// glfwMakeContextCurrent(backupCurrentContext);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -753,8 +753,8 @@ AssetLoader::ProcessNode(tinygltf::Model *model, eastl::vector<vec4> *vertexPosi
|
||||||
entities->push_back(entity);
|
entities->push_back(entity);
|
||||||
|
|
||||||
m_Registry->emplace<CMesh>(entity, CMesh{
|
m_Registry->emplace<CMesh>(entity, CMesh{
|
||||||
.m_VertexPositionPtr = vertexOffset * sizeof vec4,
|
.m_VertexPositionPtr = vertexOffset * sizeof(vec4),
|
||||||
.m_VertexDataPtr = vertexOffset * sizeof VertexData,
|
.m_VertexDataPtr = vertexOffset * sizeof(VertexData),
|
||||||
.m_FirstIndex = indexOffset,
|
.m_FirstIndex = indexOffset,
|
||||||
.m_IndexCount = indexCount,
|
.m_IndexCount = indexCount,
|
||||||
});
|
});
|
||||||
|
|
@ -764,7 +764,7 @@ AssetLoader::ProcessNode(tinygltf::Model *model, eastl::vector<vec4> *vertexPosi
|
||||||
m_Registry->emplace<CParent<CDynamicTransform>>(entity, nodeRoot);
|
m_Registry->emplace<CParent<CDynamicTransform>>(entity, nodeRoot);
|
||||||
if (prim.material >= 0)
|
if (prim.material >= 0)
|
||||||
{
|
{
|
||||||
m_Registry->emplace<CMaterial>(entity, sizeof Material * loadMaterial(prim.material));
|
m_Registry->emplace<CMaterial>(entity, sizeof(Material) * loadMaterial(prim.material));
|
||||||
m_Registry->emplace<CRequiresPostLoadProcess<CMaterial>>(entity);
|
m_Registry->emplace<CRequiresPostLoadProcess<CMaterial>>(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
let eabase = pkgs.callPackage ../eabase-nix/eabase.nix {}; in
|
||||||
|
let eastl = pkgs.callPackage ../eastl-nix/eastl.nix { inherit eabase; }; in
|
||||||
|
let tinygltf = pkgs.callPackage ../tinygltf-nix/tinygltf.nix {}; in
|
||||||
|
let debugbreak = pkgs.callPackage ../scottt-debugbreak-nix/debugbreak.nix {}; in
|
||||||
|
|
||||||
|
pkgs.clangStdenv.mkDerivation {
|
||||||
|
name = "aster-env";
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
ninja
|
||||||
|
(imgui.override {IMGUI_BUILD_VULKAN_BINDING = true; IMGUI_BUILD_GLFW_BINDING=true; })
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
glm
|
||||||
|
glfw3
|
||||||
|
eastl
|
||||||
|
fmt
|
||||||
|
eabase
|
||||||
|
eastl
|
||||||
|
entt
|
||||||
|
tinygltf
|
||||||
|
debugbreak
|
||||||
|
stb
|
||||||
|
|
||||||
|
# vulkan
|
||||||
|
vulkan-headers
|
||||||
|
vulkan-loader
|
||||||
|
vulkan-validation-layers
|
||||||
|
vulkan-memory-allocator
|
||||||
|
directx-shader-compiler
|
||||||
|
glslang
|
||||||
|
shaderc
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue