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

Method intersect

Source/Engine/CSG/CSGMesh.cpp:139–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void CSG::Mesh::intersect(const Mesh* other, PolygonOperation insideOp, PolygonOperation outsideOp)
140{
141 // insideOp - operation for polygons being inside the other brush
142 // outsideOp - operation for polygons being outside the other brush
143
144 // Prevent from redundant action
145 if (insideOp == Keep && outsideOp == Keep)
146 return;
147
148 // Check every sub brush from other mesh
149 int32 count = other->_brushesMeta.Count();
150 for (int32 subMeshIndex = 0; subMeshIndex < count; subMeshIndex++)
151 {
152 auto& brushMeta = other->_brushesMeta[subMeshIndex];
153
154 // Check if can intersect with that sub mesh data
155 if (!AABB::IsOutside(brushMeta.Bounds, _bounds))
156 {
157 PolygonOperation iOp = insideOp;
158 PolygonOperation oOp = outsideOp;
159
160 if (brushMeta.Mode == Mode::Subtractive)
161 {
162 iOp = Remove;
163 oOp = Keep;
164 }
165
166 intersectSubMesh(other, subMeshIndex, iOp, oOp);
167 }
168 }
169
170 // Update bounds
171 updateBounds();
172}
173
174void CSG::Mesh::intersectSubMesh(const Mesh* other, int32 subMeshIndex, PolygonOperation insideOp, PolygonOperation outsideOp)
175{

Callers 1

PerformOperationMethod · 0.80

Calls 2

IsOutsideFunction · 0.85
CountMethod · 0.45

Tested by

no test coverage detected