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
S
SocialAgents3D
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
65c76644
Commit
65c76644
authored
Mar 13, 2015
by
Thomas Pitiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
réparé affichage, pb couleurs
parent
d7cf160e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
98 deletions
+92
-98
CMakeLists.txt
CMakeLists.txt
+9
-9
gmon.out
gmon.out
+0
-0
include/surface.h
include/surface.h
+4
-12
include/viewer.h
include/viewer.h
+20
-17
src/needle.cpp
src/needle.cpp
+1
-1
src/surface.cpp
src/surface.cpp
+9
-10
src/viewer.cpp
src/viewer.cpp
+49
-49
No files found.
CMakeLists.txt
View file @
65c76644
...
...
@@ -5,9 +5,9 @@ project(Volusion)
#SET ( CMAKE_VERBOSE_MAKEFILE 1 )
SET
(
QT_USE_QTXML TRUE
)
SET
(
CGoGN_EXT_INCLUDES
${
CGoGN_EXT_INCLUDES
}
${
QT_INCLUDE_DIR
}
)
SET
(
CGoGN_EXT_LIBS
${
CGoGN_EXT_LIBS
}
${
QT_LIBRARIES
}
${
QGLVIEWER_LIBRAIRIES
}
)
#
SET(QT_USE_QTXML TRUE )
#
SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR})
#
SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRAIRIES})
SET
(
CGoGN_ROOT_DIR
${
CMAKE_SOURCE_DIR
}
/../../CGoGN CACHE STRING
"CGoGN root dir"
)
...
...
@@ -20,12 +20,11 @@ include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
#ENDIF (NOT WIN32)
include_directories
(
${
CGoGN_ROOT_DIR
}
/include
${
COMMON_INCLUDES
}
#
${CGoGN_ROOT_DIR}/include
#
${COMMON_INCLUDES}
${
CMAKE_CURRENT_BINARY_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
include
)
...
...
@@ -42,8 +41,8 @@ file( GLOB
include/*.h
)
QT4_WRAP_UI
(
Volusion_ui include/Volusion.ui
)
QT4_WRAP_CPP
(
Volusion_moc include/viewer.h
)
qt_wrap_ui
(
Volusion_ui include/Volusion.ui
)
qt_wrap_cpp
(
Volusion_moc include/viewer.h
)
add_executable
(
Volusion
${
includes
}
${
sources
}
...
...
@@ -51,4 +50,5 @@ add_executable( Volusion
${
Volusion_ui
}
)
target_link_libraries
(
Volusion
${
CGoGN_LIBS
}
${
COMMON_LIBS
}
${
CGoGN_EXT_LIBS
}
)
target_link_libraries
(
Volusion
${
CGoGN_LIBS
}
${
CGoGN_EXT_LIBS
}
)
qt_use_modules
(
Volusion Gui OpenGL Xml Svg
)
gmon.out
View file @
65c76644
No preview for this file type
include/surface.h
View file @
65c76644
...
...
@@ -11,8 +11,8 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/vbo.h"
//
#include "Utils/Shaders/shaderSimpleColor.h"
//
#include "Algo/Render/GL2/colorPerFaceRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Algo/Render/GL2/colorPerFaceRender.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
//particules
...
...
@@ -74,20 +74,12 @@ public:
// visualisation
void
initGL
();
// initialisation GL
void
draw
();
// redessiner l'objet
float
rToDraw
;
// indice de rouge de la couleur a dessiner
float
gToDraw
;
// indice de VERT de la couleur a dessiner
float
bToDraw
;
// indice de BLeu de la couleur a dessiner
void
changeColor
(
Triangle
*
t
,
float
distance
);
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
// render de l'objet
//
Algo::Render::GL2::ColorPerFaceRender * m_render;
//
Algo::Render::GL2::MapRender* m_render; // render de l'objet
Algo
::
Render
::
GL2
::
ColorPerFaceRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
//VBO
Utils
::
VBO
*
m_colorVBO
;
// Utils::ShaderSimpleColor* m_simpleColorShader; // shader
...
...
include/viewer.h
View file @
65c76644
...
...
@@ -43,7 +43,10 @@
#include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h"
//#include "Utils/Qt/qtSimple.h"
#include "Utils/Qt/qtQGLV.h"
#include "Utils/frameManipulator.h"
///// UI
#include "ui_Volusion.h"
...
...
@@ -68,7 +71,7 @@ using namespace CGoGN ;
* Ajouter les widgets necessaires, mettre des noms clairs pour
* les utiliser dans le .cpp (pour les call back principalement)
*/
class
Volusion
:
public
Utils
::
QT
::
SimpleQ
T
class
Volusion
:
public
Utils
::
QT
::
SimpleQ
GLV
{
Q_OBJECT
...
...
@@ -77,8 +80,8 @@ class Volusion: public Utils::QT::SimpleQT
bool
render_topo
;
bool
render_MovingObject
;
bool
render_topoTemp
;
bool
clip_volume
;
bool
hide_clipping
;
//
bool clip_volume;
//
bool hide_clipping;
bool
draw_dart
;
float
m_explode_factor
;
float
m_explode_factorf
;
...
...
@@ -106,17 +109,17 @@ class Volusion: public Utils::QT::SimpleQT
// for clipping plane manipulation
Utils
::
Pickable
*
m_PlanePick
;
Utils
::
FrameManipulator
*
m_frame
;
unsigned
int
m_pickedAxis
;
int
m_begX
;
int
m_begY
;
int
clip_id1
;
int
clip_id2
;
// shader of toporender3
Utils
::
ClippingShader
*
m_sh1
;
Utils
::
ClippingShader
*
m_sh2
;
//
Utils::Pickable* m_PlanePick;
//
Utils::FrameManipulator* m_frame;
//
unsigned int m_pickedAxis;
//
int m_begX;
//
int m_begY;
//
int clip_id1;
//
int clip_id2;
//
// shader of toporender3
//
Utils::ClippingShader* m_sh1;
//
Utils::ClippingShader* m_sh2;
public:
float
m_WidthObj
;
...
...
@@ -131,8 +134,8 @@ public:
render_topo
(
false
),
render_MovingObject
(
true
),
render_topoTemp
(
false
),
clip_volume
(
false
),
hide_clipping
(
true
),
//
clip_volume(false),
//
hide_clipping(true),
draw_dart
(
false
),
m_explode_factor
(
1.0
f
),
render_belonging
(
false
),
...
...
src/needle.cpp
View file @
65c76644
...
...
@@ -9,7 +9,7 @@ Needle::Needle(Simulator* sim,std::pair<VEC3, Dart> startingPoint)
g
=
0.0
f
;
b
=
1.0
f
;
sim_
=
sim
;
width
=
1.0
;
width
=
0.1
;
Needle_or_knife
=
true
;
nbVertices
=
1
;
nbEdges
=
0
;
...
...
src/surface.cpp
View file @
65c76644
...
...
@@ -89,8 +89,8 @@ void Surface::initGL()
// m_render = new Algo::Render::GL2::MapRender();
m_positionVBO
=
new
Utils
::
VBO
();
m_colorVBO
=
new
Utils
::
VBO
();
m_render
=
new
Algo
::
Render
::
GL2
::
Map
Render
();
//
m_render->updateVBO<PFPSurface,FACE>(*m_positionVBO,*m_colorVBO,surfaceMap,positionSurface,faceColor);
m_render
=
new
Algo
::
Render
::
GL2
::
ColorPerFace
Render
();
//
m_shader
=
new
Utils
::
ShaderColorPerVertex
();
m_shader
->
setAttributeColor
(
m_colorVBO
);
...
...
@@ -99,26 +99,25 @@ void Surface::initGL()
// m_simpleColorShader->setAttributePosition(m_positionVBO);
// m_simpleColorShader->setColor(Geom::Vec4f(0.,1.,0.,0.));
m_render
->
updateVBO
<
PFPSurface
,
FACE
>
(
*
m_positionVBO
,
*
m_colorVBO
,
surfaceMap
,
positionSurface
,
faceColor
);
m_positionVBO
->
updateData
(
positionSurface
)
;
m_colorVBO
->
updateData
(
faceColor
);
m_render
->
initPrimitives
<
PFPSurface
>
(
surfaceMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFPSurface
>
(
surfaceMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
// m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::LINES) ;
// m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::TRIANGLES) ;
}
void
Surface
::
draw
()
{
m_positionVBO
->
updateData
(
positionSurface
)
;
m_colorVBO
->
updateData
(
faceColor
);
//
m_positionVBO->updateData(positionSurface) ;
//
m_colorVBO->updateData(faceColor);
// colorRender->updateVBO<PFPSurface,FACE>(m_positionVBO,m_colorVBO,surfaceMap,positionSurface,colorRender);
glLineWidth
(
1.0
f
);
//
m_render->updateVBO<PFPSurface,FACE>(*m_positionVBO,*m_colorVBO,surfaceMap,positionSurface,faceColor);
m_render
->
updateVBO
<
PFPSurface
,
FACE
>
(
*
m_positionVBO
,
*
m_colorVBO
,
surfaceMap
,
positionSurface
,
faceColor
);
// m_simpleColorShader->setColor(Geom::Vec4f(0.0,0.0,0.0,0.));
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
m_render
->
draw
(
m_shader
);
}
...
...
src/viewer.cpp
View file @
65c76644
...
...
@@ -86,32 +86,32 @@ void Volusion::topo_onoff(bool x)
void
Volusion
::
clipping_onoff
(
bool
x
)
{
clip_volume
=
x
;
if
(
clip_volume
)
{
Geom
::
Vec3f
pos
=
m_PlanePick
->
getPosition
();
float
pipo
;
Geom
::
Vec3f
normal
=
m_PlanePick
->
getAxisScale
(
2
,
pipo
);
// 2 = Z axis = plane normal
float
d
=
-
(
pos
*
normal
);
m_explode_render
->
setClippingPlane
(
Geom
::
Vec4f
(
normal
[
0
],
normal
[
1
],
normal
[
2
],
d
));
m_sh1
->
setClipPlaneParamsAll
(
clip_id1
,
normal
,
pos
);
m_sh2
->
setClipPlaneParamsAll
(
clip_id2
,
normal
,
pos
);
}
else
{
m_explode_render
->
setNoClippingPlane
();
m_sh1
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_sh2
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_sh1
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
m_sh2
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
}
//
clip_volume = x;
//
if (clip_volume)
//
{
//
Geom::Vec3f pos = m_PlanePick->getPosition();
//
float pipo;
//
Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal
//
float d = -(pos*normal);
//
m_explode_render->setClippingPlane(Geom::Vec4f(normal[0],normal[1],normal[2],d));
//
m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos);
//
m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos);
//
}
//
else
//
{
//
m_explode_render->setNoClippingPlane();
//
m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
//
m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
//
m_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f);
//
m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f);
//
}
updateGL
();
}
void
Volusion
::
hide_onoff
(
bool
x
)
{
hide_clipping
=
x
;
//
hide_clipping = x;
updateGL
();
}
...
...
@@ -215,26 +215,26 @@ void Volusion::cb_initGL()
m_explode_render
->
setBackColor
(
Geom
::
Vec4f
(
0.9
f
,
0.9
f
,
0.9
f
,
1.0
f
));
m_explode_render
->
setColorLine
(
Geom
::
Vec4f
(
0.8
f
,
0.2
f
,
0.2
f
,
1.0
f
));
m_sh1
=
static_cast
<
Utils
::
ClippingShader
*>
(
m_topo_render
->
shader1
());
m_sh2
=
static_cast
<
Utils
::
ClippingShader
*>
(
m_topo_render
->
shader2
());
//
m_sh1 = static_cast<Utils::ClippingShader*>(m_topo_render->shader1());
//
m_sh2 = static_cast<Utils::ClippingShader*>(m_topo_render->shader2());
registerShader
(
m_explode_render
->
shaderFaces
());
registerShader
(
m_explode_render
->
shaderLines
());
m_PlanePick
=
new
Utils
::
Pickable
(
Utils
::
Pickable
::
GRID
,
1
);
m_frame
=
new
Utils
::
FrameManipulator
();
m_frame
->
setSize
(
m_WidthObj
/
2.0
f
);
//
m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1);
//
m_frame = new Utils::FrameManipulator();
//
m_frame->setSize(m_WidthObj/2.0f);
m_sh1
->
insertClippingCode
();
m_sh2
->
insertClippingCode
();
//
m_sh1->insertClippingCode();
//
m_sh2->insertClippingCode();
clip_id1
=
m_sh1
->
addClipPlane
();
clip_id2
=
m_sh2
->
addClipPlane
();
//
clip_id1 = m_sh1->addClipPlane();
//
clip_id2 = m_sh2->addClipPlane();
m_sh1
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
m_PosObj
);
m_sh2
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
m_PosObj
);
m_explode_render
->
setClippingPlane
(
Geom
::
Vec4f
(
0
,
0
,
1
,
m_PosObj
*
Geom
::
Vec3f
(
0
,
0
,
-
1
)));
//
m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), m_PosObj);
//
m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), m_PosObj);
m_explode_render
->
setClippingPlane
(
Geom
::
Vec4f
(
0
,
0
,
1
,
m_PosObj
*
Geom
::
Vec3f
(
0
,
0
,
-
1
)));
for
(
Surface
*
surf
:
simul
.
surfaces
)
{
...
...
@@ -261,7 +261,7 @@ void Volusion::cb_initGL()
m_sprite
=
new
Utils
::
PointSprite
();
m_sprite
->
setAttributePosition
(
m_MovingObjectVBO
);
m_sprite
->
setSize
(
simul
.
aiguille
->
width
);
m_sprite
->
setSize
(
simul
.
aiguille
->
width
/
2.0
);
registerShader
(
m_sprite
);
m_frame_MovingObject
=
new
Utils
::
FrameManipulator
();
...
...
@@ -595,17 +595,17 @@ void Volusion::cb_redraw()
m_explode_render
->
drawFaces
();
}
if
(
clip_volume
&&
!
hide_clipping
)
{
m_frame
->
draw
();
m_PlanePick
->
draw
();
}
//
if (clip_volume && !hide_clipping)
//
{
//
m_frame->draw();
//
m_PlanePick->draw();
//
}
}
void
Volusion
::
cb_mousePress
(
int
/*button*/
,
int
x
,
int
y
)
{
if
(
Shift
())
/*
if (Shift())
{
if (hide_clipping || !clip_volume)
...
...
@@ -631,7 +631,7 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y)
updateGL();
}
}
else
if
(
Control
())
else
*/
if
(
Control
())
{
startX
=
x
;
startY
=
y
;
...
...
@@ -644,13 +644,13 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y)
void
Volusion
::
cb_mouseRelease
(
int
/*button*/
,
int
/*x*/
,
int
/*y*/
)
{
if
(
!
hide_clipping
&&
clip_volume
)
{
//
if (!hide_clipping && clip_volume)
//
{
m_pickedAxis
=
0
;
m_frame
->
highlight
(
m_pickedAxis
);
updateGL
();
}
//
m_pickedAxis=0;
//
m_frame->highlight(m_pickedAxis);
//
updateGL();
//
}
if
(
render_MovingObject
)
updateGL
();
...
...
@@ -658,7 +658,7 @@ void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
void
Volusion
::
cb_mouseMove
(
int
buttons
,
int
x
,
int
y
)
{
if
(
Shift
())
/*
if (Shift())
{
...
...
@@ -713,7 +713,7 @@ void Volusion::cb_mouseMove(int buttons, int x, int y)
updateGL();
return;
}
else
if
(
Control
())
else
*/
if
(
Control
())
{
m_frame_MovingObject
->
translateInScreen
(
x
-
startX
,
y
-
startY
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment