Changeset 1997 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/18/07 21:09:55 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r1990 r1997 115 115 116 116 glBegin(GL_TRIANGLES); 117 Vector3 normal = t.GetNormal(); 118 glNormal3f(normal.x, normal.y, normal.z); 117 119 glVertex3f(t.mVertices[0].x, t.mVertices[0].y, t.mVertices[0].z); 118 120 glVertex3f(t.mVertices[1].x, t.mVertices[1].y, t.mVertices[1].z); … … 315 317 glEnable(GL_CULL_FACE); 316 318 glShadeModel(GL_FLAT); 319 glDepthFunc( GL_LESS ); 317 320 glEnable(GL_DEPTH_TEST); 318 321 glEnable(GL_CULL_FACE); 319 322 320 323 InitExtensions(); 321 322 #if 0323 GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 };324 /* mat_specular and mat_shininess are NOT default values */325 GLfloat mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };326 GLfloat mat_specular[] = { 0.3, 0.3, 0.3, 1.0 };327 GLfloat mat_shininess[] = { 1.0 };328 329 GLfloat light_ambient[] = { 0.2, 0.2, 0.2, 1.0 };330 GLfloat light_diffuse[] = { 0.4, 0.4, 0.4, 1.0 };331 GLfloat light_specular[] = { 0.3, 0.3, 0.3, 1.0 };332 333 GLfloat lmodel_ambient[] = { 0.3, 0.3, 0.3, 1.0 };334 335 336 // default Material337 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);338 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);339 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);340 glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);341 342 // a light343 glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);344 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);345 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);346 347 glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient);348 glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse);349 glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular);350 351 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);352 353 glEnable(GL_LIGHTING);354 glEnable(GL_LIGHT0);355 glEnable(GL_LIGHT1);356 357 358 // set position of the light359 GLfloat infinite_light[] = { 1.0, 0.8, 1.0, 0.0 };360 glLightfv (GL_LIGHT0, GL_POSITION, infinite_light);361 362 // set position of the light2363 GLfloat infinite_light2[] = { -0.3, 1.5, 1.0, 0.0 };364 glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2);365 366 glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);367 // glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR);368 glEnable(GL_COLOR_MATERIAL);369 370 glShadeModel( GL_FLAT );371 372 glDepthFunc( GL_LESS );373 glEnable( GL_DEPTH_TEST );374 #endif375 324 376 325 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1983 r1997 149 149 EvalPvsStat(); 150 150 151 v oid InitGL();151 virtual void InitGL(); 152 152 153 153 virtual int GetWidth() const { return 0; } -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1995 r1997 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 18. I 16:30:5220073 # Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 18. I 20:30:31 2007 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 63 63 $(MAKE) -f $(MAKEFILE).Debug uninstall 64 64 65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc 2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc.net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 66 66 C:\Qt\4.1.2\mkspecs\features\qt_config.prf \ 67 67 C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \ -
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
r1995 r1997 18 18 #define MUTATION_USE_CDF 0 19 19 #define USE_SILHOUETTE_MUTATIONS 0 20 21 #define USE_SIL_TERMINATION_MUTATION 1 22 20 23 #define EVALUATE_MUTATION_STATS 1 21 24 … … 257 260 258 261 262 Vector3 263 MutationBasedDistribution::ComputeSilhouetteTerminationMutation(const VssRay &ray, 264 const Vector3 &origin, 265 const AxisAlignedBox3 &box, 266 const Vector3 &U, 267 const Vector3 &V, 268 const Vector2 vr2, 269 const float radius 270 ) 271 { 272 const int packetSize = 16; 273 274 static int hit_triangles[packetSize]; 275 static float dist[packetSize]; 276 static Vector3 dirs[packetSize]; 277 // mutate the 278 float alpha = RandomValue(0.0f, 2.0f*M_PI); 279 280 // direction along which we will mutate the ray 281 Vector3 line = sin(alpha)*U + cos(alpha)*V; 282 283 // cout<<line<<endl; 284 // create 16 rays along the selected dir 285 286 // cast rays to find silhouette ray 287 for (int i=0; i < packetSize; i++) { 288 dirs[i] = Normalize(ray.mTermination + ((radius/(packetSize - i))*line) - origin ); 289 mlrtaStoreRayAS16(&origin.x, 290 &dirs[i].x, 291 i); 292 } 293 294 mlrtaTraverseGroupAS16(&box.Min().x, 295 &box.Max().x, 296 hit_triangles, 297 dist); 298 299 for (int i=0; i < packetSize; i++) { 300 if (hit_triangles[i] == -1 || !box.IsInside(origin + dist[i]*dirs[i])) { 301 // break on first passing ray 302 break; 303 } 304 } 305 306 if (i == packetSize) { 307 // cerr<<"Warning: hit the same box here should never happen!"<<endl; 308 // shift the ray even a bit more 309 // cout<<"W"<<i<<endl; 310 return ray.mTermination + (RandomValue(1.0f, 2.0f)*radius)*line; 311 } 312 313 // cout<<i<<endl; 314 return dirs[i]; 315 } 259 316 260 317 … … 385 442 mutationRadius); 386 443 444 #if USE_SIL_TERMINATION_MUTATION 445 termination += ComputeSilhouetteTerminationMutation(*ray, 446 origin, 447 box, 448 U, V, 449 Vector2(rr[2], rr[3]), 450 3.0f*objectRadius); 451 #else 387 452 termination += ComputeTerminationMutation(*ray, U, V, 388 453 Vector2(rr[2], rr[3]), 389 454 mutationRadius); 390 455 #endif 391 456 Vector3 direction = termination - origin; 392 457 -
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.h
r1991 r1997 79 79 ); 80 80 81 82 Vector3 83 ComputeSilhouetteTerminationMutation(const VssRay &ray, 84 const Vector3 &origin, 85 const AxisAlignedBox3 &box, 86 const Vector3 &U, 87 const Vector3 &V, 88 const Vector2 vr2, 89 const float radius 90 ); 91 81 92 RayEntry &GetEntry(const int index) { 82 93 return mRays[(mBufferStart+index)%mRays.size()]; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r1983 r1997 303 303 304 304 305 305 void 306 QtGlRendererWidget::InitGL() 307 { 308 GlRenderer::InitGL(); 309 310 GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; 311 /* mat_specular and mat_shininess are NOT default values */ 312 GLfloat mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; 313 GLfloat mat_specular[] = { 0.3, 0.3, 0.3, 1.0 }; 314 GLfloat mat_shininess[] = { 1.0 }; 315 316 GLfloat light_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; 317 GLfloat light_diffuse[] = { 0.4, 0.4, 0.4, 1.0 }; 318 GLfloat light_specular[] = { 0.3, 0.3, 0.3, 1.0 }; 319 320 GLfloat lmodel_ambient[] = { 0.3, 0.3, 0.3, 1.0 }; 321 322 323 // default Material 324 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); 325 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); 326 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); 327 glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); 328 329 // a light 330 glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 331 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 332 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 333 334 glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 335 glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); 336 glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); 337 338 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 339 340 glEnable(GL_LIGHTING); 341 glEnable(GL_LIGHT0); 342 glEnable(GL_LIGHT1); 343 344 345 // set position of the light 346 GLfloat infinite_light[] = { 1.0, 0.8, 1.0, 0.0 }; 347 glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); 348 349 // set position of the light2 350 GLfloat infinite_light2[] = { -0.3, 1.5, 1.0, 0.0 }; 351 glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 352 353 glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 354 // glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR); 355 glEnable(GL_COLOR_MATERIAL); 356 357 glShadeModel( GL_FLAT ); 358 } 306 359 307 360 … … 617 670 RenderErrors(); 618 671 } else { 672 glColor3f(0.6f, 0.6f, 0.6f); 619 673 RenderPvs(); 620 674 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r1948 r1997 172 172 InitGL(); 173 173 } 174 175 virtual void InitGL(); 176 174 177 void resizeGL(int w, int h); 175 178 void paintGL(); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r1983 r1997 52 52 if (mRenderer->mRenderViewCells) 53 53 mRenderer->RenderViewCells(); 54 54 55 glColor3f(0.8f, 0.8f, 0.8f); 55 56 mRenderer->RenderPvs(); 56 57
Note: See TracChangeset
for help on using the changeset viewer.