commit
This commit is contained in:
parent
dfe9b1abe9
commit
c82c8c0887
35 changed files with 245 additions and 10 deletions
|
|
@ -29,4 +29,4 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[WindowWaylandWayland](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1WindowWaylandWayland.html)
|
||||||
|
|
@ -45,5 +45,5 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[Window](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1Window.html)
|
||||||
|
|
||||||
|
|
@ -33,4 +33,4 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[UiElement](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1UiElement.html)
|
||||||
|
|
@ -23,4 +23,5 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[WindowWaylandWayland](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1WindowWaylandWayland.html)
|
||||||
|
|
||||||
|
|
@ -24,4 +24,4 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[Camera](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1Mesh.html)
|
||||||
|
|
@ -33,4 +33,5 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[DescriptorSet](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1DescriptorSet.html)
|
||||||
|
[VulkanShader](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1VulkanShader.html)
|
||||||
|
|
@ -26,4 +26,9 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[DescriptorSet](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1DescriptorSet.html)
|
||||||
|
[Mesh](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1Mesh.html)
|
||||||
|
[MeshShader](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1MeshShader.html)
|
||||||
|
[VulkanShader](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1VulkanShader.html)
|
||||||
|
[VulkanPipeline](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1VulkanPipeline.html)
|
||||||
|
[WindowWaylandVulkan](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1WindowWaylandVulkan.html)
|
||||||
|
|
@ -26,4 +26,6 @@ crafter-build -c example -r
|
||||||
|
|
||||||
## Relevant documentation
|
## Relevant documentation
|
||||||
|
|
||||||
|
[VulkanDevice](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1VulkanDevice.html)
|
||||||
|
[WindowWaylandVulkan](https://crafter-graphics.docs.catcrafts.net/classCrafter_1_1WindowWaylandVulkan.html)
|
||||||
|
|
||||||
33
src/base/module/Crafter.Graphics.Base-Window.cppm
Normal file
33
src/base/module/Crafter.Graphics.Base-Window.cppm
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
Crafter®.Graphics
|
||||||
|
Copyright (C) 2025 Catcrafts®
|
||||||
|
Catcrafts.net
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 3.0 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
module;
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
export module Crafter.Graphics:Window;
|
||||||
|
import :UiElement;
|
||||||
|
|
||||||
|
export namespace Crafter::Graphics::Base {
|
||||||
|
class Window {
|
||||||
|
public:
|
||||||
|
std::vector<UiElement> elements;
|
||||||
|
};
|
||||||
|
}
|
||||||
46
src/base/module/Crafter.Graphics.Base-WindowBuffer.cppm
Normal file
46
src/base/module/Crafter.Graphics.Base-WindowBuffer.cppm
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
Crafter®.Graphics
|
||||||
|
Copyright (C) 2025 Catcrafts®
|
||||||
|
Catcrafts.net
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 3.0 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
module;
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
export module Crafter.Graphics:Window;
|
||||||
|
import Crafter.Event;
|
||||||
|
import :UiElement;
|
||||||
|
|
||||||
|
export namespace Crafter::Graphics::Base {
|
||||||
|
struct ScaleData {
|
||||||
|
int32_t x;
|
||||||
|
int32_t y;
|
||||||
|
int32_t width;
|
||||||
|
int32_t height;
|
||||||
|
};
|
||||||
|
|
||||||
|
class WindowBuffer {
|
||||||
|
public:
|
||||||
|
std::uint32_t width;
|
||||||
|
std::uint32_t height;
|
||||||
|
float scale = 1;
|
||||||
|
Window(std::uint32_t width, std::uint32_t height, float scale = 1);
|
||||||
|
ScaleData ScaleElement(const UiElement& element);
|
||||||
|
};
|
||||||
|
}
|
||||||
32
src/base/module/Crafter.Graphics.Base-WindowClose.cppm
Normal file
32
src/base/module/Crafter.Graphics.Base-WindowClose.cppm
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
Crafter®.Graphics
|
||||||
|
Copyright (C) 2025 Catcrafts®
|
||||||
|
Catcrafts.net
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 3.0 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
module;
|
||||||
|
|
||||||
|
export module Crafter.Graphics:Window;
|
||||||
|
import Crafter.Event;
|
||||||
|
|
||||||
|
export namespace Crafter::Graphics::Base {
|
||||||
|
class WindowClose {
|
||||||
|
public:
|
||||||
|
Event<void> onClose;
|
||||||
|
bool open = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
37
src/base/module/Crafter.Graphics.Base-WindowKeyboard.cppm
Normal file
37
src/base/module/Crafter.Graphics.Base-WindowKeyboard.cppm
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
Crafter®.Graphics
|
||||||
|
Copyright (C) 2025 Catcrafts®
|
||||||
|
Catcrafts.net
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 3.0 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
module;
|
||||||
|
|
||||||
|
export module Crafter.Graphics:Window;
|
||||||
|
import Crafter.Event;
|
||||||
|
|
||||||
|
export namespace Crafter::Graphics::Base {
|
||||||
|
class WindowKeyboard {
|
||||||
|
public:
|
||||||
|
bool heldkeys[255] = {};
|
||||||
|
Event<void> onKeyDown[255];
|
||||||
|
Event<void> onKeyHold[255];
|
||||||
|
Event<void> onKeyUp[255];
|
||||||
|
Event<char> onAnyKeyDown;
|
||||||
|
Event<char> onAnyKeyHold;
|
||||||
|
Event<char> onAnyKeyUp;
|
||||||
|
};
|
||||||
|
}
|
||||||
51
src/base/module/Crafter.Graphics.Base-WindowMouse.cppm
Normal file
51
src/base/module/Crafter.Graphics.Base-WindowMouse.cppm
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
Crafter®.Graphics
|
||||||
|
Copyright (C) 2025 Catcrafts®
|
||||||
|
Catcrafts.net
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 3.0 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
module;
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
export module Crafter.Graphics:Window;
|
||||||
|
import Crafter.Event;
|
||||||
|
import :UiElement;
|
||||||
|
import :Types;
|
||||||
|
|
||||||
|
export namespace Crafter::Graphics::Base {
|
||||||
|
class WindowMouse {
|
||||||
|
public:
|
||||||
|
Event<MousePoint> onMouseRightClick;
|
||||||
|
Event<MousePoint> onMouseLeftClick;
|
||||||
|
Event<MousePoint> onMouseRightHold;
|
||||||
|
Event<MousePoint> onMouseLeftHold;
|
||||||
|
Event<MousePoint> onMouseRightRelease;
|
||||||
|
Event<MousePoint> onMouseLeftRelease;
|
||||||
|
Event<MouseMoveEvent> onMouseMove;
|
||||||
|
Event<MouseMoveEvent> onMouseEnter;
|
||||||
|
Event<MouseMoveEvent> onMouseLeave;
|
||||||
|
Event<double> onMouseScroll;
|
||||||
|
MousePoint currentMousePos;
|
||||||
|
MousePoint lastMousePos;
|
||||||
|
MousePoint mouseDelta;
|
||||||
|
bool mouseLeftHeld = false;
|
||||||
|
bool mouseRightHeld = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
22
src/base/module/Crafter.Graphics.Base.cppm
Normal file
22
src/base/module/Crafter.Graphics.Base.cppm
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
Crafter®.Graphics
|
||||||
|
Copyright (C) 2025 Catcrafts®
|
||||||
|
Catcrafts.net
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 3.0 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
export module Crafter.Graphics;
|
||||||
|
export import :Window;
|
||||||
|
|
@ -27,6 +27,9 @@ module;
|
||||||
export module Crafter.Graphics:VulkanDevice;
|
export module Crafter.Graphics:VulkanDevice;
|
||||||
|
|
||||||
export namespace Crafter {
|
export namespace Crafter {
|
||||||
|
/**
|
||||||
|
* @brief Static class for initizializing and holding various vulkan handles.
|
||||||
|
*/
|
||||||
class VulkanDevice {
|
class VulkanDevice {
|
||||||
public:
|
public:
|
||||||
inline static VkInstance instance = VK_NULL_HANDLE;
|
inline static VkInstance instance = VK_NULL_HANDLE;
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,10 @@ namespace Crafter {
|
||||||
* @tparam MeshShader The mesh shader type used in the pipeline.
|
* @tparam MeshShader The mesh shader type used in the pipeline.
|
||||||
* @tparam FragmentShader The fragment shader type used in the pipeline.
|
* @tparam FragmentShader The fragment shader type used in the pipeline.
|
||||||
*
|
*
|
||||||
* @note Before using this pipeline, the CreatePipeline() function must be called,
|
* @note Before using this to render pipeline, the CreatePipeline() function must be called.
|
||||||
* and all shader modules specified by the template parameters must be created.
|
*
|
||||||
|
* @pre VulkanDevice::CreateDevice() must be called before creating or using this class,
|
||||||
|
VulkanShader::CreateShader() must be called before CreatePipeline().
|
||||||
*/
|
*/
|
||||||
export template <typename MeshShader, typename FragmentShader>
|
export template <typename MeshShader, typename FragmentShader>
|
||||||
class VulkanPipeline {
|
class VulkanPipeline {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ module;
|
||||||
#include <vulkan/vulkan_wayland.h>
|
#include <vulkan/vulkan_wayland.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <vulkan/vk_enum_string_helper.h>
|
// #include <vulkan/vk_enum_string_helper.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <print>
|
#include <print>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
@ -55,7 +55,7 @@ const char* const layerNames[] = {
|
||||||
void VulkanDevice::CHECK_VK_RESULT(VkResult result) {
|
void VulkanDevice::CHECK_VK_RESULT(VkResult result) {
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(string_VkResult(result));
|
throw std::runtime_error("vk error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue