MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Add

Method Add

Source/Engine/CSG/CSGMesh.cpp:80–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void CSG::Mesh::Add(const Mesh* other)
81{
82 ASSERT(this != other && other);
83
84 // Cache data
85 int32 baseIndexVertices = _vertices.Count();
86 int32 baseIndexSurfaces = _surfaces.Count();
87 int32 baseIndexEdges = _edges.Count();
88 int32 baseIndexPolygons = _polygons.Count();
89 auto oVertices = other->GetVertices();
90 auto oSurfaces = other->GetSurfaces();
91 auto oEdges = other->GetEdges();
92 auto oPolygons = other->GetPolygons();
93 auto oMeta = &other->_brushesMeta;
94
95 // Clone vertices
96 for (int32 i = 0; i < oVertices->Count(); i++)
97 {
98 _vertices.Add(oVertices->At(i));
99 }
100
101 // Clone surfaces
102 for (int32 i = 0; i < oSurfaces->Count(); i++)
103 {
104 _surfaces.Add(oSurfaces->At(i));
105 }
106
107 // Clone edges
108 for (int32 i = 0; i < oEdges->Count(); i++)
109 {
110 HalfEdge edge = oEdges->At(i);
111 edge.PolygonIndex += baseIndexPolygons;
112 edge.TwinIndex += baseIndexEdges;
113 edge.NextIndex += baseIndexEdges;
114 edge.VertexIndex += baseIndexVertices;
115 _edges.Add(edge);
116 }
117
118 // Clone polygons
119 for (int32 i = 0; i < oPolygons->Count(); i++)
120 {
121 Polygon polygon = oPolygons->At(i);
122 polygon.SurfaceIndex += baseIndexSurfaces;
123 polygon.FirstEdgeIndex += baseIndexEdges;
124 _polygons.Add(polygon);
125 }
126
127 // Clone meta
128 for (int32 i = 0; i < oMeta->Count(); i++)
129 {
130 BrushMeta meta = oMeta->At(i);
131 meta.StartSurfaceIndex += baseIndexSurfaces;
132 _brushesMeta.Add(meta);
133 }
134
135 // Increase bounds
136 _bounds.Add(other->GetBounds());
137}

Callers 15

InitMethod · 0.45
InitMethod · 0.45
GetMaterialsMethod · 0.45
AddToClusterMethod · 0.45
DrawInstanceMethod · 0.45
DrawTypeMethod · 0.45
AddInstanceMethod · 0.45
DrawMethod · 0.45
WriteNetworkIdMethod · 0.45
ReadNetworkIdMethod · 0.45

Calls 6

GetEdgesMethod · 0.80
GetPolygonsMethod · 0.80
CountMethod · 0.45
GetVerticesMethod · 0.45
GetSurfacesMethod · 0.45
GetBoundsMethod · 0.45

Tested by 3

InitMethod · 0.36
OnMallocMethod · 0.36