mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 14:43:34 +00:00
initial commit
This commit is contained in:
44
ScopEngine/Runtime/Includes/Graphics/Model.h
git.filemode.normal_file
44
ScopEngine/Runtime/Includes/Graphics/Model.h
git.filemode.normal_file
@@ -0,0 +1,44 @@
|
||||
#ifndef __SCOPE_RENDERER_MODEL__
|
||||
#define __SCOPE_RENDERER_MODEL__
|
||||
|
||||
#include <memory>
|
||||
#include <filesystem>
|
||||
|
||||
#include <kvf.h>
|
||||
|
||||
#include <Maths/Vec3.h>
|
||||
#include <Graphics/Mesh.h>
|
||||
#include <Graphics/Material.h>
|
||||
|
||||
namespace Scop
|
||||
{
|
||||
// Only static meshes for now
|
||||
class Model
|
||||
{
|
||||
friend Model LoadModelFromObjFile(std::filesystem::path path) noexcept;
|
||||
|
||||
public:
|
||||
Model() = default;
|
||||
Model(std::shared_ptr<Mesh> mesh);
|
||||
|
||||
inline void SetMaterial(std::shared_ptr<Material> material, std::size_t mesh_index) { m_materials[mesh_index] = material; }
|
||||
inline std::size_t GetSubMeshCount() const { return p_mesh->GetSubMeshCount(); }
|
||||
|
||||
[[nodiscard]] inline std::shared_ptr<Material> GetMaterial(std::size_t mesh_index) { return m_materials[mesh_index]; }
|
||||
[[nodiscard]] inline std::vector<std::shared_ptr<Material>>& GetAllMaterials() { return m_materials; }
|
||||
[[nodiscard]] inline Vec3f GetCenter() const noexcept { return m_center; }
|
||||
|
||||
void Draw(VkCommandBuffer cmd, const DescriptorSet& matrices_set, const class GraphicPipeline& pipeline, DescriptorSet& set, std::size_t& drawcalls, std::size_t& polygondrawn, std::size_t frame_index) const;
|
||||
|
||||
~Model() = default;
|
||||
|
||||
private:
|
||||
Vec3f m_center = { 0.0f, 0.0f, 0.0f };
|
||||
std::vector<std::shared_ptr<Material>> m_materials;
|
||||
std::shared_ptr<Mesh> p_mesh;
|
||||
};
|
||||
|
||||
Model LoadModelFromObjFile(std::filesystem::path path) noexcept;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user