Skip to content

Commit 3c6c4fa

Browse files
committed
Fix warnings
1 parent 0ef947d commit 3c6c4fa

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

include/vsg/utils/LineSegmentIntersector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ namespace vsg
6363

6464
ref_ptr<Intersection> add(const dvec3& coord, double ratio, const IndexRatios& indexRatios, uint32_t instanceIndex);
6565

66+
using Intersector::apply;
67+
6668
void apply(const IntersectionProxy& intersectionproxy) override;
6769

6870
void pushTransform(const Transform& transform) override;

src/vsg/nodes/IntersectionProxy.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ void vsg::IntersectionProxy::rebuild(vsg::ArrayState& arrayState)
176176

177177
using itr_t = decltype(indices)::iterator;
178178

179-
auto computeKDTree = [&](itr_t first, itr_t last, auto&& computeKDTree) -> std::pair<box, NodeRef> {
180-
if (std::distance(first, last) < trisPerLeaf)
179+
auto computeKDTree = [&](itr_t first, itr_t last, auto&& computeKDTreeRecursive) -> std::pair<box, NodeRef> {
180+
if (static_cast<size_t>(std::distance(first, last)) < trisPerLeaf)
181181
{
182182
leaves.emplace_back();
183183
leafMetadata.emplace_back();
@@ -213,7 +213,7 @@ void vsg::IntersectionProxy::rebuild(vsg::ArrayState& arrayState)
213213
size_t axisIndex = range.x > range.y ? (range.x > range.z ? 0 : 2) : (range.y > range.z ? 1 : 2);
214214
itr_t midpoint = first + std::distance(first, last) / 2;
215215
std::nth_element(first, midpoint, last, [&, axisIndex](const size_t& lhs, const size_t& rhs) { return barycenters[lhs][axisIndex] < barycenters[rhs][axisIndex]; });
216-
internalNodes.emplace_back(InternalNode{{computeKDTree(first, midpoint, computeKDTree), computeKDTree(midpoint, last, computeKDTree)}});
216+
internalNodes.emplace_back(InternalNode{{{computeKDTreeRecursive(first, midpoint, computeKDTreeRecursive), computeKDTreeRecursive(midpoint, last, computeKDTreeRecursive)}}});
217217
box overallBound;
218218
for (const auto& [bound, ref] : internalNodes.back().children)
219219
{
@@ -266,10 +266,6 @@ void vsg::IntersectionProxy::intersect(LineSegmentIntersector& lineSegmentInters
266266
value_type length = ::length(d);
267267
value_type inverseLength = length != 0.0 ? 1.0 / length : 0.0;
268268

269-
vec_type dInvX = d.x != 0.0 ? d / d.x : vec_type{0.0, 0.0, 0.0};
270-
vec_type dInvY = d.y != 0.0 ? d / d.y : vec_type{0.0, 0.0, 0.0};
271-
vec_type dInvZ = d.z != 0.0 ? d / d.z : vec_type{0.0, 0.0, 0.0};
272-
273269
auto intersectLeaf = [&](uint32_t index) {
274270
for (size_t i = 0; i < trisPerLeaf; ++i)
275271
{
@@ -304,7 +300,7 @@ void vsg::IntersectionProxy::intersect(LineSegmentIntersector& lineSegmentInters
304300
}
305301
};
306302

307-
auto intersectNode = [&](const NodeRef& nodeRef, auto&& intersectNode) -> void {
303+
auto intersectNode = [&](const NodeRef& nodeRef, auto&& intersectNodeRecursive) -> void {
308304
if (nodeRef.type == NodeRef::LEAF)
309305
{
310306
intersectLeaf(nodeRef.index);
@@ -316,7 +312,7 @@ void vsg::IntersectionProxy::intersect(LineSegmentIntersector& lineSegmentInters
316312
{
317313
if (intersectBox(bound))
318314
{
319-
intersectNode(child, intersectNode);
315+
intersectNodeRecursive(child, intersectNodeRecursive);
320316
}
321317
}
322318
}
@@ -381,7 +377,7 @@ void vsg::IntersectionOptimizeVisitor::apply(StateGroup& stategroup)
381377

382378
for (auto& child : stategroup.children)
383379
{
384-
if (child->className() == "vsg::VertexDraw")
380+
if (::cast<VertexDraw>(child) || ::cast<VertexIndexDraw>(child))
385381
{
386382
auto optimized = vsg::IntersectionProxy::create(child);
387383
optimized->rebuild(*arrayStateStack.back());

0 commit comments

Comments
 (0)