-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathmsInstancesManager.h
86 lines (67 loc) · 2.08 KB
/
msInstancesManager.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once
#include "MeshSync/MeshSync.h"
#include<map>
#include <unordered_map>
#include "msTransformManager.h"
#ifndef msRuntime
msDeclClassPtr(InstanceInfo)
namespace ms {
struct InstancesManagerRecord
{
bool dirtyInstances = false;
bool dirtyMesh = false;
TransformPtr entity = nullptr;
bool updated = false;
std::map<std::string, bool> updatedParents;
std::map<std::string, std::vector<InstanceInfoPtr>> instancesPerParent;
};
/// <summary>
/// Manager for transforms and transform instances.
/// </summary>
class InstancesManager : public TransformManager<InstancesManagerRecord>
{
public:
/// <summary>
/// Returns meshes that have changed since the last export.
/// </summary>
std::vector<TransformPtr> getDirtyMeshes();
/// <summary>
/// Returns instaces that have changed since the last export.
/// </summary>
std::vector<InstanceInfoPtr> getDirtyInstances();
/// <summary>
/// Returns identifiers of records that have been deleted since the last export.
/// </summary>
std::vector<Identifier>& getDeleted();
/// <summary>
/// Clears the dirty flags on the records.
/// </summary>
void clearDirtyFlags();
/// <summary>
/// Adds a record about instancing information.
/// </summary>
void add(InstanceInfoPtr instanceInfo);
/// <summary>
/// Adds or updates a record about the transform.
/// </summary>
void add (TransformPtr entity) override;
/// <summary>
/// Clears the records collection.
/// </summary>
void clear() override;
/// <summary>
/// Touches the record at given path.
/// The record will not be considered stale
/// at the end of exportation.
/// </summary>
void touch(const std::string& path) override;
/// <summary>
/// Erases records that have not
/// been added or touched in the last exportation.
/// </summary>
void eraseStaleEntities() override;
bool erase(const std::string& path);
bool needsToApplyMirrorModifier() override { return false; }
};
} // namespace ms
#endif // msRuntime