Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CGoGN
CGoGN
Commits
c2fbbbce
Commit
c2fbbbce
authored
Sep 25, 2014
by
Sylvain Thery
Browse files
Merge branch 'develop' of /home/git/repositories/thery/cgogn into develop
parents
b29a40b3
9a03f38e
Changes
26
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/viewer.cpp
View file @
c2fbbbce
...
...
@@ -78,7 +78,7 @@ void Viewer::initGUI()
void
Viewer
::
cb_initGL
()
{
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
3
)
;
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
)
;
CGoGNout
<<
"GL VERSION = "
<<
glGetString
(
GL_VERSION
)
<<
CGoGNendl
;
Utils
::
GLSLShader
::
areShadersSupported
();
...
...
@@ -102,6 +102,7 @@ void Viewer::cb_initGL()
m_flatShader
->
setAttributePosition
(
m_positionVBO
)
;
m_flatShader
->
setAmbiant
(
colClear
)
;
m_flatShader
->
setDiffuse
(
colDif
)
;
m_flatShader
->
setDiffuseBack
(
Geom
::
Vec4f
(
0
,
0
,
0
,
0
))
;
m_flatShader
->
setExplode
(
faceShrinkage
)
;
m_vectorShader
=
new
Utils
::
ShaderVectorPerVertex
()
;
...
...
CMakeLists.txt
View file @
c2fbbbce
...
...
@@ -144,7 +144,6 @@ IF (WITH_QT)
find_package
(
QGLViewer REQUIRED
)
SET
(
CGoGN_EXT_INCLUDES
${
CGoGN_EXT_INCLUDES
}
${
QT_INCLUDE_DIR
}
${
QGLVIEWER_INCLUDE_DIR
}
)
SET
(
CGoGN_EXT_LIBS
${
QGLVIEWER_LIBRARIES
}
${
QT_LIBRARIES
}
${
CGoGN_EXT_LIBS
}
)
ENDIF
(
WITH_QT
)
IF
(
WITH_GLEWMX
)
...
...
@@ -286,22 +285,35 @@ file( GLOB_RECURSE
${
CGoGN_ROOT_DIR
}
/ThirdParty/include/*.hpp
)
link_directories
(
${
CGoGN_ROOT_DIR
}
/lib/
${
CMAKE_BUILD_TYPE
}
)
IF
(
ONELIB
)
IF
(
WITH_QT
)
add_library
(
cgogn
${
files_topology
}
${
files_container
}
${
files_algo
}
${
files_utils_withQt
}
)
ELSE
()
add_library
(
cgogn
${
files_topology
}
${
files_container
}
${
files_algo
}
${
files_utils
}
)
ENDIF
()
add_dependencies
(
cgogn shader_target
)
add_dependencies
(
cgogn shader_target
)
target_link_libraries
(
cgogn
${
CGoGN_EXT_LIBS
}
)
ELSE
()
add_library
(
container
${
files_container
}
)
add_library
(
topology
${
files_topology
}
)
add_library
(
algo
${
files_algo
}
)
IF
(
WITH_QT
)
add_library
(
utils
${
files_utils_withQt
}
)
ELSE
()
add_library
(
utils
${
files_utils
}
)
ENDIF
()
target_link_libraries
(
utils
${
CGoGN_EXT_LIBS
}
)
add_library
(
container
${
files_container
}
)
target_link_libraries
(
container utils
)
add_library
(
topology
${
files_topology
}
)
target_link_libraries
(
topology container
)
add_library
(
algo
${
files_algo
}
)
target_link_libraries
(
algo utils topology
)
add_custom_target
(
Geometry SOURCES
${
files_geometry
}
)
add_custom_target
(
ThirdParty SOURCES
${
files_thirdParty
}
)
add_dependencies
(
utils shader_target
)
...
...
SCHNApps/CMakeLists.txt
View file @
c2fbbbce
...
...
@@ -33,6 +33,7 @@ SET( QT_USE_QTXML TRUE )
SET
(
QT_USE_QTDESIGNER TRUE
)
SET
(
QT_USE_QTGUI TRUE
)
SET
(
QT_USE_QTPLUGIN TRUE
)
SET
(
QT_USE_QTSVG TRUE
)
INCLUDE
(
${
QT_USE_FILE
}
)
ADD_DEFINITIONS
(
${
QT_DEFINITIONS
}
)
...
...
SCHNApps/Plugins/surface_differentialProperties/forms/dialog_computeNormal.ui
View file @
c2fbbbce
...
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
472
</width>
<height>
2
76
</height>
<height>
2
92
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -75,6 +75,16 @@
</item>
</layout>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"enableVBO"
>
<property
name=
"text"
>
<string>
Create VBO
</string>
</property>
<property
name=
"checked"
>
<bool>
false
</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
...
...
SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp
View file @
c2fbbbce
...
...
@@ -121,6 +121,14 @@ void Surface_DifferentialProperties_Plugin::computeNormalFromDialog()
bool
autoUpdate
=
(
currentItems
[
0
]
->
checkState
()
==
Qt
::
Checked
);
computeNormal
(
mapName
,
positionName
,
normalName
,
autoUpdate
);
// create VBO if asked
if
(
m_computeNormalDialog
->
enableVBO
->
isChecked
())
{
MapHandlerGen
*
mhg
=
getSCHNApps
()
->
getMap
(
mapName
);
if
(
mhg
!=
NULL
)
mhg
->
createVBO
(
normalName
);
}
}
}
...
...
SCHNApps/Plugins/surface_import/include/surface_import.h
View file @
c2fbbbce
...
...
@@ -16,8 +16,7 @@ class Surface_Import_Plugin : public PluginProcessing
public:
Surface_Import_Plugin
()
{
}
{}
~
Surface_Import_Plugin
()
{}
...
...
SCHNApps/Plugins/surface_render/forms/surface_render.ui
View file @
c2fbbbce
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
2
00
</width>
<width>
2
46
</width>
<height>
600
</height>
</rect>
</property>
...
...
@@ -14,12 +14,23 @@
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
<item
row=
"9"
column=
"0"
rowspan=
"2"
colspan=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QCheckBox"
name=
"check_renderEdges"
>
<property
name=
"text"
>
<string>
render edges
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"scolorButton"
>
<property
name=
"text"
>
<string>
Color
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"combo_normalVBO"
>
...
...
@@ -36,27 +47,27 @@
</item>
</widget>
</item>
<item
row=
"
3
"
column=
"0"
colspan=
"2"
>
<
widget
class=
"QCheckBox"
name=
"check_renderVertices
"
>
<property
name=
"
text
"
>
<
string>
render vertices
</string
>
<item
row=
"
20
"
column=
"0"
colspan=
"2"
>
<
spacer
name=
"verticalSpacer
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Vertical
</enum
>
</property>
</widget>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
156
</width>
<height>
161
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"
7
"
column=
"0"
>
<widget
class=
"Q
RadioButton"
name=
"radio_flatShading
"
>
<item
row=
"
1
"
column=
"0"
>
<widget
class=
"Q
Label"
name=
"label_3
"
>
<property
name=
"text"
>
<string>
Flat
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
<string>
Normal :
</string>
</property>
<attribute
name=
"buttonGroup"
>
<string
notr=
"true"
>
group_faceShading
</string>
</attribute>
</widget>
</item>
<item
row=
"
7
"
column=
"1"
>
<item
row=
"
15
"
column=
"1"
>
<widget
class=
"QRadioButton"
name=
"radio_phongShading"
>
<property
name=
"text"
>
<string>
Phong
</string>
...
...
@@ -66,38 +77,42 @@
</attribute>
</widget>
</item>
<item
row=
"
1
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_
3
"
>
<item
row=
"
0
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_
2
"
>
<property
name=
"text"
>
<string>
Normal
:
</string>
<string>
Position
:
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
colspan=
"2"
>
<widget
class=
"Q
CheckBox"
name=
"check_renderFaces
"
>
<property
name=
"
text
"
>
<
string>
render faces
</string
>
<widget
class=
"Q
Slider"
name=
"slider_verticesScaleFactor
"
>
<property
name=
"
value
"
>
<
number>
50
</number
>
</property>
<property
name=
"
checked
"
>
<
bool>
true
</bool
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Horizontal
</enum
>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line"
/>
<item
row=
"16"
column=
"0"
colspan=
"2"
>
<widget
class=
"QCheckBox"
name=
"check_renderBoundary"
>
<property
name=
"text"
>
<string>
render boundary
</string>
</property>
</widget>
</item>
<item
row=
"
9
"
column=
"0"
colspan=
"2"
>
<
spacer
name=
"verticalSpacer
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Vertical
</enum
>
<item
row=
"
15
"
column=
"0"
>
<
widget
class=
"QRadioButton"
name=
"radio_flatShading
"
>
<property
name=
"
text
"
>
<
string>
Flat
</string
>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
156
</width>
<height>
161
</height>
</size>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</spacer>
<attribute
name=
"buttonGroup"
>
<string
notr=
"true"
>
group_faceShading
</string>
</attribute>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"combo_positionVBO"
>
...
...
@@ -114,29 +129,165 @@
</item>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QCheckBox"
name=
"check_renderEdges"
>
<property
name=
"text"
>
<string>
render edges
</string>
</property>
</widget>
<item
row=
"2"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line"
/>
</item>
<item
row=
"4"
column=
"0"
colspan=
"2"
>
<widget
class=
"QSlider"
name=
"slider_verticesScaleFactor"
>
<property
name=
"value"
>
<number>
50
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
<item
row=
"12"
column=
"0"
rowspan=
"2"
colspan=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QCheckBox"
name=
"check_renderFaces"
>
<property
name=
"text"
>
<string>
render faces
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"dcolorButton"
>
<property
name=
"palette"
>
<palette>
<active>
<colorrole
role=
"WindowText"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
255
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Button"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
0
</red>
<green>
255
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Base"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
255
</red>
<green>
255
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Window"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
170
</red>
<green>
0
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole
role=
"WindowText"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
255
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Button"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
0
</red>
<green>
255
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Base"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
255
</red>
<green>
255
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Window"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
170
</red>
<green>
0
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole
role=
"WindowText"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
143
</red>
<green>
146
</green>
<blue>
147
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Button"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
0
</red>
<green>
255
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Base"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
170
</red>
<green>
0
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Window"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
170
</red>
<green>
0
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property
name=
"text"
>
<string>
Color
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"8"
column=
"0"
colspan=
"2"
>
<widget
class=
"QCheckBox"
name=
"check_renderBoundary"
>
<property
name=
"text"
>
<string>
render boundary
</string>
</property>
</widget>
<item
row=
"3"
column=
"0"
rowspan=
"2"
colspan=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_4"
>
<item>
<widget
class=
"QCheckBox"
name=
"check_renderVertices"
>
<property
name=
"text"
>
<string>
render vertices
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"vcolorButton"
>
<property
name=
"text"
>
<string>
Color
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
...
...
SCHNApps/Plugins/surface_render/include/surface_render.h
View file @
c2fbbbce
...
...
@@ -32,7 +32,11 @@ struct MapParameters
renderVertices
(
false
),
renderEdges
(
false
),
renderFaces
(
true
),
faceStyle
(
FLAT
)
faceStyle
(
FLAT
),
diffuseColor
(
0.8
,
0.9
,
0.7
,
0.0
),
simpleColor
(
0.0
,
0.0
,
0.0
,
0.0
),
vertexColor
(
0.0
,
0.0
,
1.0
,
0.0
)
{}
Utils
::
VBO
*
positionVBO
;
...
...
@@ -43,6 +47,10 @@ struct MapParameters
bool
renderFaces
;
bool
renderBoundary
;
FaceShadingStyle
faceStyle
;
Geom
::
Vec4f
diffuseColor
;
Geom
::
Vec4f
simpleColor
;
Geom
::
Vec4f
vertexColor
;
};
class
Surface_Render_Plugin
:
public
PluginInteraction
...
...
SCHNApps/Plugins/surface_render/include/surface_render_dockTab.h
View file @
c2fbbbce
...
...
@@ -3,6 +3,7 @@
#include
"ui_surface_render.h"
#include
"Utils/vbo.h"
#include
<QColorDialog>
namespace
CGoGN
{
...
...
@@ -27,6 +28,11 @@ private:
SCHNApps
*
m_schnapps
;
Surface_Render_Plugin
*
m_plugin
;
bool
b_updatingUI
;
QColorDialog
*
m_colorDial
;
QColor
m_diffuseColor
;
QColor
m_simpleColor
;
QColor
m_vertexColor
;
int
m_currentColorDial
;
private
slots
:
void
positionVBOChanged
(
int
index
);
...
...
@@ -38,6 +44,13 @@ private slots:
void
faceStyleChanged
(
QAbstractButton
*
b
);
void
renderBoundaryChanged
(
bool
b
);
void
diffuseColorClicked
();
void
simpleColorClicked
();
void
vertexColorClicked
();
void
colorSelected
(
const
QColor
&
col
);
private:
void
addPositionVBO
(
QString
name
);
void
removePositionVBO
(
QString
name
);
...
...
SCHNApps/Plugins/surface_render/src/surface_render.cpp
View file @
c2fbbbce
...
...
@@ -74,7 +74,7 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
{
m_pointSprite
->
setSize
(
map
->
getBBdiagSize
()
/
200.0
f
*
p
.
verticesScaleFactor
);
m_pointSprite
->
setAttributePosition
(
p
.
positionVBO
);
m_pointSprite
->
setColor
(
CGoGN
::
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
1.0
f
,
1.0
f
)
);
m_pointSprite
->
setColor
(
p
.
vertexColor
);
map
->
draw
(
m_pointSprite
,
CGoGN
::
Algo
::
Render
::
GL2
::
POINTS
);
}
if
(
p
.
renderEdges
)
...
...
@@ -83,6 +83,7 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
CGoGN
::
Geom
::
Vec4f
c
(
0.1
f
,
0.1
f
,
0.1
f
,
1.0
f
);
m_simpleColorShader
->
setColor
(
c
);
m_simpleColorShader
->
setAttributePosition
(
p
.
positionVBO
);
m_simpleColorShader
->
setColor
(
p
.
simpleColor
);
map
->
draw
(
m_simpleColorShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
LINES
);
}
if
(
p
.
renderFaces
)
...
...
@@ -95,6 +96,7 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
{
case
MapParameters
::
FLAT
:
m_flatShader
->
setAttributePosition
(
p
.
positionVBO
);
m_flatShader
->
setDiffuse
(
p
.
diffuseColor
);
map
->
draw
(
m_flatShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
break
;
case
MapParameters
::
PHONG
:
...
...
@@ -102,6 +104,7 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
{
m_phongShader
->
setAttributePosition
(
p
.
positionVBO
);
m_phongShader
->
setAttributeNormal
(
p
.
normalVBO
);
m_phongShader
->
setDiffuse
(
p
.
diffuseColor
);
map
->
draw
(
m_phongShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
break
;
...
...
SCHNApps/Plugins/surface_render/src/surface_render_dockTab.cpp
View file @
c2fbbbce
...
...
@@ -13,7 +13,9 @@ namespace SCHNApps
Surface_Render_DockTab
::
Surface_Render_DockTab
(
SCHNApps
*
s
,
Surface_Render_Plugin
*
p
)
:
m_schnapps
(
s
),
m_plugin
(
p
),
b_updatingUI
(
false
)
b_updatingUI
(
false
),
m_currentColorDial
(
0
)
{
setupUi
(
this
);
...
...
@@ -25,6 +27,91 @@ Surface_Render_DockTab::Surface_Render_DockTab(SCHNApps* s, Surface_Render_Plugi
connect
(
check_renderFaces
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
renderFacesChanged
(
bool
)));
connect
(
group_faceShading
,
SIGNAL
(
buttonClicked
(
QAbstractButton
*
)),
this
,
SLOT
(
faceStyleChanged
(
QAbstractButton
*
)));
connect
(
check_renderBoundary
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
renderBoundaryChanged
(
bool
)));
m_colorDial
=
new
QColorDialog
(
m_diffuseColor
,
NULL
);
connect
(
dcolorButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
diffuseColorClicked
()));
connect
(
scolorButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
simpleColorClicked
()));
connect
(
vcolorButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
vertexColorClicked
()));
connect
(
m_colorDial
,
SIGNAL
(
colorSelected
(
const
QColor
&
)),
this
,
SLOT
(
colorSelected
(
const
QColor
&
)));
}
void
Surface_Render_DockTab
::
diffuseColorClicked
()
{
m_colorDial
->
show
();
m_colorDial
->
setCurrentColor
(
m_diffuseColor
);
m_currentColorDial
=
1
;
}
void
Surface_Render_DockTab
::
simpleColorClicked
()
{
m_colorDial
->
show
();
m_colorDial
->
setCurrentColor
(
m_simpleColor
);
m_currentColorDial
=
2
;
}
void
Surface_Render_DockTab
::
vertexColorClicked
()
{
m_colorDial
->
show
();
m_colorDial
->
setCurrentColor
(
m_vertexColor
);
m_currentColorDial
=
3
;
}
void
Surface_Render_DockTab
::
colorSelected
(
const
QColor
&
col
)
{
if
(
m_currentColorDial
==
1
)
{