From 2624c550bd403be9bcc616552ce0ddcd5da9b6a7 Mon Sep 17 00:00:00 2001 From: cignoni Date: Sat, 12 Nov 2005 06:47:18 +0000 Subject: [PATCH] Added Enhancement, removed type warnings, started to refactor code in order to remove the unnecessary generality of the class. --- apps/shadevis/visshader.h | 70 ++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/apps/shadevis/visshader.h b/apps/shadevis/visshader.h index 14962c5e..f3ff93d9 100644 --- a/apps/shadevis/visshader.h +++ b/apps/shadevis/visshader.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.8 2004/09/28 09:45:17 cignoni +Added MapFalseColor + Revision 1.7 2004/09/16 14:23:57 ponchio fixed gcc template compatibility issues. @@ -153,7 +156,7 @@ template class VisShader void AddPixelCount(std::vector &_VV, const std::vector &PixSeen) { assert(_VV.size()==PixSeen.size()); - for(int i=0;i0) _VV[i]+= 1; } @@ -171,7 +174,9 @@ Funzioni ad alto livello che computano le Visibility Mask per varie distribuzion *******************************/ -// Funzione Generica chiamata da tutte le seguenti +// Funzione Generica +// Calcola l'occlusion in base all'insieme VN di direzioni. + void Compute( CallBack *cb) { //cb(buf.format("Start to compute %i dir\n",VN.size())); @@ -180,7 +185,7 @@ void Compute( CallBack *cb) VV.resize(m.vert.size()); std::vector PixSeen(VV.size(),0); int TotRay=0,HitRay=0; - for(int i=0;i class VertexVisShader : public VisShader } void Init() { VV.resize(m.vert.size()); } -// Vis::VisMode Id() {return Vis::VMPerVert;}; void Compute(int nn); - - void AddPixelCount(std::vector &_VV, std::vector &PixSeen, std::vector &PixNotSeen ) - { - for(int i=0;iP()); - glVertex((*fi).V(1)->P()); - glVertex((*fi).V(2)->P()); + static GLuint dl=0; + if(mm.face.empty()) + { AMesh::VertexIterator vi; + glBegin(GL_POINTS); + for(vi=mm.vert.begin();vi!=mm.vert.end();++vi) + { + if(ColorFlag) glColor((*vi).C()); + glVertex((*vi).P()); + } + glEnd(); + } + else + { + glBegin(GL_TRIANGLES); + FaceIterator fi; + for(fi=mm.face.begin();fi!=mm.face.end();++fi) + { + glVertex((*fi).V(0)->P()); + glVertex((*fi).V(1)->P()); + glVertex((*fi).V(2)->P()); + } + glEnd(); } - glEnd(); } /***************************************************************************/ //VertexVisibility // Funzione Principale restituisce per ogni entita' quanti px si vedono o no. + int GLAccumPixel( std::vector &PixSeen) { SimplePic snapZ; @@ -441,7 +455,7 @@ int GLAccumPixel( std::vector &PixSeen) glGetIntegerv(GL_VIEWPORT,VP); double tx,ty,tz; - for(int i=0;i &PixSeen) return cnt; } -void SmoothVisibility() +void SmoothVisibility(bool Enhance=false) { FaceIterator fi; std::vector VV2; @@ -482,17 +496,21 @@ void SmoothVisibility() ++VC[(*fi).V(i)-&*m.vert.begin()]; } - for(unsigned int i=0;i