From 794f2f27a7025d6f8b813d4d8d4caa2dd45fefdb Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 28 Jan 2013 15:15:14 +0000 Subject: [PATCH] Small Change of the Trackball apply interface. It does no more require a bool to specify if the trackball icon has to be drawn because it is always wrong to draw the trackball at the apply time (two reasons, antialiasing and transparency and zbuffer preservation) So now the standard call is just Apply() without the useless bool parameters. Updated also all the vcg samples using the trackball --- apps/sample/trimesh_ant_freeglut/main.cpp | 14 +++++++------- apps/sample/trimesh_ant_qt/glwidget.cpp | 2 +- apps/unsupported/shadevis/shadevis.cpp | 2 +- apps/unsupported/trackball_SDL/trackball_sdl.cpp | 2 +- apps/unsupported/trimesh_SDL/trimesh_sdl.cpp | 2 +- wrap/gui/activecoordinateframe.cpp | 2 +- wrap/gui/trackball.cpp | 8 -------- wrap/gui/trackball.h | 12 +++++------- 8 files changed, 17 insertions(+), 27 deletions(-) diff --git a/apps/sample/trimesh_ant_freeglut/main.cpp b/apps/sample/trimesh_ant_freeglut/main.cpp index 7a661c1a..278ab359 100644 --- a/apps/sample/trimesh_ant_freeglut/main.cpp +++ b/apps/sample/trimesh_ant_freeglut/main.cpp @@ -21,12 +21,12 @@ * * ****************************************************************************/ -/** - * Minimal trimesh viewer made with AntTweakBar and freglut - * - * This sample shows how to use togheter: - * - the trimesh loading and initialization - * - basic usage of the default manipulators (the "Trackball") +/** + * Minimal trimesh viewer made with AntTweakBar and freglut + * + * This sample shows how to use togheter: + * - the trimesh loading and initialization + * - basic usage of the default manipulators (the "Trackball") */ @@ -120,7 +120,7 @@ void Display(){ track.center=vcg::Point3f(0, 0, 0); track.radius= 1; track.GetView(); - track.Apply(false); + track.Apply(); glPushMatrix(); float d=1.0f/mesh.bbox.Diag(); vcg::glScale(d); diff --git a/apps/sample/trimesh_ant_qt/glwidget.cpp b/apps/sample/trimesh_ant_qt/glwidget.cpp index 98f6c782..53583290 100644 --- a/apps/sample/trimesh_ant_qt/glwidget.cpp +++ b/apps/sample/trimesh_ant_qt/glwidget.cpp @@ -128,7 +128,7 @@ void GLWidget::paintGL () track.radius= 1; track.GetView(); glPushMatrix(); - track.Apply(false); + track.Apply(); glPushMatrix(); if(mesh.vert.size()>0) { diff --git a/apps/unsupported/shadevis/shadevis.cpp b/apps/unsupported/shadevis/shadevis.cpp index 7b9488ad..bcbc7ae6 100644 --- a/apps/unsupported/shadevis/shadevis.cpp +++ b/apps/unsupported/shadevis/shadevis.cpp @@ -271,7 +271,7 @@ void ViewDisplay (void) if(Q==&QL) DrawLightVector(); QL.GetView(); QV.GetView(); - QV.Apply(false); + QV.Apply(); if(ShowDirFlag) DrawViewVector(); float d = 2.0/m.bbox.Diag(); diff --git a/apps/unsupported/trackball_SDL/trackball_sdl.cpp b/apps/unsupported/trackball_SDL/trackball_sdl.cpp index 0043f408..967644ed 100644 --- a/apps/unsupported/trackball_SDL/trackball_sdl.cpp +++ b/apps/unsupported/trackball_SDL/trackball_sdl.cpp @@ -203,7 +203,7 @@ void display(){ glTranslate( -observerPos ); track.GetView(); - track.Apply(false); + track.Apply(); glPushMatrix(); float d=mesh.bbox.Diag(); glScale(1.5f/d); diff --git a/apps/unsupported/trimesh_SDL/trimesh_sdl.cpp b/apps/unsupported/trimesh_SDL/trimesh_sdl.cpp index 11aa4d40..2a03c09e 100644 --- a/apps/unsupported/trimesh_SDL/trimesh_sdl.cpp +++ b/apps/unsupported/trimesh_SDL/trimesh_sdl.cpp @@ -150,7 +150,7 @@ void display(){ track.radius= 1; track.GetView(); - track.Apply(false); + track.Apply(); glPushMatrix(); float d=1.0f/mesh.bbox.Diag(); glScale(d); diff --git a/wrap/gui/activecoordinateframe.cpp b/wrap/gui/activecoordinateframe.cpp index 0fb71abe..9891d18e 100644 --- a/wrap/gui/activecoordinateframe.cpp +++ b/wrap/gui/activecoordinateframe.cpp @@ -67,7 +67,7 @@ void ActiveCoordinateFrame::Render(QGLWidget* glw) manipulator->radius=size; manipulator->center=position; manipulator->GetView(); - manipulator->Apply(false); + manipulator->Apply(); MovableCoordinateFrame::Render(glw); diff --git a/wrap/gui/trackball.cpp b/wrap/gui/trackball.cpp index 9f561195..c445a814 100644 --- a/wrap/gui/trackball.cpp +++ b/wrap/gui/trackball.cpp @@ -112,14 +112,6 @@ void Trackball::Apply () { glTranslate (-center); } -void Trackball::Apply(bool ToDraw) { - Apply(); - if(ToDraw){ - DrawPostApply(); - } -} - - void Trackball::ApplyInverse() { glTranslate(center); glMultMatrix(track.InverseMatrix()); diff --git a/wrap/gui/trackball.h b/wrap/gui/trackball.h index 27901f9a..fc70a36a 100644 --- a/wrap/gui/trackball.h +++ b/wrap/gui/trackball.h @@ -248,18 +248,15 @@ public: @brief Initialize the camera instance. */ void GetView(); - /*! - @brief Apply the current transformation on the OpenGL modelview matrix. - @param Draw true if has to call DrawPostApply() after the application. - */ - void Apply(bool Draw); /*! - @brief Old application of the transformation. + @brief Application of the transformation. + + @warning This function does \b not draw anything. You have to call DrawPostApply() after drawing everything. - @warning This function does \b not call DrawPostApply() after the application. */ void Apply (); + /*! @brief Draw the current manipulator. @@ -269,6 +266,7 @@ public: @warning This function assumes that the OpenGL modelview matrix has been initialized with Apply (). */ void DrawPostApply(); + /*! @brief Apply the \b inverse of current transformation on the OpenGL modelview matrix. */