From 4f588fd884617d0403c5ce54df0c6adeb8a57011 Mon Sep 17 00:00:00 2001 From: ponchio Date: Thu, 9 Sep 2004 14:35:54 +0000 Subject: [PATCH] Various changes for gcc compatibility --- apps/shadevis/shadevis.cpp | 37 ++++++++++++++++++++----------------- apps/shadevis/visshader.h | 34 +++++++++++++++++++++------------- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/apps/shadevis/shadevis.cpp b/apps/shadevis/shadevis.cpp index f6161b87..b331658e 100644 --- a/apps/shadevis/shadevis.cpp +++ b/apps/shadevis/shadevis.cpp @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.2 2004/07/11 22:13:30 cignoni +Added GPL comments + ****************************************************************************/ #include @@ -67,7 +70,7 @@ int WindowRes=800; bool SwapFlag=false; -float lopass=0,hipass=1,gamma=1; +float lopass=0,hipass=1,Gamma=1; bool LightFlag=true; bool ColorFlag=true; @@ -178,32 +181,32 @@ void ViewKey(unsigned char key, int , int ) switch (key) { case 27: exit(0); break; case 'l' : - lopass=lopass+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma); - Vis.MapVisibility(gamma,lopass,hipass); + lopass=lopass+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,Gamma); + Vis.MapVisibility(Gamma,lopass,hipass); break; case 'L' : - lopass=lopass-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma); - Vis.MapVisibility(gamma,lopass,hipass); + lopass=lopass-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,Gamma); + Vis.MapVisibility(Gamma,lopass,hipass); break; case 'h' : - hipass=hipass-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma); - Vis.MapVisibility(gamma,lopass,hipass); + hipass=hipass-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,Gamma); + Vis.MapVisibility(Gamma,lopass,hipass); break; case 'H' : - hipass=hipass+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma); - Vis.MapVisibility(gamma,lopass,hipass); + hipass=hipass+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,Gamma); + Vis.MapVisibility(Gamma,lopass,hipass); break; case 'g' : - gamma=gamma-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma); - Vis.MapVisibility(gamma,lopass,hipass); + Gamma=Gamma-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,Gamma); + Vis.MapVisibility(Gamma,lopass,hipass); break; case 'G' : - gamma=gamma+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma); - Vis.MapVisibility(gamma,lopass,hipass); + Gamma=Gamma+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,Gamma); + Vis.MapVisibility(Gamma,lopass,hipass); break; case 'c' : Vis.ComputeUniform(SampleNum,cb); - Vis.MapVisibility(gamma,lopass,hipass); + Vis.MapVisibility(Gamma,lopass,hipass); break; case ' ' : { Point3f dir = Q.camera.ViewPoint(); @@ -213,11 +216,11 @@ void ViewKey(unsigned char key, int , int ) printf("ViewPoint %f %f %f\n",dir[0],dir[1],dir[2]); dir.Normalize(); Vis.ComputeSingle(dir,cb); - Vis.MapVisibility(gamma,lopass,hipass); } + Vis.MapVisibility(Gamma,lopass,hipass); } break; case 's' : Vis.SmoothVisibility(); - Vis.MapVisibility(gamma,lopass,hipass); + Vis.MapVisibility(Gamma,lopass,hipass); break; case 'S' : { @@ -388,4 +391,4 @@ int main(int argc, char** argv) glutMainLoop(); return(0); -} \ No newline at end of file +} diff --git a/apps/shadevis/visshader.h b/apps/shadevis/visshader.h index 5c6edb25..1f03ce3f 100644 --- a/apps/shadevis/visshader.h +++ b/apps/shadevis/visshader.h @@ -24,11 +24,17 @@ History $Log: not supported by cvs2svn $ +Revision 1.2 2004/07/11 22:13:30 cignoni +Added GPL comments + ****************************************************************************/ #ifndef __VCG_MESH_VISIBILITY #define __VCG_MESH_VISIBILITY + +#include + #include #include #include "simplepic.h" @@ -41,7 +47,9 @@ void GenNormal(int vn, std::vector > &NN) NN.clear(); while(NN.size() PixSeen(VV.size(),0); + std::vector PixSeen(VV.size(),0); for(int i=0;i nvt; + std::vector nvt; GenNormal(nn*Frac,nvt); ScalarType CosConeAngle=Cos(ConeAngleRad); for(int i=0;i nvt; + std::vector nvt; GenNormal(nn*2,nvt); for(int i=0;i0) VN.push_back(nvt[i]); @@ -292,7 +300,7 @@ void SetupOrthoViewMatrix(Point3x &ViewDir, int subx, int suby,int LocSplit) void ComputeSingleDirection(Point3x BaseDir, std::vector &PixSeen, CallBack *cb=DummyCallBack) { int t0=clock(); - string buf; + std::string buf; int added=SplittedRendering(BaseDir, PixSeen,cb); int t1=clock(); @@ -372,7 +380,7 @@ template class VertexVisShader : public VisShader void DrawFill(MESH_TYPE &mm) { glBegin(GL_TRIANGLES); - MESH_TYPE::FaceIterator fi; + FaceIterator fi; for(fi=mm.face.begin();fi!=mm.face.end();++fi) { glVertex((*fi).V(0)->P()); @@ -467,9 +475,9 @@ return cnt; void SmoothVisibility() { - MESH_TYPE::FaceIterator fi; - vector VV2; - vector VC(VV.size(),1); + FaceIterator fi; + std::vector VV2; + std::vector VC(VV.size(),1); VV2=VV; for(fi=m.face.begin();fi!=m.face.end();++fi) for(int i=0;i<3;++i) @@ -488,7 +496,7 @@ void MapVisibility(float Gamma=1, float LowPass=0, float HighPass=1, bool FalseC float maxv=*max_element(VV.begin(),VV.end()); printf("Visibility Range %f %f\n", minv,maxv); - MESH_TYPE::VertexIterator vi; + VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi){ float gval=(VV[vi-m.vert.begin()]-minv)/(maxv-minv); if(gval