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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
495d160a
Commit
495d160a
authored
Apr 13, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrong manip ??
parent
6e1f65e5
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
333 additions
and
197 deletions
+333
-197
Apps/Examples/mcmesh.cpp
Apps/Examples/mcmesh.cpp
+52
-5
Apps/Examples/mcmesh.h
Apps/Examples/mcmesh.h
+7
-0
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+274
-192
No files found.
Apps/Examples/mcmesh.cpp
View file @
495d160a
...
...
@@ -29,7 +29,8 @@ MCMesh::MCMesh() :
m_drawFaces
(
true
),
m_render
(
NULL
),
m_flatShader
(
NULL
),
m_simpleColorShader
(
NULL
)
m_simpleColorShader
(
NULL
),
m_linesShader
(
NULL
)
{}
void
MCMesh
::
initGUI
()
...
...
@@ -61,28 +62,69 @@ void MCMesh::cb_initGL()
m_simpleColorShader
=
new
Utils
::
ShaderSimpleColor
();
m_simpleColorShader
->
setAttributePosition
(
m_positionVBO
);
m_colorVBO
=
new
Utils
::
VBO
();
m_linesShader
=
new
Utils
::
ShaderBoldLines
();
m_linesShader
->
setAttributePosition
(
m_positionVBO
);
// m_linesShader->setAttributeColor(m_colorVBO);
registerShader
(
m_flatShader
);
registerShader
(
m_simpleColorShader
);
registerShader
(
m_linesShader
);
m_dr
=
new
Utils
::
Drawer
();
m_dr
->
newList
();
m_dr
->
pointSize
(
4.0
f
);
m_dr
->
lineWidth
(
25.0
f
);
m_dr
->
begin
(
GL_LINES
);
m_dr
->
color3f
(
1.0
,
0.0
,
0.0
);
m_dr
->
vertex3f
(
15.0
,
15.0
,
65.0
);
m_dr
->
vertex3f
(
110.0
,
110.0
,
65.0
);
m_dr
->
color3f
(
0.0
,
1.0
,
0.0
);
m_dr
->
vertex3f
(
110.0
,
15.0
,
75.0
);
m_dr
->
vertex3f
(
15.0
,
110.0
,
75.0
);
m_dr
->
end
();
m_dr
->
endList
();
}
void
MCMesh
::
cb_redraw
()
{
glEnable
(
GL_BLEND
);
m_dr
->
callList
(
0.5
f
);
if
(
m_drawEdges
)
// {
// glLineWidth(1.0f);
// if (m_drawFaces)
// {
// Geom::Vec4f c(0.0f, 0.0f, 0.0f, 0.0f);
// m_simpleColorShader->setColor(c);
// }
// else
// {
// Geom::Vec4f c(1.0f, 1.0f, 0.0f, 0.0f);
// m_simpleColorShader->setColor(c);
// }
// m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES);
// }
{
glLineWidth
(
1.0
f
);
// glLineWidth(1.0f);
// m_linesShader->setClippingPlane(Geom::Vec4f(0.03,0.03,-1.1,64));
m_linesShader
->
setLineWidth
(
12.0
f
);
if
(
m_drawFaces
)
{
Geom
::
Vec4f
c
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
m_
simpleColor
Shader
->
setColor
(
c
);
m_
lines
Shader
->
setColor
(
c
);
}
else
{
Geom
::
Vec4f
c
(
1.0
f
,
1.0
f
,
0.0
f
,
0.0
f
);
m_
simpleColor
Shader
->
setColor
(
c
);
m_
lines
Shader
->
setColor
(
c
);
}
m_render
->
draw
(
m_
simpleColor
Shader
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
draw
(
m_
lines
Shader
,
Algo
::
Render
::
GL2
::
LINES
);
}
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
...
...
@@ -158,6 +200,11 @@ void MCMesh::updateRender()
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
m_positionVBO
->
updateData
(
position
);
m_colorVBO
->
updateData
(
position
);
Geom
::
Vec3f
*
ptr
=
reinterpret_cast
<
Geom
::
Vec3f
*>
(
m_colorVBO
->
lockPtr
());
for
(
unsigned
int
i
=
0
;
i
<
m_colorVBO
->
nbElts
();
++
i
)
*
ptr
++
/=
130.0
f
;
m_colorVBO
->
releasePtr
();
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
...
...
Apps/Examples/mcmesh.h
View file @
495d160a
...
...
@@ -39,9 +39,11 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderBoldLines.h"
#include "Utils/vbo.h"
#include "Algo/Geometry/boundingbox.h"
#include "Utils/drawer.h"
using
namespace
CGoGN
;
...
...
@@ -79,9 +81,14 @@ public:
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_colorVBO
;
Utils
::
ShaderFlat
*
m_flatShader
;
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
Utils
::
ShaderBoldLines
*
m_linesShader
;
Utils
::
Drawer
*
m_dr
;
DATATYPE
valLabel
;
SAlgo
::
MC
::
Image
<
DATATYPE
>*
myImg
;
...
...
SCHNApps/src/view.cpp
View file @
495d160a
This diff is collapsed.
Click to expand it.
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