From e2916e3e4a5920968c601be3f24e6ff943414a76 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 24 May 2016 02:26:52 +0000 Subject: [PATCH] Factor in SOutlineList::FillOutlineTags. --- src/glhelper.cpp | 3 +-- src/mesh.cpp | 10 ++++------ src/polygon.h | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/glhelper.cpp b/src/glhelper.cpp index 5234ad08..40179b1f 100644 --- a/src/glhelper.cpp +++ b/src/glhelper.cpp @@ -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); } diff --git a/src/mesh.cpp b/src/mesh.cpp index d04eb1ef..6578205d 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -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); diff --git a/src/polygon.h b/src/polygon.h index 737594ad..849751f8 100644 --- a/src/polygon.h +++ b/src/polygon.h @@ -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 {