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
Thomas Pitiot
CGoGN
Commits
461e5daf
Commit
461e5daf
authored
Nov 07, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add callSubList possibility in Drawe
parent
5f83b5b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
include/Utils/drawer.h
include/Utils/drawer.h
+12
-1
src/Utils/drawer.cpp
src/Utils/drawer.cpp
+44
-1
No files found.
include/Utils/drawer.h
View file @
461e5daf
...
...
@@ -90,8 +90,9 @@ public:
/**
* as glBegin, but need a newList call before
* @param mode: POINTS, LINES, LINE_LOOP, TRIANGLES, QUADS, POLYGON, etc..
* @return index of subdrawing possible call
*/
void
begin
(
GLenum
mode
);
int
begin
(
GLenum
mode
);
/**
* as glEnd
...
...
@@ -131,6 +132,16 @@ public:
*/
void
callList
(
float
opacity
=
1.0
f
);
/**
* call a sub-list (index return by begin (0,1,...)
*/
void
callSubList
(
int
index
,
float
opacity
=
1.0
f
);
/**
* call a set of sub-lists
*/
void
callSubLists
(
std
::
vector
<
int
>
indices
,
float
opacity
);
/**
* use as glLineWidth
*/
...
...
src/Utils/drawer.cpp
View file @
461e5daf
...
...
@@ -74,12 +74,14 @@ void Drawer::pointSize(float ps)
m_currentSize
=
ps
;
}
void
Drawer
::
begin
(
GLenum
mode
)
int
Drawer
::
begin
(
GLenum
mode
)
{
int
res
=
m_begins
.
size
();
if
(
mode
==
GL_POINTS
)
m_begins
.
push_back
(
PrimParam
(
m_dataPos
.
size
(),
mode
,
m_currentSize
));
else
m_begins
.
push_back
(
PrimParam
(
m_dataPos
.
size
(),
mode
,
m_currentWidth
));
return
res
;
}
void
Drawer
::
end
()
...
...
@@ -186,6 +188,47 @@ void Drawer::callList(float opacity)
}
void
Drawer
::
callSubList
(
int
index
,
float
opacity
)
{
if
(
index
>=
int
(
m_begins
.
size
()))
return
;
m_shader
->
setOpacity
(
opacity
);
m_shader
->
enableVertexAttribs
();
PrimParam
*
pp
=
&
(
m_begins
[
index
]);
if
(
pp
->
mode
==
GL_POINTS
)
glPointSize
(
pp
->
width
);
if
((
pp
->
mode
==
GL_LINES
)
||
(
pp
->
mode
==
GL_LINE_LOOP
))
glLineWidth
(
pp
->
width
);
glDrawArrays
(
pp
->
mode
,
pp
->
begin
,
pp
->
nb
);
m_shader
->
disableVertexAttribs
();
}
void
Drawer
::
callSubLists
(
std
::
vector
<
int
>
indices
,
float
opacity
)
{
m_shader
->
setOpacity
(
opacity
);
m_shader
->
enableVertexAttribs
();
for
(
std
::
vector
<
int
>::
iterator
it
=
indices
.
begin
();
it
!=
indices
.
end
();
++
it
)
if
(
*
it
<
int
(
m_begins
.
size
()))
{
PrimParam
*
pp
=
&
(
m_begins
[
*
it
]);
if
(
pp
->
mode
==
GL_POINTS
)
glPointSize
(
pp
->
width
);
if
((
pp
->
mode
==
GL_LINES
)
||
(
pp
->
mode
==
GL_LINE_LOOP
))
glLineWidth
(
pp
->
width
);
glDrawArrays
(
pp
->
mode
,
pp
->
begin
,
pp
->
nb
);
}
m_shader
->
disableVertexAttribs
();
}
void
Drawer
::
toSVG
(
Utils
::
SVG
::
SVGOut
&
svg
)
{
...
...
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