Factor in SOutlineList::FillOutlineTags.

pull/10/head
whitequark 2016-05-24 02:26:52 +00:00
parent 20d87d93c5
commit e2916e3e4a
3 changed files with 7 additions and 10 deletions

View File

@ -481,9 +481,8 @@ void ssglDrawOutlines(SOutlineList *sol, Vector projDir, hStyle hs)
ssglLineWidth((float)lineWidth);
ssglColorRGB(Style::Color(hs));
sol->FillOutlineTags(projDir);
for(SOutline *so = sol->l.First(); so; so = sol->l.NextAfter(so)) {
if(!so->tag) continue;
if(!so->IsVisible(projDir)) continue;
ssglStippledLine(so->a, so->b, lineWidth, stippleType, stippleScale,
/*maybeFat=*/true);
}

View File

@ -1047,6 +1047,10 @@ void SKdNode::MakeOutlinesInto(SOutlineList *sol) const
}
}
bool SOutline::IsVisible(Vector projDir) const {
return (nl.Dot(projDir) > 0.0) != (nr.Dot(projDir) > 0.0);
}
void SOutlineList::Clear() {
l.Clear();
}
@ -1060,12 +1064,6 @@ void SOutlineList::AddEdge(Vector a, Vector b, Vector nl, Vector nr) {
l.Add(&so);
}
void SOutlineList::FillOutlineTags(Vector projDir) {
for(SOutline *so = l.First(); so; so = l.NextAfter(so)) {
so->tag = ((so->nl.Dot(projDir) > 0.0) != (so->nr.Dot(projDir) > 0.0));
}
}
void SOutlineList::MakeFromCopyOf(SOutlineList *sol) {
for(SOutline *so = sol->l.First(); so; so = sol->l.NextAfter(so)) {
l.Add(so);

View File

@ -274,6 +274,8 @@ class SOutline {
public:
int tag;
Vector a, b, nl, nr;
bool IsVisible(Vector projDir) const;
};
class SOutlineList {
@ -284,8 +286,6 @@ public:
void AddEdge(Vector a, Vector b, Vector nl, Vector nr);
void MakeFromCopyOf(SOutlineList *ol);
void FillOutlineTags(Vector projDir);
};
class SKdNode {