sandbox updates
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user