bugfix: When trying to copy Nef polyhderons, we were just copying pointers, defeating the const

translation1
Marius Kintel 2014-01-31 00:59:59 -05:00
parent fbcb807463
commit 1b77d945be
1 changed files with 3 additions and 3 deletions

View File

@ -436,7 +436,7 @@ Response GeometryEvaluator::visit(State &state, const RenderNode &node)
else if (shared_ptr<const CGAL_Nef_polyhedron> N = dynamic_pointer_cast<const CGAL_Nef_polyhedron>(geom)) { else if (shared_ptr<const CGAL_Nef_polyhedron> N = dynamic_pointer_cast<const CGAL_Nef_polyhedron>(geom)) {
// If we got a const object, make a copy // If we got a const object, make a copy
shared_ptr<CGAL_Nef_polyhedron> newN; shared_ptr<CGAL_Nef_polyhedron> newN;
if (res.isConst()) newN.reset(new CGAL_Nef_polyhedron(*N)); if (res.isConst()) newN.reset(N->copy());
else newN = dynamic_pointer_cast<CGAL_Nef_polyhedron>(res.ptr()); else newN = dynamic_pointer_cast<CGAL_Nef_polyhedron>(res.ptr());
newN->setConvexity(node.convexity); newN->setConvexity(node.convexity);
geom = newN; geom = newN;
@ -552,7 +552,7 @@ Response GeometryEvaluator::visit(State &state, const TransformNode &node)
assert(N); assert(N);
// If we got a const object, make a copy // If we got a const object, make a copy
shared_ptr<CGAL_Nef_polyhedron> newN; shared_ptr<CGAL_Nef_polyhedron> newN;
if (res.isConst()) newN.reset(new CGAL_Nef_polyhedron(*N)); if (res.isConst()) newN.reset(N->copy());
else newN = dynamic_pointer_cast<CGAL_Nef_polyhedron>(res.ptr()); else newN = dynamic_pointer_cast<CGAL_Nef_polyhedron>(res.ptr());
newN->transform(node.matrix); newN->transform(node.matrix);
geom = newN; geom = newN;
@ -969,7 +969,7 @@ Response GeometryEvaluator::visit(State &state, const CgaladvNode &node)
if (N) { if (N) {
// If we got a const object, make a copy // If we got a const object, make a copy
shared_ptr<CGAL_Nef_polyhedron> newN; shared_ptr<CGAL_Nef_polyhedron> newN;
if (res.isConst()) newN.reset(new CGAL_Nef_polyhedron(*N)); if (res.isConst()) newN.reset(N->copy());
else newN = dynamic_pointer_cast<CGAL_Nef_polyhedron>(res.ptr()); else newN = dynamic_pointer_cast<CGAL_Nef_polyhedron>(res.ptr());
applyResize3D(*newN, node.newsize, node.autosize); applyResize3D(*newN, node.newsize, node.autosize);
geom = newN; geom = newN;