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

Method Build

Source/Engine/CSG/CSGMesh.Build.cpp:9–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include "Engine/Core/Log.h"
8
9void CSG::Mesh::Build(Brush* parentBrush)
10{
11 struct EdgeIntersection
12 {
13 int32 EdgeIndex;
14 int32 PlaneIndices[2];
15
16 EdgeIntersection()
17 {
18 EdgeIndex = INVALID_INDEX;
19 }
20
21 EdgeIntersection(int32 edgeIndex, int32 planeIndexA, int32 planeIndexB)
22 {
23 EdgeIndex = edgeIndex;
24 PlaneIndices[0] = planeIndexA;
25 PlaneIndices[1] = planeIndexB;
26 }
27 };
28
29 struct PointIntersection
30 {
31 // TODO: optimize this shit?
32 int32 VertexIndex;
33 Array<EdgeIntersection> Edges;
34 Array<int32> PlaneIndices;
35
36 PointIntersection()
37 {
38 VertexIndex = INVALID_INDEX;
39 }
40
41 PointIntersection(int32 vertexIndex, const Array<int32>& planes)
42 {
43 VertexIndex = vertexIndex;
44 PlaneIndices = planes;
45 }
46 };
47
48 // Clear
49 _bounds.Clear();
50 _surfaces.Clear();
51 _polygons.Clear();
52 _edges.Clear();
53 _vertices.Clear();
54 _brushesMeta.Clear();
55
56 // Get brush planes
57 if (parentBrush == nullptr)
58 return;
59 auto mode = parentBrush->GetBrushMode();
60 parentBrush->GetSurfaces(_surfaces);
61 int32 surfacesCount = _surfaces.Count();
62 if (surfacesCount > 250)
63 {
64 LOG(Error, "CSG brush has too many planes: {0}. Cannot process it!", surfacesCount);
65 return;
66 }

Callers

nothing calls this directly

Calls 15

IntersectionClass · 0.85
PointIntersectionClass · 0.85
EdgeIntersectionClass · 0.85
DotFunction · 0.85
GetBrushModeMethod · 0.80
OnSideMethod · 0.80
NearEqualFunction · 0.50
ClearMethod · 0.45
GetSurfacesMethod · 0.45
CountMethod · 0.45
IsNaNMethod · 0.45
IsInfinityMethod · 0.45

Tested by

no test coverage detected