Reference to temporary fixed and indented.
This commit is contained in:
parent
a9780d57e9
commit
4277711874
|
@ -1,29 +1,32 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.7 2004/09/28 09:46:51 cignoni
|
||||
Added MapFalseColor
|
||||
|
||||
Revision 1.6 2004/09/16 14:08:35 ponchio
|
||||
gamma is a math function.
|
||||
|
||||
|
@ -225,7 +228,10 @@ void ViewDisplay (void)
|
|||
glLoadIdentity ();
|
||||
glPushMatrix();
|
||||
QL.Apply();
|
||||
glutPrintf(5,5,"Diffuse %04.2f Ambient %04.2f LowPass %04.2f HiPass %04.2f Gamma %04.2f ",diff,ambi,lopass,hipass,gamma_correction);
|
||||
glutPrintf(5,5,"Diffuse %04.2f Ambient %04.2f "
|
||||
" LowPass %04.2f HiPass %04.2f Gamma %04.2f ",
|
||||
diff,ambi,lopass,hipass,gamma_correction);
|
||||
|
||||
GLfloat light_position0[] = {0.0, 10.0, 300.0, 0.0};
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
|
||||
glPopMatrix();
|
||||
|
@ -246,6 +252,7 @@ void ViewDisplay (void)
|
|||
else glDisable(GL_COLOR_MATERIAL);
|
||||
if(FalseColorFlag) glColorMaterial(GL_FRONT,GL_DIFFUSE);
|
||||
else glColorMaterial(GL_FRONT,GL_AMBIENT);
|
||||
|
||||
glMateriali(GL_FRONT,GL_SHININESS,0);
|
||||
float spec[4]={0,0,0,1};
|
||||
float ambientV[4]={ambi,ambi,ambi,1};
|
||||
|
@ -270,13 +277,17 @@ void ViewSpecialKey(int , int , int )
|
|||
void Toggle(bool &flag) {flag = !flag;}
|
||||
void UpdateVis()
|
||||
{
|
||||
if( LightFlag && !FalseColorFlag) Vis.MapVisibility(gamma_correction,lopass,hipass,ambi);
|
||||
if(!LightFlag && !FalseColorFlag) Vis.MapVisibility(gamma_correction,lopass,hipass,1.0);
|
||||
if(FalseColorFlag) Vis.MapFalseColor();
|
||||
if( LightFlag && !FalseColorFlag)
|
||||
Vis.MapVisibility(gamma_correction,lopass,hipass,ambi);
|
||||
if(!LightFlag && !FalseColorFlag)
|
||||
Vis.MapVisibility(gamma_correction,lopass,hipass,1.0);
|
||||
if(FalseColorFlag)
|
||||
Vis.MapFalseColor();
|
||||
}
|
||||
/*********************************************************************/
|
||||
/*********************************************************************/
|
||||
/*********************************************************************/
|
||||
|
||||
void ViewKey(unsigned char key, int , int )
|
||||
{
|
||||
Point3f dir;
|
||||
|
@ -284,31 +295,39 @@ void ViewKey(unsigned char key, int , int )
|
|||
case 27: exit(0); break;
|
||||
case 9: if(Q==&QV) Q=&QL;else Q=&QV; break;
|
||||
case 'l' :
|
||||
lopass=lopass+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
UpdateVis();
|
||||
break;
|
||||
lopass=lopass+.05;
|
||||
printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
UpdateVis(); break;
|
||||
case 'L' :
|
||||
lopass=lopass-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
lopass=lopass-.05;
|
||||
printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
UpdateVis(); break;
|
||||
case 'h' :
|
||||
hipass=hipass-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
hipass=hipass-.05;
|
||||
printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
UpdateVis(); break;
|
||||
case 'H' :
|
||||
hipass=hipass+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
hipass=hipass+.05;
|
||||
printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
UpdateVis(); break;
|
||||
case 'd' : diff+=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
|
||||
case 'D' : diff-=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
|
||||
case 'a' : ambi+=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
|
||||
case 'A' : ambi-=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
|
||||
|
||||
case 'e' : ambi+=.05; diff-=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
|
||||
case 'E' : ambi-=.05; diff+=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
|
||||
|
||||
case 'e' : ambi+=.05; diff-=.05;
|
||||
printf("Ambient %f Diffuse %f, \n",ambi,diff);
|
||||
UpdateVis(); break;
|
||||
case 'E' : ambi-=.05; diff+=.05;
|
||||
printf("Ambient %f Diffuse %f, \n",ambi,diff);
|
||||
UpdateVis(); break;
|
||||
case 'p' :
|
||||
gamma_correction=gamma_correction-.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
gamma_correction=gamma_correction-.05;
|
||||
printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
UpdateVis(); break;
|
||||
case 'P' :
|
||||
gamma_correction=gamma_correction+.05; printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
gamma_correction=gamma_correction+.05;
|
||||
printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
|
||||
UpdateVis(); break;
|
||||
case 13 :
|
||||
//Vis.ComputeUniform(SampleNum,ViewVector,cb);
|
||||
|
@ -324,12 +343,24 @@ void ViewKey(unsigned char key, int , int )
|
|||
Vis.ComputeSingle(dir,ViewVector,cb);
|
||||
UpdateVis();
|
||||
} break;
|
||||
case 'r' : BaseColor[0]=min(255,BaseColor[0]+2); printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]); break;
|
||||
case 'R' : BaseColor[0]=max( 0,BaseColor[0]-2); printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]); break;
|
||||
case 'g' : BaseColor[1]=min(255,BaseColor[1]+2); printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]); break;
|
||||
case 'G' : BaseColor[1]=max( 0,BaseColor[1]-2); printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]); break;
|
||||
case 'b' : BaseColor[2]=min(255,BaseColor[2]+2); printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]); break;
|
||||
case 'B' : BaseColor[2]=max( 0,BaseColor[2]-2); printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]); break;
|
||||
case 'r' : BaseColor[0]=min(255,BaseColor[0]+2);
|
||||
printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]);
|
||||
break;
|
||||
case 'R' : BaseColor[0]=max( 0,BaseColor[0]-2);
|
||||
printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]);
|
||||
break;
|
||||
case 'g' : BaseColor[1]=min(255,BaseColor[1]+2);
|
||||
printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]);
|
||||
break;
|
||||
case 'G' : BaseColor[1]=max( 0,BaseColor[1]-2);
|
||||
printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]);
|
||||
break;
|
||||
case 'b' : BaseColor[2]=min(255,BaseColor[2]+2);
|
||||
printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]);
|
||||
break;
|
||||
case 'B' : BaseColor[2]=max( 0,BaseColor[2]-2);
|
||||
printf("BaseColor %3i %3i %3i \n",BaseColor[0],BaseColor[1],BaseColor[2]);
|
||||
break;
|
||||
|
||||
case 'v' : Toggle(ShowDirFlag); break;
|
||||
case 'V' :
|
||||
|
@ -350,9 +381,14 @@ void ViewKey(unsigned char key, int , int )
|
|||
tri::io::ExporterPLY<AMesh>::Save(m,OutNameMsh.c_str(),false,p);
|
||||
}
|
||||
break;
|
||||
case 'C' : LightFlag = !LightFlag; printf("Toggled Light %s\n",LightFlag?"on":"off"); UpdateVis(); break;
|
||||
case 'c' : ColorFlag = !ColorFlag; printf("Toggled Color %s\n",ColorFlag?"on":"off"); break;
|
||||
case 'f' : FalseColorFlag = !FalseColorFlag; printf("Toggled FalseColor %s\n",ColorFlag?"on":"off"); UpdateVis(); break;
|
||||
case 'C' : LightFlag = !LightFlag;
|
||||
printf("Toggled Light %s\n",LightFlag?"on":"off");
|
||||
UpdateVis(); break;
|
||||
case 'c' : ColorFlag = !ColorFlag;
|
||||
printf("Toggled Color %s\n",ColorFlag?"on":"off"); break;
|
||||
case 'f' : FalseColorFlag = !FalseColorFlag;
|
||||
printf("Toggled FalseColor %s\n",ColorFlag?"on":"off");
|
||||
UpdateVis(); break;
|
||||
|
||||
case '1' : diff=0.80f; ambi=0.10f; gamma_correction=1.0; lopass=0.00f; hipass=1.00f; ColorFlag=false; UpdateVis(); break;
|
||||
case '2' : diff=0.65f; ambi=0.30f; gamma_correction=1.0; lopass=0.15f; hipass=0.80f; ColorFlag=true; UpdateVis(); break;
|
||||
|
@ -423,9 +459,9 @@ void ViewInit (void) {
|
|||
glEnable(GL_NORMALIZE);
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
// glEnable(GL_BLEND);
|
||||
// glEnable(GL_BLEND);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
// glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
// glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
@ -460,17 +496,31 @@ int main(int argc, char** argv)
|
|||
{
|
||||
switch(argv[i][1])
|
||||
{
|
||||
case 'd' : if(argv[i][2] == 'a') { ConeAngleRad = math::ToRad(atof(argv[i+1])); ++i; break; }
|
||||
if(argv[i][2] == 'v') { ConeDir = Normalize(Point3f(atof(argv[i+1]),atof(argv[i+2]),atof(argv[i+3]))); i+=3; break; }
|
||||
printf("Error unable to parse option '%s'\n",argv[i]); exit(0);
|
||||
case 'd' :
|
||||
if(argv[i][2] == 'a') {
|
||||
ConeAngleRad = math::ToRad(atof(argv[i+1])); ++i; break;
|
||||
}
|
||||
if(argv[i][2] == 'v') {
|
||||
Point3f p(atof(argv[i+1]),atof(argv[i+2]),atof(argv[i+3]));
|
||||
ConeDir = Normalize(p);
|
||||
i+=3; break;
|
||||
}
|
||||
printf("Error unable to parse option '%s'\n",argv[i]);
|
||||
exit(0);
|
||||
break;
|
||||
case 'n' : SampleNum = atoi(argv[i]+2); break;
|
||||
case 'f' : SwapFlag=false; break;
|
||||
case 'c' : ClosedFlag=true; break;
|
||||
case 'w' : WindowRes= atoi(argv[i]+2); printf("Set WindowRes to %i\n",WindowRes ); break;
|
||||
case 's' : Vis.SplitNum= atoi(argv[i]+2); printf("Set SplitNum to %i\n",Vis.SplitNum ); break;
|
||||
case 'z' : Vis.ZTWIST = atof(argv[i]+2); printf("Set ZTWIST to %f\n",Vis.ZTWIST ); break;
|
||||
default: {printf("Error unable to parse option '%s'\n",argv[i]); exit(0);}
|
||||
case 'w' : WindowRes= atoi(argv[i]+2);
|
||||
printf("Set WindowRes to %i\n",WindowRes ); break;
|
||||
case 's' : Vis.SplitNum= atoi(argv[i]+2);
|
||||
printf("Set SplitNum to %i\n",Vis.SplitNum ); break;
|
||||
case 'z' : Vis.ZTWIST = atof(argv[i]+2);
|
||||
printf("Set ZTWIST to %f\n",Vis.ZTWIST ); break;
|
||||
default: {
|
||||
printf("Error unable to parse option '%s'\n",argv[i]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
++i;
|
||||
|
@ -493,7 +543,10 @@ int main(int argc, char** argv)
|
|||
Vis.Init();
|
||||
UpdateVis();
|
||||
|
||||
printf("Mesh bbox (%f %f %f)-(%f %f %f)\n\n",m.bbox.min[0],m.bbox.min[1],m.bbox.min[2],m.bbox.max[0],m.bbox.max[1],m.bbox.max[2]);
|
||||
printf("Mesh bbox (%f %f %f)-(%f %f %f)\n\n",
|
||||
m.bbox.min[0],m.bbox.min[1],m.bbox.min[2],
|
||||
m.bbox.max[0],m.bbox.max[1],m.bbox.max[2]);
|
||||
|
||||
OutNameMsh=(string(argv[i]).substr(0,strlen(argv[i])-4));
|
||||
OutNameMsh+="_vis.ply";
|
||||
|
||||
|
|
Loading…
Reference in New Issue