forked from CodeSmile-0000011110110111/GMesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGMesh data structure UML.txt
79 lines (69 loc) · 1.3 KB
/
GMesh data structure UML.txt
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
GMesh (inspired by Blender BMesh and UnityBMesh)
https://wiki.blender.org/wiki/Source/Modeling/BMesh/Design
Thought: each struct with class wrapper?
class Vertex
{
struct VertexData
{
int index;
float3 pos;
int edgeIndex; // an index to the referenced struct for native enumeration
}
GMesh mesh; // backref?
VertexData vertexData; // the data struct
Edge edge; // a class reference
}
Uses PlantUML (Rider plugin) to render UML graph:
@startuml
class GMesh
{
List: verts, edges, loops, faces;
Add/RemoveVertex()
Add/RemoveEdge()
Add/RemoveFace()
FindEdge(v1, v2)
}
struct Vertex
{
int index
float3 pos, normal
Edge e (index of e?)
}
struct Edge
{
int index
Vertex v0, v1
Edge prev0, prev1
Edge next0, next1
Loop l (index of l?)
}
struct Loop
{
(int index)
Vertex firstEdgeVertex
float2 uv0, uv1
Edge e
Face f
Loop radialPrev, radialNext //around edge
Loop prev, next //around face
}
struct Face
{
int index
Loop startLoop
int vertexCount //eq: loop, edge
float3 faceNormal
int materialIndex
}
Vertex }-- Edge
Edge }--{ Edge
Edge *--* Loop
Loop }--{ Loop
Loop }--{ Loop
Loop x--> Vertex
Loop *--* Face
@enduml
GMesh --> Vertex
GMesh --> Edge
GMesh --> Loop
GMesh --> Face