46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
#include <iostream>
|
|
#include <exception>
|
|
#include <thread>
|
|
#include <vulkan/vulkan.h>
|
|
#define GLM_FORCE_RADIANS
|
|
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
|
#define GLM_ENABLE_EXPERIMENTAL
|
|
#include <glm/glm.hpp>
|
|
#include <glm/gtc/matrix_transform.hpp>
|
|
#include <glm/gtc/matrix_inverse.hpp>
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
import Crafter.Graphics;
|
|
import Crafter.Asset;
|
|
using namespace Crafter;
|
|
|
|
typedef VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT, 3, {{{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0}, {VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1}, {VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2}}}> MeshVulkanShader;
|
|
typedef VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT, 0, {}> FragmentShader;
|
|
typedef VulkanPipeline<MeshVulkanShader, FragmentShader> Pipeline;
|
|
|
|
int main() {
|
|
VulkanDevice::CreateDevice();
|
|
MeshVulkanShader::CreateShader();
|
|
FragmentShader::CreateShader();
|
|
Pipeline::CreatePipeline();
|
|
|
|
WindowWaylandVulkan window("Crafter.Graphics", 1280, 720);
|
|
|
|
Asset asset;
|
|
asset.LoadFull("core.cras");
|
|
|
|
Camera camera;
|
|
VulkanElement test = VulkanElementFromPipeline<Pipeline>();
|
|
Mesh<Vertex_xf32_yf32_zf32_wf32>* mesh = Mesh<Vertex_xf32_yf32_zf32_wf32>::FromAsset(asset.entries[0].data.data());
|
|
|
|
MeshShader<Vertex_xf32_yf32_zf32_wf32> meshShader(mesh, &camera);
|
|
meshShader.SetGroupSize(&test);
|
|
meshShader.WriteDescriptors(&test);
|
|
meshShader.transform = glm::mat4(1.0f);
|
|
meshShader.Update();
|
|
|
|
window.vulkanElements.AddComponent(&test);
|
|
window.Start();
|
|
while(true) {
|
|
|
|
}
|
|
}
|