#pragma once #include #include #include #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 vertexShader, std::unique_ptr 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 pipeline; }; struct MaterialInstance { Material* material; }; // !NOTE: eventually add ecs support for ecs // struct MaterialComponent { // MaterialInstanceHandle handle; // }; } // namespace sophia