Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CGoGN
CGoGN
Commits
bcbfbd82
Commit
bcbfbd82
authored
Feb 13, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update load/save for MRMaps
update bug in rendering topo after load
parent
3647ee4b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
8 deletions
+36
-8
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+1
-0
include/Algo/Render/GL2/topoRender.hpp
include/Algo/Render/GL2/topoRender.hpp
+12
-6
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+1
-0
include/Topology/map/map2MR/map2MR_Primal.h
include/Topology/map/map2MR/map2MR_Primal.h
+2
-0
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+20
-2
No files found.
Apps/Examples/viewer.cpp
View file @
bcbfbd82
...
@@ -255,6 +255,7 @@ void Viewer::importMesh(std::string& filename)
...
@@ -255,6 +255,7 @@ void Viewer::importMesh(std::string& filename)
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
// vertexBaseSize = normalBaseSize /5.0f ;
// vertexBaseSize = normalBaseSize /5.0f ;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
)
;
if
(
!
normal
.
isValid
())
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
)
;
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
)
;
...
...
include/Algo/Render/GL2/topoRender.hpp
View file @
bcbfbd82
...
@@ -67,10 +67,9 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const typename PFP::TVEC
...
@@ -67,10 +67,9 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const typename PFP::TVEC
std
::
vector
<
Dart
>
vecDarts
;
std
::
vector
<
Dart
>
vecDarts
;
vecDarts
.
reserve
(
map
.
getNbDarts
());
// no problem dart is int: no problem of memory
vecDarts
.
reserve
(
map
.
getNbDarts
());
// no problem dart is int: no problem of memory
if
(
m_attIndex
.
map
()
!
=
&
map
)
m_attIndex
=
map
.
template
getAttribute
<
unsigned
int
>(
DART
,
"dart_index"
);
{
if
(
!
m_attIndex
.
isValid
())
m_attIndex
=
map
.
template
addAttribute
<
unsigned
int
>(
DART
,
"dart_index"
);
m_attIndex
=
map
.
template
addAttribute
<
unsigned
int
>(
DART
,
"dart_index"
);
}
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
{
...
@@ -213,10 +212,10 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
...
@@ -213,10 +212,10 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
std
::
vector
<
Dart
>
vecDarts
;
std
::
vector
<
Dart
>
vecDarts
;
vecDarts
.
reserve
(
map
.
getNbDarts
());
// no problem dart is int: no problem of memory
vecDarts
.
reserve
(
map
.
getNbDarts
());
// no problem dart is int: no problem of memory
if
(
m_attIndex
.
map
()
!=
&
map
)
m_attIndex
=
map
.
template
getAttribute
<
unsigned
int
>(
DART
,
"dart_index"
);
{
if
(
!
m_attIndex
.
isValid
())
m_attIndex
=
map
.
template
addAttribute
<
unsigned
int
>(
DART
,
"dart_index"
);
m_attIndex
=
map
.
template
addAttribute
<
unsigned
int
>(
DART
,
"dart_index"
);
}
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
{
...
@@ -370,6 +369,13 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
...
@@ -370,6 +369,13 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
float
*
colorBuffer
=
reinterpret_cast
<
float
*>
(
glMapBuffer
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
));
float
*
colorBuffer
=
reinterpret_cast
<
float
*>
(
glMapBuffer
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
));
unsigned
int
nb
=
0
;
unsigned
int
nb
=
0
;
m_attIndex
=
map
.
template
getAttribute
<
unsigned
int
>(
DART
,
"dart_index"
);
if
(
!
m_attIndex
.
isValid
())
{
CGoGNerr
<<
"Error attribute_dartIndex does not exist during TopoRender::picking"
<<
CGoGNendl
;
return
;
}
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
{
if
(
good
(
d
))
if
(
good
(
d
))
...
...
include/Topology/generic/genericmap.h
View file @
bcbfbd82
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#define __GENERIC_MAP__
#define __GENERIC_MAP__
#include <iostream>
#include <iostream>
#include <string>
#include <sstream>
#include <sstream>
#include <fstream>
#include <fstream>
#include <iomanip>
#include <iomanip>
...
...
include/Topology/map/map2MR/map2MR_Primal.h
View file @
bcbfbd82
...
@@ -38,6 +38,8 @@ protected:
...
@@ -38,6 +38,8 @@ protected:
public:
public:
Map2MR_Primal
()
;
Map2MR_Primal
()
;
std
::
string
mapTypeName
()
{
return
"Map2MR_Primal"
;}
/***************************************************
/***************************************************
* CELLS INFORMATION *
* CELLS INFORMATION *
***************************************************/
***************************************************/
...
...
src/Topology/generic/genericmap.cpp
View file @
bcbfbd82
...
@@ -173,6 +173,8 @@ void GenericMap::initMR()
...
@@ -173,6 +173,8 @@ void GenericMap::initMR()
#endif
#endif
m_mrattribs
.
clear
(
true
)
;
m_mrattribs
.
clear
(
true
)
;
m_mrattribs
.
setRegistry
(
m_attributes_registry_map
)
;
m_mrDarts
.
clear
()
;
m_mrDarts
.
clear
()
;
m_mrDarts
.
reserve
(
16
)
;
m_mrDarts
.
reserve
(
16
)
;
m_mrNbDarts
.
clear
();
m_mrNbDarts
.
clear
();
...
@@ -457,8 +459,16 @@ bool GenericMap::saveMapBin(const std::string& filename)
...
@@ -457,8 +459,16 @@ bool GenericMap::saveMapBin(const std::string& filename)
m_attribs
[
i
].
saveBin
(
fs
,
i
);
m_attribs
[
i
].
saveBin
(
fs
,
i
);
if
(
m_isMultiRes
)
if
(
m_isMultiRes
)
{
m_mrattribs
.
saveBin
(
fs
,
00
);
m_mrattribs
.
saveBin
(
fs
,
00
);
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
m_mrCurrentLevel
),
sizeof
(
unsigned
int
));
unsigned
int
nb
=
m_mrNbDarts
.
size
();
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
nb
),
sizeof
(
unsigned
int
));
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
(
m_mrNbDarts
[
0
])),
nb
*
sizeof
(
unsigned
int
));
}
return
true
;
return
true
;
}
}
...
@@ -538,16 +548,24 @@ bool GenericMap::loadMapBin(const std::string& filename)
...
@@ -538,16 +548,24 @@ bool GenericMap::loadMapBin(const std::string& filename)
}
}
if
(
m_isMultiRes
)
if
(
m_isMultiRes
)
{
AttributeContainer
::
loadBinId
(
fs
);
// not used but need to read to skip
m_mrattribs
.
loadBin
(
fs
);
m_mrattribs
.
loadBin
(
fs
);
fs
.
read
(
reinterpret_cast
<
char
*>
(
&
m_mrCurrentLevel
),
sizeof
(
unsigned
int
));
unsigned
int
nb
;
fs
.
read
(
reinterpret_cast
<
char
*>
(
&
nb
),
sizeof
(
unsigned
int
));
m_mrNbDarts
.
resize
(
nb
);
fs
.
read
(
reinterpret_cast
<
char
*>
(
&
(
m_mrNbDarts
[
0
])),
nb
*
sizeof
(
unsigned
int
));
}
// retrieve m_embeddings (from m_attribs)
// retrieve m_embeddings (from m_attribs)
update_m_emb_afterLoad
();
update_m_emb_afterLoad
();
// recursive call from real type of map (for topo relation attributes pointers) down to GenericMap (for Marker_cleaning & pointers)
// recursive call from real type of map (for topo relation attributes pointers) down to GenericMap (for Marker_cleaning & pointers)
update_topo_shortcuts
();
update_topo_shortcuts
();
return
true
;
return
true
;
}
}
...
...
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