2023-10-29 09:20:23 +01:00
|
|
|
#pragma once
|
2023-11-15 00:06:00 +01:00
|
|
|
#include "Graphics/Command.h"
|
2024-06-09 12:20:04 +02:00
|
|
|
#include "Graphics/Initializer.h"
|
2023-11-05 10:36:01 +01:00
|
|
|
#include "Math/Vector.h"
|
2023-10-07 19:29:53 +02:00
|
|
|
#include "VertexData.h"
|
2024-05-08 10:51:59 +02:00
|
|
|
#include "entt/entt.hpp"
|
2023-10-07 19:29:53 +02:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
|
|
|
|
|
namespace Seele {
|
|
|
|
|
class StaticMeshVertexData : public VertexData {
|
|
|
|
|
public:
|
2023-10-31 16:16:23 +01:00
|
|
|
StaticMeshVertexData();
|
2023-10-07 19:29:53 +02:00
|
|
|
virtual ~StaticMeshVertexData();
|
2024-06-09 12:20:04 +02:00
|
|
|
static StaticMeshVertexData* getInstance();
|
2024-06-25 08:59:09 +02:00
|
|
|
void loadPositions(uint64 offset, const Array<Vector4>& data);
|
|
|
|
|
void loadTexCoords(uint64 offset, uint64 index, const Array<Vector2>& data);
|
|
|
|
|
void loadNormals(uint64 offset, const Array<Vector4>& data);
|
|
|
|
|
void loadTangents(uint64 offset, const Array<Vector4>& data);
|
|
|
|
|
void loadBiTangents(uint64 offset, const Array<Vector4>& data);
|
|
|
|
|
void loadColors(uint64 offset, const Array<Vector4>& data);
|
2024-06-09 12:20:04 +02:00
|
|
|
virtual void serializeMesh(MeshId id, uint64 numVertices, ArchiveBuffer& buffer) override;
|
2024-08-07 21:19:33 +02:00
|
|
|
virtual uint64 deserializeMesh(MeshId id, ArchiveBuffer& buffer) override;
|
2024-06-09 12:20:04 +02:00
|
|
|
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"; }
|
|
|
|
|
virtual Gfx::PShaderBuffer getPositionBuffer() const override { return positions; }
|
2024-05-08 10:51:59 +02:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
private:
|
|
|
|
|
virtual void resizeBuffers() override;
|
|
|
|
|
virtual void updateBuffers() override;
|
|
|
|
|
|
2023-11-01 23:12:30 +01:00
|
|
|
Gfx::OShaderBuffer positions;
|
2024-05-06 18:36:16 +02:00
|
|
|
Gfx::OShaderBuffer texCoords[MAX_TEXCOORDS];
|
2023-11-01 23:12:30 +01:00
|
|
|
Gfx::OShaderBuffer normals;
|
|
|
|
|
Gfx::OShaderBuffer tangents;
|
|
|
|
|
Gfx::OShaderBuffer biTangents;
|
2024-06-09 12:20:04 +02:00
|
|
|
Gfx::OShaderBuffer colors;
|
|
|
|
|
Gfx::ODescriptorLayout descriptorLayout;
|
|
|
|
|
Gfx::PDescriptorSet descriptorSet;
|
2023-10-07 19:29:53 +02:00
|
|
|
};
|
2024-06-09 12:20:04 +02:00
|
|
|
} // namespace Seele
|