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