#pragma once #include "Graphics/Initializer.h" #include "Graphics/Command.h" #include "Math/Vector.h" #include "VertexData.h" #include "entt/entt.hpp" namespace Seele { class StaticMeshVertexData : public VertexData { public: struct StaticMatInstance { PMaterialInstance instance; Array meshletIds; Gfx::OShaderBuffer culledMeshletBuffer; //Gfx::OShaderBuffer indirectDrawBuffer; }; struct StaticMatData { PMaterial material; Array staticInstance; }; StaticMeshVertexData(); virtual ~StaticMeshVertexData(); static StaticMeshVertexData* getInstance(); void loadPositions(MeshId id, const Array& data); void loadTexCoords(MeshId id, uint64 index, const Array& data); void loadNormals(MeshId id, const Array& data); void loadTangents(MeshId id, const Array& data); void loadBiTangents(MeshId id, const Array& data); void loadColors(MeshId id, const Array& data); virtual void serializeMesh(MeshId id, uint64 numVertices, ArchiveBuffer& buffer) override; virtual void deserializeMesh(MeshId id, ArchiveBuffer& buffer) override; virtual void init(Gfx::PGraphics graphics) override; virtual void destroy() override; virtual void bindBuffers(Gfx::PRenderCommand command) override; virtual Gfx::PDescriptorLayout getVertexDataLayout() override; virtual Gfx::PDescriptorSet getVertexDataSet() override; virtual std::string getTypeName() const override { return "StaticMeshVertexData"; } constexpr const Array& getStaticMeshes() const { return staticData; } private: virtual void resizeBuffers() override; virtual void updateBuffers() override; Array staticData; std::mutex mutex; Gfx::OShaderBuffer positions; Array positionData; Gfx::OShaderBuffer texCoords[MAX_TEXCOORDS]; Array texCoordsData[MAX_TEXCOORDS]; Gfx::OShaderBuffer normals; Array normalData; Gfx::OShaderBuffer tangents; Array tangentData; Gfx::OShaderBuffer biTangents; Array biTangentData; Gfx::OShaderBuffer colors; Array colorData; Gfx::ODescriptorLayout descriptorLayout; Gfx::PDescriptorSet descriptorSet; }; }