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
71ea1c42
Commit
71ea1c42
authored
Feb 14, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fichier oublié..
parent
7bb2d103
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
0 deletions
+91
-0
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+91
-0
No files found.
SCHNApps/include/mapHandler.hpp
0 → 100644
View file @
71ea1c42
namespace
CGoGN
{
namespace
SCHNApps
{
template
<
typename
T
,
unsigned
int
ORBIT
>
AttributeHandler
<
T
,
ORBIT
>
MapHandlerGen
::
getAttribute
(
const
QString
&
nameAttr
,
bool
onlyRegistered
)
const
{
if
(
onlyRegistered
)
{
if
(
h_attribs
[
ORBIT
].
contains
(
nameAttr
))
return
static_cast
<
AttribMap
*>
(
m_map
)
->
getAttribute
<
T
,
ORBIT
>
(
nameAttr
.
toStdString
());
else
return
AttributeHandler
<
T
,
ORBIT
>
();
}
else
return
static_cast
<
AttribMap
*>
(
m_map
)
->
getAttribute
<
T
,
ORBIT
>
(
nameAttr
.
toStdString
());
}
template
<
typename
T
,
unsigned
int
ORBIT
>
AttributeHandler
<
T
,
ORBIT
>
MapHandlerGen
::
addAttribute
(
const
QString
&
nameAttr
,
bool
registerAttr
)
{
AttributeHandler
<
T
,
ORBIT
>
ah
=
static_cast
<
AttribMap
*>
(
m_map
)
->
addAttribute
<
T
,
ORBIT
>
(
nameAttr
.
toStdString
());
if
(
ah
.
isValid
()
&&
registerAttr
)
{
registerAttribute
(
ah
);
emit
(
attributeAdded
(
ORBIT
,
nameAttr
));
}
return
ah
;
}
template
<
typename
T
,
unsigned
int
ORBIT
>
inline
void
MapHandlerGen
::
registerAttribute
(
const
AttributeHandler
<
T
,
ORBIT
>&
ah
)
{
h_attribs
[
ORBIT
].
insert
(
QString
::
fromStdString
(
ah
.
name
()),
QString
::
fromStdString
(
nameOfType
(
T
())));
}
inline
QString
MapHandlerGen
::
getAttributeTypeName
(
unsigned
int
orbit
,
const
QString
&
nameAttr
)
const
{
if
(
h_attribs
[
orbit
].
contains
(
nameAttr
))
return
h_attribs
[
orbit
][
nameAttr
];
else
return
""
;
}
template
<
typename
ATTR_HANDLER
>
Utils
::
VBO
*
MapHandlerGen
::
createVBO
(
const
ATTR_HANDLER
&
attr
)
{
QString
name
=
QString
::
fromStdString
(
attr
.
name
());
Utils
::
VBO
*
vbo
=
getVBO
(
name
);
if
(
!
vbo
)
{
vbo
=
new
Utils
::
VBO
();
h_vbo
.
insert
(
name
,
vbo
);
emit
(
vboAdded
(
vbo
));
}
return
vbo
;
}
template
<
typename
ATTR_HANDLER
>
inline
void
MapHandlerGen
::
updateVBO
(
const
ATTR_HANDLER
&
attr
)
{
Utils
::
VBO
*
vbo
=
getVBO
(
QString
::
fromStdString
(
attr
.
name
()));
if
(
vbo
)
vbo
->
updateData
(
attr
);
}
template
<
typename
PFP
>
void
MapHandler
<
PFP
>::
draw
(
Utils
::
GLSLShader
*
shader
,
int
primitive
)
{
if
(
!
m_render
->
isPrimitiveUpToDate
(
primitive
))
m_render
->
initPrimitives
<
PFP
>
(
*
(
static_cast
<
typename
PFP
::
MAP
*>
(
m_map
)),
allDarts
,
primitive
)
;
m_render
->
draw
(
shader
,
primitive
);
}
template
<
typename
PFP
>
void
MapHandler
<
PFP
>::
updateBB
(
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
{
CGoGN
::
Geom
::
BoundingBox
<
typename
PFP
::
VEC3
>
bb
=
CGoGN
::
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
*
(
static_cast
<
typename
PFP
::
MAP
*>
(
m_map
)),
position
);
m_bbMin
=
qglviewer
::
Vec
(
bb
.
min
()[
0
],
bb
.
min
()[
1
],
bb
.
min
()[
2
]);
m_bbMax
=
qglviewer
::
Vec
(
bb
.
max
()[
0
],
bb
.
max
()[
1
],
bb
.
max
()[
2
]);
m_bbDiagSize
=
(
m_bbMax
-
m_bbMin
).
norm
();
}
}
// namespace SCHNApps
}
// namespace CGoGN
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