sandbox updates

This commit is contained in:
2026-10-07 11:51:14 -07:00
parent 3784d0fdec
commit 09a6c0283a
8 changed files with 296 additions and 6 deletions
+52
View File
@@ -0,0 +1,52 @@
#pragma once
#include <memory>
#include <sophia/math.hpp>
#include <vulkan/vulkan.hpp>
#include "vulkan/device.hpp"
#include "vulkan/pipelines/graphics_pipeline.hpp"
#include "vulkan/shader.hpp"
namespace sophia {
class Material {
public:
struct PushConstants {
vk::DeviceAddress data0;
u64 padding;
vec4 data1;
vec4 data2;
vec4 data3;
};
Material(const Material&) = delete;
Material& operator=(const Material&) = delete;
Material(Device& device, std::unique_ptr<Shader> vertexShader,
std::unique_ptr<Shader> fragmentShader, vk::Format colorFormat,
vk::Format depthFormat);
~Material();
void bind(vk::CommandBuffer commandBuffer) const {
pipeline->bind(commandBuffer);
}
vk::PipelineLayout getLayout() const { return pipelineLayout.get(); }
private:
void createPipelineLayout(Device& device);
vk::UniquePipelineLayout pipelineLayout;
std::unique_ptr<GraphicsPipeline> pipeline;
};
struct MaterialInstance {
Material* material;
};
// !NOTE: eventually add ecs support for ecs
// struct MaterialComponent {
// MaterialInstanceHandle handle;
// };
} // namespace sophia