Files
Nuake-custom/Nuake/src/Rendering/Mesh/Mesh.h
Antoine Pilote dbac1c187f Dynamic gizmos
- Added cylinder collider component
- Dynamic cylinder, capsule, box, sphere gizmos
- Added wireframe for mesh shape
2023-07-15 19:26:37 -04:00

50 lines
1.1 KiB
C++

#pragma once
#include "src/Core/Core.h"
#include "src/Rendering/AABB.h"
#include "src/Resource/Resource.h"
#include <src/Resource/Serializable.h>
namespace Nuake
{
class VertexBuffer;
class VertexArray;
class Material;
struct Vertex;
class Shader;
class Mesh : ISerializable, Resource
{
public:
Mesh();
~Mesh();
void AddSurface(std::vector<Vertex> vertices, std::vector<uint32_t> indices);
std::vector<Vertex>& GetVertices();
std::vector<uint32_t>& GetIndices();
Ref<Material> GetMaterial() inline const;
void SetMaterial(Ref<Material> material);
void Bind() const;
void Draw(Shader* shader, bool bindMaterial = true);
void DebugDraw();
inline AABB GetAABB() const { return m_AABB; }
json Serialize() override;
bool Deserialize(const std::string& str) override;
private:
Ref<Material> m_Material = nullptr;
std::vector<uint32_t> m_Indices;
std::vector<Vertex> m_Vertices;
Scope<VertexBuffer> m_VertexBuffer;
Scope<VertexArray> m_VertexArray;
Scope<VertexBuffer> m_ElementBuffer;
void SetupMesh();
AABB m_AABB;
void CalculateAABB();
};
}