Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Viewer3D improvements #1066

Merged
merged 2 commits into from
Nov 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

## Changes

- *IO*
- Minor improvements of default settings in Viewer3D. (David
Coeurjolly, [#1066](https:/DGtal-team/DGtal/pull/1066))

## Bug Fixes

- *Configuration/General*
Expand Down
10 changes: 0 additions & 10 deletions src/DGtal/io/ModuleSRC.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ SET(DGTALIO_SRC ${DGTALIO_SRC}
endif( WITH_CAIRO )


##########################################
#### viewers
##########################################

if( WITH_VISU3D_QGLVIEWER )
SET(DGTALIO_SRC ${DGTALIO_SRC}
DGtal/io/viewers/Viewer3D )
endif( WITH_VISU3D_QGLVIEWER )


##########################################
#### readers
##########################################
Expand Down
64 changes: 0 additions & 64 deletions src/DGtal/io/viewers/Viewer3D.cpp

This file was deleted.

4 changes: 3 additions & 1 deletion src/DGtal/io/viewers/Viewer3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ namespace DGtal
* Constructor
*/
Viewer3D() :QGLViewer(), Display3D<Space, KSpace>()
{};
{
resize(800,600);
};

/**
*Constructor with a khalimsky space
Expand Down
40 changes: 16 additions & 24 deletions src/DGtal/io/viewers/Viewer3D.ih
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@ DGtal::Viewer3D<Space, KSpace>::draw()
{
GLTextureImage &textureImg = myVectTextureImage.at(j);
glPushName ( textureImg.myTextureName );
glEnable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, textureImg.myTextureName);
Expand Down Expand Up @@ -778,7 +777,6 @@ DGtal::Viewer3D<Space, KSpace>::draw()

glPopMatrix();
glPopMatrix();
drawLight(GL_LIGHT1);
}


Expand All @@ -797,30 +795,32 @@ DGtal::Viewer3D<Space, KSpace>::isValid() const
return true;
}



#if defined( max )
#undef max
#define _HAS_MSVC_MAX_ true
#endif

#if defined( min )
#undef min
#define _HAS_MSVC_MIN_ true
#endif

template< typename Space, typename KSpace>
void
DGtal::Viewer3D<Space, KSpace>::init()
{
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_shininess[] = { 50.0 };
GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);

glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);

Viewer3D<Space, KSpace>::myMeshDefaultLineWidth=10.0;
myNbListe=0;
myViewWire=false;
myGLScaleFactorX=1.0;
myGLScaleFactorY=1.0;
myGLScaleFactorZ=1.0;
myGLLineMinWidth=1.5;

setBackgroundColor ( QColor ( 217, 228, 255 ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the color ok but the dark one is no more present.
We can perhaps put the new one by default (instead white) and let the dark one associated to Key_B ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The white background is still needed for exports and snapshots.
The idea of this PR is to replace the dark background (which is not great when displaying isothetic quads with classical lightning) by a "lighter" one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I see and we could later add a third 'dark' mode if needed.

myIsDoubleFaceRendering=true;
Viewer3D<Space, KSpace>::createNewCubeList ( );
vector<typename Viewer3D<Space, KSpace>::LineD3D> listeLine;
Expand Down Expand Up @@ -867,14 +867,6 @@ DGtal::Viewer3D<Space, KSpace>::init()
setManipulatedFrame ( new ManipulatedFrame() );
}

#if defined( _HAS_MSVC_MAX_ )
#define max(A,B) ((A)>(B)?(A):(B))
#endif

#if defined( _HAS_MSVC_MIN_ )
#define min(A,B) ((A)<(B)?(A):(B))
#endif


template< typename Space, typename KSpace>
void
Expand Down Expand Up @@ -1187,7 +1179,7 @@ DGtal::Viewer3D<Space, KSpace>::keyPressEvent ( QKeyEvent *e )
}
else
{
setBackgroundColor ( QColor ( 51, 51, 51 ) );
setBackgroundColor ( QColor ( 217, 228, 255 ) );
}
updateGL();
}
Expand Down