Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hurstel
CGoGN
Commits
ac0562e7
Commit
ac0562e7
authored
Aug 01, 2011
by
untereiner
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~cgogn/CGoGN
parents
79d29457
d1df0aeb
Changes
97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
97 changed files
with
8625 additions
and
565 deletions
+8625
-565
Apps/Examples/Debug/CMakeLists.txt
Apps/Examples/Debug/CMakeLists.txt
+10
-0
Apps/Examples/Release/CMakeLists.txt
Apps/Examples/Release/CMakeLists.txt
+10
-0
Apps/Examples/frame_manip.cpp
Apps/Examples/frame_manip.cpp
+399
-0
Apps/Examples/frame_manip.h
Apps/Examples/frame_manip.h
+93
-0
Apps/Examples/frame_manip.ui
Apps/Examples/frame_manip.ui
+50
-0
Apps/Examples/texture.cpp
Apps/Examples/texture.cpp
+10
-0
Apps/Examples/texturesExample.cpp
Apps/Examples/texturesExample.cpp
+273
-0
Apps/Examples/texturesExample.h
Apps/Examples/texturesExample.h
+107
-0
Apps/Tuto/stage_shader.cpp
Apps/Tuto/stage_shader.cpp
+2
-1
Apps/Tuto/tp_master.cpp
Apps/Tuto/tp_master.cpp
+3
-3
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+5
-5
README.TXT
README.TXT
+1
-1
README_ECLIPSE.TXT
README_ECLIPSE.TXT
+5
-0
README_VISUAL.TXT
README_VISUAL.TXT
+14
-7
ThirdParty/glm/glm/ext.hpp
ThirdParty/glm/glm/ext.hpp
+2
-2
build/CMakeLists.txt
build/CMakeLists.txt
+11
-3
build/Debug/CMakeLists.txt
build/Debug/CMakeLists.txt
+0
-2
build/Release/CMakeLists.txt
build/Release/CMakeLists.txt
+0
-2
build/apps_cmake.txt
build/apps_cmake.txt
+57
-0
include/Algo/Decimation/decimation.hpp
include/Algo/Decimation/decimation.hpp
+1
-1
include/Algo/Export/export.h
include/Algo/Export/export.h
+19
-5
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+44
-57
include/Algo/Filtering/average.h
include/Algo/Filtering/average.h
+197
-0
include/Algo/Filtering/functors.h
include/Algo/Filtering/functors.h
+100
-0
include/Algo/Filtering/taubin.h
include/Algo/Filtering/taubin.h
+28
-22
include/Algo/Geometry/intersection.h
include/Algo/Geometry/intersection.h
+2
-2
include/Algo/Geometry/intersection.hpp
include/Algo/Geometry/intersection.hpp
+40
-21
include/Algo/Import/AHEM.h
include/Algo/Import/AHEM.h
+167
-0
include/Algo/Import/AHEMImporter.h
include/Algo/Import/AHEMImporter.h
+136
-0
include/Algo/Import/AHEMImporter.hpp
include/Algo/Import/AHEMImporter.hpp
+486
-0
include/Algo/Import/AHEMImporterDefAttr.h
include/Algo/Import/AHEMImporterDefAttr.h
+75
-0
include/Algo/Import/AHEMImporterDefAttr.hpp
include/Algo/Import/AHEMImporterDefAttr.hpp
+260
-0
include/Algo/Import/import.h
include/Algo/Import/import.h
+1
-0
include/Algo/Import/import2tables.h
include/Algo/Import/import2tables.h
+3
-1
include/Algo/Import/import2tablesSurface.hpp
include/Algo/Import/import2tablesSurface.hpp
+200
-8
include/Algo/Import/importTet.hpp
include/Algo/Import/importTet.hpp
+5
-5
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+2
-3
include/Algo/Modelisation/polyhedron.hpp
include/Algo/Modelisation/polyhedron.hpp
+11
-11
include/Algo/Modelisation/primitives3d.h
include/Algo/Modelisation/primitives3d.h
+1
-1
include/Algo/Modelisation/primitives3d.hpp
include/Algo/Modelisation/primitives3d.hpp
+9
-9
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+3
-0
include/Algo/Render/GL1/topo_render.h
include/Algo/Render/GL1/topo_render.h
+11
-9
include/Algo/Render/GL1/topo_render.hpp
include/Algo/Render/GL1/topo_render.hpp
+7
-5
include/Algo/Render/GL2/mapRender.h
include/Algo/Render/GL2/mapRender.h
+10
-3
include/Algo/Render/SVG/mapSVGRender.h
include/Algo/Render/SVG/mapSVGRender.h
+11
-5
include/Algo/Render/SVG/mapSVGRender.hpp
include/Algo/Render/SVG/mapSVGRender.hpp
+61
-18
include/Algo/Selection/collector.hpp
include/Algo/Selection/collector.hpp
+16
-5
include/Geometry/distances.h
include/Geometry/distances.h
+14
-0
include/Geometry/distances.hpp
include/Geometry/distances.hpp
+28
-0
include/Geometry/frame.h
include/Geometry/frame.h
+222
-0
include/Geometry/frame.hpp
include/Geometry/frame.hpp
+228
-0
include/Geometry/intersection.h
include/Geometry/intersection.h
+21
-6
include/Geometry/intersection.hpp
include/Geometry/intersection.hpp
+25
-0
include/Geometry/matrix.h
include/Geometry/matrix.h
+3
-0
include/Geometry/matrix.hpp
include/Geometry/matrix.hpp
+10
-0
include/Geometry/vector_gen.h
include/Geometry/vector_gen.h
+19
-0
include/Geometry/vector_gen.hpp
include/Geometry/vector_gen.hpp
+24
-3
include/Topology/generic/cellmarker.h
include/Topology/generic/cellmarker.h
+48
-54
include/Topology/generic/dart.h
include/Topology/generic/dart.h
+6
-7
include/Topology/generic/dartmarker.h
include/Topology/generic/dartmarker.h
+30
-27
include/Topology/generic/embeddedMap2.h
include/Topology/generic/embeddedMap2.h
+1
-0
include/Topology/generic/embeddedMap3.h
include/Topology/generic/embeddedMap3.h
+1
-1
include/Topology/generic/functor.h
include/Topology/generic/functor.h
+1
-1
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+8
-8
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+15
-25
include/Topology/generic/marker.h
include/Topology/generic/marker.h
+22
-29
include/Utils/GLSLShader.h
include/Utils/GLSLShader.h
+22
-9
include/Utils/Shaders/shaderSimpleTexture.h
include/Utils/Shaders/shaderSimpleTexture.h
+46
-25
include/Utils/Shaders/shaderTextureMask.h
include/Utils/Shaders/shaderTextureMask.h
+87
-0
include/Utils/cgognStream.h
include/Utils/cgognStream.h
+5
-6
include/Utils/frameManipulator.h
include/Utils/frameManipulator.h
+282
-0
include/Utils/gl_matrices.h
include/Utils/gl_matrices.h
+53
-0
include/Utils/mark.h
include/Utils/mark.h
+5
-5
include/Utils/pickables.h
include/Utils/pickables.h
+508
-0
include/Utils/qtSimple.h
include/Utils/qtSimple.h
+19
-5
include/Utils/qtgl.h
include/Utils/qtgl.h
+0
-13
include/Utils/static_assert.h
include/Utils/static_assert.h
+3
-0
include/Utils/textures.h
include/Utils/textures.h
+393
-0
include/Utils/textures.hpp
include/Utils/textures.hpp
+1099
-0
include/Utils/vbo.h
include/Utils/vbo.h
+2
-4
src/Algo/Render/mapSVGRender.cpp
src/Algo/Render/mapSVGRender.cpp
+32
-4
src/Topology/generic/attribmap.cpp
src/Topology/generic/attribmap.cpp
+4
-2
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+10
-10
src/Topology/generic/marker.cpp
src/Topology/generic/marker.cpp
+0
-19
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+3
-4
src/Utils/GLSLShader.cpp
src/Utils/GLSLShader.cpp
+28
-19
src/Utils/Shaders/shaderPhong.cpp
src/Utils/Shaders/shaderPhong.cpp
+9
-1
src/Utils/Shaders/shaderSimpleTexture.cpp
src/Utils/Shaders/shaderSimpleTexture.cpp
+114
-0
src/Utils/Shaders/shaderTextureMask.cpp
src/Utils/Shaders/shaderTextureMask.cpp
+126
-0
src/Utils/cgognStream.cpp
src/Utils/cgognStream.cpp
+12
-11
src/Utils/drawer.cpp
src/Utils/drawer.cpp
+1
-1
src/Utils/frameManipulator.cpp
src/Utils/frameManipulator.cpp
+911
-0
src/Utils/pickables.cpp
src/Utils/pickables.cpp
+1089
-0
src/Utils/qtSimple.cpp
src/Utils/qtSimple.cpp
+60
-11
src/Utils/qtgl.cpp
src/Utils/qtgl.cpp
+17
-24
src/Utils/text3d.cpp
src/Utils/text3d.cpp
+0
-1
src/Utils/vbo.cpp
src/Utils/vbo.cpp
+1
-13
No files found.
Apps/Examples/Debug/CMakeLists.txt
View file @
ac0562e7
...
...
@@ -38,6 +38,16 @@ add_executable( polyhedronsViewD ../polyhedronsView.cpp ${polyhedronsView_moc})
target_link_libraries
(
polyhedronsViewD
${
CGoGN_LIBS_D
}
${
COMMON_LIBS
}
${
QT_LIBRARIES
}
)
QT4_WRAP_CPP
(
frame_manip_moc ../frame_manip.h
)
add_executable
(
frame_manipD ../frame_manip.cpp
${
frame_manip_moc
}
)
target_link_libraries
(
frame_manipD
${
CGoGN_LIBS_D
}
${
COMMON_LIBS
}
${
QT_LIBRARIES
}
)
QT4_WRAP_CPP
(
texturesExample_moc ../texturesExample.h
)
add_executable
(
texturesExampleD ../texturesExample.cpp
${
texturesExample_moc
}
)
target_link_libraries
(
texturesExampleD
${
CGoGN_LIBS_D
}
${
COMMON_LIBS
}
${
QT_LIBRARIES
}
)
QT4_WRAP_CPP
(
extrusionView_moc ../extrusionView.h
)
add_executable
(
extrusionViewD ../extrusionView.cpp
${
extrusionView_moc
}
)
target_link_libraries
(
extrusionViewD
...
...
Apps/Examples/Release/CMakeLists.txt
View file @
ac0562e7
...
...
@@ -42,6 +42,16 @@ add_executable( polyhedronsView ../polyhedronsView.cpp ${polyhedronsView_moc})
target_link_libraries
(
polyhedronsView
${
CGoGN_LIBS_R
}
${
COMMON_LIBS
}
${
QT_LIBRARIES
}
)
QT4_WRAP_CPP
(
frame_manip_moc ../frame_manip.h
)
add_executable
(
frame_manip ../frame_manip.cpp
${
frame_manip_moc
}
)
target_link_libraries
(
frame_manip
${
CGoGN_LIBS_R
}
${
COMMON_LIBS
}
${
QT_LIBRARIES
}
)
QT4_WRAP_CPP
(
texturesExample_moc ../texturesExample.h
)
add_executable
(
texturesExample ../texturesExample.cpp
${
texturesExample_moc
}
)
target_link_libraries
(
texturesExample
${
CGoGN_LIBS_R
}
${
COMMON_LIBS
}
${
QT_LIBRARIES
}
)
QT4_WRAP_CPP
(
extrusionView_moc ../extrusionView.h
)
add_executable
(
extrusionView ../extrusionView.cpp
${
extrusionView_moc
}
)
target_link_libraries
(
extrusionView
...
...
Apps/Examples/frame_manip.cpp
0 → 100644
View file @
ac0562e7
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <iostream>
#include "frame_manip.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
#include "Geometry/transfo.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Topology/generic/parameters.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_precision.hpp"
#include "glm/gtc/type_ptr.hpp"
using
namespace
CGoGN
;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
typedef
EmbeddedMap2
<
Map2
>
MAP
;
};
PFP
::
MAP
myMap
;
void
MyQT
::
cb_initGL
()
{
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
m_frame
=
new
Utils
::
FrameManipulator
();
// frame is rendered twice the size of normal
m_frame
->
setSize
(
2.
f
);
// none axis is picked
m_pickedAxis
=
0
;
// subdivision of 7 for each drawable
m_precDraw
=
9
;
// create the Drawables (one of each)
Utils
::
LineDrawable
*
ldp
=
new
Utils
::
Grid
(
m_precDraw
);
ldp
->
setColor
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.8
f
,
1.0
f
));
m_ld
.
push_back
(
ldp
);
ldp
=
new
Utils
::
Sphere
(
m_precDraw
,
m_precDraw
);
ldp
->
setColor
(
Geom
::
Vec4f
(
0.0
f
,
0.8
f
,
0.0
f
,
1.0
f
));
m_ld
.
push_back
(
ldp
);
ldp
=
new
Utils
::
Cube
(
m_precDraw
);
ldp
->
setColor
(
Geom
::
Vec4f
(
0.8
f
,
0.0
f
,
0.0
f
,
1.0
f
));
m_ld
.
push_back
(
ldp
);
ldp
=
new
Utils
::
Cone
(
m_precDraw
,
m_precDraw
);
ldp
->
setColor
(
Geom
::
Vec4f
(
0.8
f
,
0.0
f
,
0.8
f
,
1.0
f
));
m_ld
.
push_back
(
ldp
);
ldp
=
new
Utils
::
Cylinder
(
m_precDraw
,
m_precDraw
);
ldp
->
setColor
(
Geom
::
Vec4f
(
0.0
f
,
0.8
f
,
0.8
f
,
1.0
f
));
m_ld
.
push_back
(
ldp
);
ldp
=
new
Utils
::
IcoSphere
(
m_precDraw
);
ldp
->
setColor
(
Geom
::
Vec4f
(
0.8
f
,
0.3
f
,
0.1
f
,
1.0
f
));
m_ld
.
push_back
(
ldp
);
// create a grid of pickables
Geom
::
Vec3f
center
(
float
(
NBP
-
1
)
*
2.0
f
,
float
(
NBP
-
1
)
*
2.0
f
,
float
(
NBP
-
1
)
*
2.0
f
);
for
(
unsigned
int
i
=
0
;
i
<
NBP
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
NBP
;
++
j
)
{
for
(
unsigned
int
k
=
0
;
k
<
NBP
;
++
k
)
{
unsigned
int
idx
=
i
*
NBP
*
NBP
+
j
*
NBP
+
k
;
Utils
::
Pickable
*
pick
=
new
Utils
::
Pickable
(
m_ld
[
idx
%
m_ld
.
size
()],
idx
);
m_pickables
.
push_back
(
pick
);
// attention transfo appliques en ordre inverse !
Geom
::
Vec3f
position
(
4.0
f
*
Geom
::
Vec3f
(
i
,
j
,
k
)
-
center
);
pick
->
translate
(
position
);
pick
->
randomOrientation
();
pick
->
randomUniformScale
(
0.8
f
,
1.6
f
);
}
}
}
m_lastPickedObject
=
m_pickables
.
front
();
m_frame
->
setTransformation
(
m_lastPickedObject
->
transfo
());
}
void
MyQT
::
cb_redraw
()
{
// affichage du frame
if
(
m_lastPickedObject
)
m_frame
->
draw
();
// affichage des objets
for
(
std
::
vector
<
Utils
::
Pickable
*>::
iterator
it
=
m_pickables
.
begin
();
it
!=
m_pickables
.
end
();
++
it
)
{
if
(
*
it
==
m_lastPickedObject
)
glLineWidth
(
2.0
);
else
glLineWidth
(
1.0
);
(
*
it
)
->
draw
();
}
}
void
MyQT
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
{
if
(
!
Shift
())
return
;
m_begX
=
x
;
m_begY
=
y
;
// get ray of selection
Geom
::
Vec3f
rayA
,
rayB
;
float
dist
=
getOrthoScreenRay
(
x
,
y
,
rayA
,
rayB
);
Geom
::
Vec3f
AB
=
rayB
-
rayA
;
unsigned
int
fr_picked
=
0
;
if
(
m_lastPickedObject
)
// an object is already picked ? => frame is drawn
{
// picking the frame -> axis
fr_picked
=
m_frame
->
pick
(
rayA
,
AB
,
dist
);
// same already picked -> unpick
if
(
fr_picked
==
m_pickedAxis
)
m_pickedAxis
=
0
;
else
m_pickedAxis
=
fr_picked
;
}
// highlighting
m_frame
->
highlight
(
m_pickedAxis
);
if
(
fr_picked
==
0
)
// frame not picked -> pick the pickable objects
{
m_lastPickedObject
=
Utils
::
Pickable
::
pick
(
m_pickables
,
rayA
,
AB
);
// set FrameManipulator on picked object
if
(
m_lastPickedObject
)
{
m_frame
->
setTransformation
(
m_lastPickedObject
->
transfo
());
std
::
cout
<<
"Picked "
<<
m_lastPickedObject
->
shape
()
<<
" "
<<
m_lastPickedObject
->
id
()
<<
std
::
endl
;
}
}
// store origin & selected axis on on screen projection for easy manipulation.
m_frame
->
storeProjection
(
m_pickedAxis
);
updateGL
();
}
void
MyQT
::
cb_mouseMove
(
int
buttons
,
int
x
,
int
y
)
{
if
(
!
Shift
())
return
;
// rotation selected ?
if
(
Utils
::
FrameManipulator
::
rotationAxis
(
m_pickedAxis
))
{
if
(
buttons
&
1
)
{
float
angle
=
m_frame
->
angleFromMouse
(
x
,
y
,
x
-
m_begX
,
y
-
m_begY
);
m_frame
->
rotate
(
m_pickedAxis
,
angle
);
}
else
if
(
buttons
&
2
)
m_frame
->
rotateInScreen
(
x
-
m_begX
,
y
-
m_begY
);
m_lastPickedObject
->
transfo
()
=
m_frame
->
transfo
();
}
// translation selected
else
if
(
Utils
::
FrameManipulator
::
translationAxis
(
m_pickedAxis
))
{
if
(
buttons
&
1
)
{
float
dist
=
m_frame
->
distanceFromMouse
(
x
-
m_begX
,
y
-
m_begY
);
m_frame
->
translate
(
m_pickedAxis
,
dist
);
}
else
if
(
buttons
&
2
)
m_frame
->
translateInScreen
(
x
-
m_begX
,
y
-
m_begY
);
m_lastPickedObject
->
transfo
()
=
m_frame
->
transfo
();
}
// scale selected
else
if
(
Utils
::
FrameManipulator
::
scaleAxis
(
m_pickedAxis
)
)
{
float
scale
=
m_frame
->
scaleFromMouse
(
x
-
m_begX
,
y
-
m_begY
);
m_frame
->
scale
(
m_pickedAxis
,
scale
);
m_lastPickedObject
->
transfo
()
=
m_frame
->
transfo
();
}
// // nothing selected: using screen translation/rotation (button left/right)
// else if (m_lastPickedObject)
// {
// if (buttons&1)
// m_frame->translateInScreen(x-m_begX, y-m_begY);
// else if (buttons&2)
// m_frame->rotateInScreen(x-m_begX, y-m_begY);
// m_lastPickedObject->transfo() = m_frame->transfo();
// }
m_begX
=
x
;
m_begY
=
y
;
updateGL
();
return
;
}
void
MyQT
::
cb_wheelEvent
(
int
delta
,
int
x
,
int
y
)
{
if
(
!
Shift
())
return
;
if
(
!
m_lastPickedObject
)
return
;
if
(
Utils
::
FrameManipulator
::
rotationAxis
(
m_pickedAxis
))
m_frame
->
rotate
(
m_pickedAxis
,
float
(
delta
)
/
60.0
f
);
else
if
(
Utils
::
FrameManipulator
::
translationAxis
(
m_pickedAxis
))
m_frame
->
translate
(
m_pickedAxis
,
float
(
-
delta
)
/
1200.0
f
);
else
if
(
Utils
::
FrameManipulator
::
scaleAxis
(
m_pickedAxis
)
)
m_frame
->
scale
(
m_pickedAxis
,
1.0
f
+
float
(
-
delta
)
/
1200.0
f
);
else
m_frame
->
addSize
(
float
(
-
delta
)
/
480.0
f
);
m_lastPickedObject
->
transfo
()
=
m_frame
->
transfo
();
updateGL
();
}
void
MyQT
::
cb_keyPress
(
int
code
)
{
switch
(
code
)
{
case
'+'
:
if
(
m_precDraw
<
128
)
m_precDraw
++
;
for
(
std
::
vector
<
Utils
::
LineDrawable
*>::
iterator
it
=
m_ld
.
begin
();
it
!=
m_ld
.
end
();
++
it
)
(
*
it
)
->
updatePrecisionDrawing
(
m_precDraw
);
break
;
case
'-'
:
if
(
m_precDraw
>
3
)
m_precDraw
--
;
for
(
std
::
vector
<
Utils
::
LineDrawable
*>::
iterator
it
=
m_ld
.
begin
();
it
!=
m_ld
.
end
();
++
it
)
(
*
it
)
->
updatePrecisionDrawing
(
m_precDraw
);
break
;
case
'r'
:
for
(
unsigned
int
i
=
0
;
i
<
NBP
*
NBP
*
NBP
;
++
i
)
m_pickables
[
i
]
->
randomOrientation
();
if
(
m_lastPickedObject
)
m_frame
->
setTransformation
(
m_lastPickedObject
->
transfo
());
break
;
case
'x'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Xt
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Xt
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Xt
);
break
;
case
'w'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Xt
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Translations
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Translations
);
break
;
case
'y'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Yt
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Yt
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Yt
);
break
;
case
'z'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Zt
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Zt
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Zt
);
break
;
case
'a'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Xr
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Xr
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Xr
);
break
;
case
'b'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Yr
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Yr
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Yr
);
break
;
case
'c'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Zr
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Zr
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Zr
);
break
;
case
's'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Xs
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Xs
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Xs
);
break
;
case
't'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Ys
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Ys
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Ys
);
break
;
case
'u'
:
if
(
m_frame
->
locked
(
Utils
::
FrameManipulator
::
Zs
))
m_frame
->
unlock
(
Utils
::
FrameManipulator
::
Zs
);
else
m_frame
->
lock
(
Utils
::
FrameManipulator
::
Zs
);
break
;
}
updateGL
();
}
int
main
(
int
argc
,
char
**
argv
)
{
// interface:
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
if
(
argc
>
1
)
sqt
.
NBP
=
atoi
(
argv
[
1
]);
sqt
.
setHelpMsg
(
"Param :size of grid (number of objects)
\n
Mpuse (with shift):
\n
"
" -click on object: selection
\n
-left click on frame: constraint 3d Rotation/Translation/Scale
\n
"
" -right click on frame :free 2D Rotation/Translation
\n
Keys:
\n
x/y/z lock/unlock translation
\n
a/b/c lock/unlock rotation
\n
s/t/u lock/unlock scaling"
);
// bounding box
Geom
::
Vec3f
lPosObj
=
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
0.0
f
);
float
lWidthObj
=
sqt
.
NBP
*
4.0
f
;
// envoit info BB a l'interface
sqt
.
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
// show final pour premier redraw
sqt
.
show
();
// et on attend la fin.
return
app
.
exec
();
return
0
;
}
Apps/Examples/frame_manip.h
0 → 100644
View file @
ac0562e7
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef FRAME_MANIP_EX_H_
#define FRAME_MANIP_EX_H_
#include <iostream>
#include "Utils/qtSimple.h"
#include "Utils/frameManipulator.h"
#include "Utils/drawer.h"
// forward definitions (minimize includes)
namespace
CGoGN
{
namespace
Algo
{
namespace
Render
{
namespace
GL2
{
class
MapRender
;
}}}}
namespace
CGoGN
{
namespace
Utils
{
class
VBO
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ShaderFlat
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ShaderSimpleColor
;
}
}
using
namespace
CGoGN
;
/**
* A class for a little interface and rendering
*/
class
MyQT
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
public:
// render
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
// VBO
Utils
::
VBO
*
m_positionVBO
;
Utils
::
FrameManipulator
*
m_frame
;
unsigned
int
m_pickedAxis
;
///vector of six drawables
std
::
vector
<
Utils
::
LineDrawable
*>
m_ld
;
/// precision of drawing (number of subdivisions)
unsigned
int
m_precDraw
;
std
::
vector
<
Utils
::
Pickable
*>
m_pickables
;
Utils
::
Pickable
*
m_lastPickedObject
;
// width of cube of pickable
unsigned
int
NBP
;
MyQT
()
:
m_render
(
NULL
),
m_positionVBO
(
NULL
),
NBP
(
2
){}
// callbacks of simpleQT to overdefine:
void
cb_redraw
();
void
cb_initGL
();
void
cb_mousePress
(
int
button
,
int
x
,
int
y
);
void
cb_wheelEvent
(
int
delta
,
int
x
,
int
y
);
void
cb_keyPress
(
int
code
);
void
cb_mouseMove
(
int
button
,
int
x
,
int
y
);
int
m_begX
;
int
m_begY
;
Geom
::
Vec3f
m_projAxis
;
Geom
::
Vec3f
m_projCenter
;
};
#endif
Apps/Examples/frame_manip.ui
0 → 100644
View file @
ac0562e7
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
DockWidget
</class>
<widget
class=
"QDockWidget"
name=
"DockWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
209
</width>
<height>
345
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
150
</width>
<height>
250
</height>
</size>
</property>
<property
name=
"windowTitle"
>
<string>
Interface
</string>
</property>
<widget
class=
"QWidget"
name=
"dockWidgetContents"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
150
</width>
<height>
200
</height>
</size>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"margin"
>
<number>
2
</number>
</property>
<property
name=
"spacing"
>
<number>
4
</number>
</property>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
Apps/Examples/texture.cpp
0 → 100644
View file @
ac0562e7
/*
* texture.cpp
*
* Created on: Jul 25, 2011
* Author: thery
*/
Apps/Examples/texturesExample.cpp
0 → 100644
View file @
ac0562e7
/*
* texturesExample.cpp
*
* Created on: Jul 21, 2011
* Author: thery
*/
#include "texturesExample.h"