-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeshCache.h
32 lines (27 loc) · 997 Bytes
/
MeshCache.h
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
29
30
31
32
#pragma once
#include <map>
#include "BoundingVolume.h"
#include "Mesh.h"
struct MeshCacheObj {
Mesh* mesh;
BoundingVolume* bounding_volume;
int ref_counter = 0;
bool operator==(const MeshCacheObj& obj) {
return mesh->Compare(*obj.mesh);
}
};
class MeshCache {
public:
static bool GetMesh(std::wstring obj_path, std::wstring png_path, Mesh*& out_mesh);
static BoundingVolume* GetBoundingVolume(std::wstring obj_path, std::wstring png_path);
static void SetBoundingVolume(std::wstring obj_path, std::wstring png_path);
static void Release(std::wstring obj_path, std::wstring png_path);
static void Unload(std::wstring obj_path, std::wstring png_path);
static int GetMeshTableSize();
static void SetDevice(ComPtr<ID3D12Device>& device);
static boolean IsReleased(std::wstring obj_path, std::wstring png_path);
static ComPtr<ID3D12Device> GetDevice();
private:
static std::map<std::wstring, MeshCacheObj*> m_mesh_table_;
static ID3D12Device* p_device_;
};