# Ifc: fix generation of wall openings, now no longer 'forgets' wall parts.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1043 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/2/head
parent
47836d23e7
commit
0276a09a87
|
@ -630,15 +630,17 @@ void QuadrifyPart(const aiVector2D& pmin, const aiVector2D& pmax, XYSortedField&
|
||||||
XYSortedField::iterator start = field.begin();
|
XYSortedField::iterator start = field.begin();
|
||||||
for(; start != field.end(); ++start) {
|
for(; start != field.end(); ++start) {
|
||||||
const BoundingBox& bb = bbs[(*start).second];
|
const BoundingBox& bb = bbs[(*start).second];
|
||||||
if (bb.second.x > pmin.x && bb.first.x < pmax.x && bb.second.y > pmin.y && bb.first.y < pmax.y) {
|
if(bb.first.x >= pmax.x) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bb.second.x > pmin.x && bb.second.y > pmin.y && bb.first.y < pmax.y) {
|
||||||
xs = bb.first.x;
|
xs = bb.first.x;
|
||||||
xe = bb.second.x;
|
xe = bb.second.x;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xs = std::max(pmin.x,xs);
|
|
||||||
xe = std::min(pmax.x,xe);
|
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// the rectangle [pmin,pend] is opaque, fill it
|
// the rectangle [pmin,pend] is opaque, fill it
|
||||||
|
@ -649,6 +651,10 @@ void QuadrifyPart(const aiVector2D& pmin, const aiVector2D& pmax, XYSortedField&
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xs = std::max(pmin.x,xs);
|
||||||
|
xe = std::min(pmax.x,xe);
|
||||||
|
|
||||||
|
// see if there's an offset to fill at the top of our quad
|
||||||
if (xs - pmin.x) {
|
if (xs - pmin.x) {
|
||||||
out.push_back(pmin);
|
out.push_back(pmin);
|
||||||
out.push_back(aiVector2D(pmin.x,pmax.y));
|
out.push_back(aiVector2D(pmin.x,pmax.y));
|
||||||
|
@ -656,18 +662,20 @@ void QuadrifyPart(const aiVector2D& pmin, const aiVector2D& pmax, XYSortedField&
|
||||||
out.push_back(aiVector2D(xs,pmin.y));
|
out.push_back(aiVector2D(xs,pmin.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
// search along the y-axis for all openings that overlap xs and our element
|
// search along the y-axis for all openings that overlap xs and our quad
|
||||||
float ylast = pmin.y;
|
float ylast = pmin.y;
|
||||||
found = false;
|
found = false;
|
||||||
for(; start != field.end(); ++start) {
|
for(; start != field.end(); ++start) {
|
||||||
const BoundingBox& bb = bbs[(*start).second];
|
const BoundingBox& bb = bbs[(*start).second];
|
||||||
|
if (bb.first.x > xs || bb.first.y >= pmax.y) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (bb.second.y > ylast && bb.first.y < pmax.y) {
|
if (bb.second.y > ylast) {
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
const float ys = std::max(bb.first.y,pmin.y), ye = std::min(bb.second.y,pmax.y);
|
const float ys = std::max(bb.first.y,pmin.y), ye = std::min(bb.second.y,pmax.y);
|
||||||
if (ys - ylast) {
|
if (ys - ylast) {
|
||||||
// Divide et impera!
|
|
||||||
QuadrifyPart( aiVector2D(xs,ylast), aiVector2D(xe,ys) ,field,bbs,out);
|
QuadrifyPart( aiVector2D(xs,ylast), aiVector2D(xe,ys) ,field,bbs,out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,10 +687,6 @@ void QuadrifyPart(const aiVector2D& pmin, const aiVector2D& pmax, XYSortedField&
|
||||||
wnd.push_back(aiVector2D(xe,ys));*/
|
wnd.push_back(aiVector2D(xe,ys));*/
|
||||||
ylast = ye;
|
ylast = ye;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bb.first.x > xs) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// the rectangle [pmin,pend] is opaque, fill it
|
// the rectangle [pmin,pend] is opaque, fill it
|
||||||
|
@ -693,11 +697,10 @@ void QuadrifyPart(const aiVector2D& pmin, const aiVector2D& pmax, XYSortedField&
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ylast < pmax.y) {
|
if (ylast < pmax.y) {
|
||||||
// Divide et impera!
|
|
||||||
QuadrifyPart( aiVector2D(xs,ylast), aiVector2D(xe,pmax.y) ,field,bbs,out);
|
QuadrifyPart( aiVector2D(xs,ylast), aiVector2D(xe,pmax.y) ,field,bbs,out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Divide et impera! - now for the whole rest
|
// now for the whole rest
|
||||||
if (pmax.x-xe) {
|
if (pmax.x-xe) {
|
||||||
QuadrifyPart(aiVector2D(xe,pmin.y), pmax ,field,bbs,out);
|
QuadrifyPart(aiVector2D(xe,pmin.y), pmax ,field,bbs,out);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue