aboutsummaryrefslogtreecommitdiff
path: root/source/CpuMesh.hpp
blob: 7c6e2c82bc01be95d11b3f86758c3f4eb35dcdb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "Mesh.hpp"
#include "RcPtr.hpp"

#include <cstddef>
#include <memory>

class CpuMesh : public RefCounted {
private:
	std::unique_ptr<std::byte[]> mVertexData;
	std::unique_ptr<std::byte[]> mIndexData;
    RcPtr<GpuMesh> mGpuMesh;
	RcPtr<VertexFormat> mVertexFormat;
	Tags::IndexType mIndexType;
	int mVertexByteCount;
	int mIndexCount;

public:
	bool IsEmpty() const;
	std::byte* GetVertices() const;
	int GetVertexNumBytes() const;
	std::byte* GetIndices() const;
	int GetIndexNumBytes() const;

	GpuMesh* SyncToGpuCreate() const;
	void SyncToGpu(GpuMesh& mesh) const;
};