Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Pitiot
CGoGN
Commits
9c4f8a7c
Commit
9c4f8a7c
authored
Aug 20, 2012
by
Sylvain Thery
Browse files
Merge branch 'master' of cgogn:~cgogn/CGoGN
parents
7e843f10
2aa9ef9a
Changes
19
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/viewer.cpp
View file @
9c4f8a7c
...
...
@@ -17,7 +17,7 @@
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Web site: http://cgogn.unistra.fr/
*
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
...
...
@@ -191,6 +191,18 @@ void Viewer::cb_Save()
exportMesh
(
filename
)
;
}
void
Viewer
::
cb_keyPress
(
int
keycode
)
{
switch
(
keycode
)
{
case
'c'
:
myMap
.
check
();
break
;
default:
break
;
}
}
void
Viewer
::
importMesh
(
std
::
string
&
filename
)
{
myMap
.
clear
(
true
)
;
...
...
@@ -311,21 +323,6 @@ void Viewer::slot_normalsSize(int i)
updateGL
()
;
}
void
Viewer
::
cb_keyPress
(
int
keycode
)
{
switch
(
keycode
)
{
case
'c'
:
myMap
.
check
();
break
;
default:
break
;
}
updateGLMatrices
()
;
updateGL
();
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
...
...
Apps/Examples/viewer.h
View file @
9c4f8a7c
...
...
@@ -46,6 +46,8 @@
#include
"Utils/Shaders/shaderVectorPerVertex.h"
#include
"Utils/pointSprite.h"
#include
"Utils/text3d.h"
#include
"Utils/vboRender.h"
#include
"Utils/Qt/qtInputs.h"
#include
"Algo/Geometry/boundingbox.h"
...
...
include/Algo/Export/exportPov.h
View file @
9c4f8a7c
...
...
@@ -41,7 +41,7 @@ void exportMeshPlain(std::ofstream& out, typename PFP::MAP& map, VertexAttribute
TraversorF
<
typename
PFP
::
MAP
>
travF
(
map
);
for
(
Dart
d
=
travF
.
begin
()
;
d
!=
travF
.
end
()
;
travF
.
next
(
d
))
for
(
Dart
d
=
travF
.
begin
()
;
d
!=
travF
.
end
()
;
d
=
travF
.
next
())
{
if
(
good
(
d
))
{
...
...
include/Algo/Import/importMRDAT.h
View file @
9c4f8a7c
...
...
@@ -90,20 +90,20 @@ public:
do
{
Dart
next
=
map
.
phi1
(
it
)
;
unsigned
int
emb
=
map
.
getEmbedding
<
VERTEX
>
(
it
)
;
unsigned
int
emb
=
map
.
template
getEmbedding
<
VERTEX
>(
it
)
;
unsigned
int
idx
=
emb
==
v0
?
0
:
emb
==
v1
?
1
:
2
;
map
.
incCurrentLevel
()
;
Dart
dd
=
map
.
phi1
(
next
)
;
unsigned
int
oldEmb
=
map
.
getEmbedding
<
VERTEX
>
(
dd
)
;
unsigned
int
oldEmb
=
map
.
template
getEmbedding
<
VERTEX
>(
dd
)
;
unsigned
int
newEmb
=
vID
[
children
[
0
]
->
indices
[
idx
]]
;
if
(
oldEmb
==
EMBNULL
)
{
map
.
embedOrbit
<
VERTEX
>
(
dd
,
newEmb
)
;
map
.
template
embedOrbit
<
VERTEX
>(
dd
,
newEmb
)
;
map
.
pushLevel
()
;
for
(
unsigned
int
i
=
map
.
getCurrentLevel
()
+
1
;
i
<=
map
.
getMaxLevel
();
++
i
)
{
map
.
setCurrentLevel
(
i
)
;
map
.
embedOrbit
<
VERTEX
>
(
dd
,
newEmb
)
;
map
.
template
embedOrbit
<
VERTEX
>(
dd
,
newEmb
)
;
}
map
.
popLevel
()
;
}
...
...
@@ -120,7 +120,7 @@ public:
do
{
unsigned
int
emb
=
map
.
getEmbedding
<
VERTEX
>
(
it
)
;
unsigned
int
emb
=
map
.
template
getEmbedding
<
VERTEX
>(
it
)
;
unsigned
int
idx
=
emb
==
v0
?
0
:
emb
==
v1
?
1
:
2
;
map
.
incCurrentLevel
()
;
children
[
idx
+
1
]
->
embed
<
PFP
>
(
map
,
it
,
vID
)
;
...
...
include/Algo/Import/importMRDAT.hpp
View file @
9c4f8a7c
...
...
@@ -41,14 +41,13 @@ inline void nextNonEmptyLine(std::ifstream& fp, std::string& line)
template
<
typename
PFP
>
bool
importMRDAT
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
QuadTree
&
qt
)
{
VertexAttribute
<
typename
PFP
::
VEC3
>
position
=
map
.
template
getAttribute
<
typename
PFP
::
VEC3
>(
VERTEX
,
"position"
)
;
VertexAttribute
<
typename
PFP
::
VEC3
>
position
=
map
.
template
getAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"position"
)
;
if
(
!
position
.
isValid
())
position
=
map
.
template
addAttribute
<
typename
PFP
::
VEC3
>(
VERTEX
,
"position"
)
;
position
=
map
.
template
addAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"position"
)
;
attrNames
.
push_back
(
position
.
name
())
;
AttributeContainer
&
container
=
map
.
getAttributeContainer
(
VERTEX
)
;
AttributeContainer
&
container
=
map
.
template
getAttributeContainer
<
VERTEX
>(
)
;
// open file
std
::
ifstream
fp
(
filename
.
c_str
(),
std
::
ios
::
in
)
;
...
...
@@ -206,7 +205,7 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
unsigned
int
emb
=
qt
.
verticesID
[
idx
]
;
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
,
emb
)
;
map
.
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>
(
d
,
fsetemb
)
;
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
)
;
m
.
mark
(
d
)
;
// mark on the fly to unmark on second loop
vecDartsPerVertex
[
emb
].
push_back
(
d
)
;
// store incident darts for fast adjacency reconstruction
...
...
@@ -223,11 +222,11 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
// darts incident to end vertex of edge
std
::
vector
<
Dart
>&
vec
=
vecDartsPerVertex
[
map
.
phi1
(
d
)]
;
unsigned
int
embd
=
map
.
getEmbedding
<
VERTEX
>
(
d
)
;
unsigned
int
embd
=
map
.
template
getEmbedding
<
VERTEX
>(
d
)
;
Dart
good_dart
=
NIL
;
for
(
typename
std
::
vector
<
Dart
>::
iterator
it
=
vec
.
begin
();
it
!=
vec
.
end
()
&&
good_dart
==
NIL
;
++
it
)
{
if
(
map
.
getEmbedding
<
VERTEX
>
(
map
.
phi1
(
*
it
))
==
embd
)
if
(
map
.
template
getEmbedding
<
VERTEX
>(
map
.
phi1
(
*
it
))
==
embd
)
good_dart
=
*
it
;
}
...
...
include/Algo/Render/GL2/drawerCells.h
View file @
9c4f8a7c
...
...
@@ -79,7 +79,7 @@ void drawerVertices(Utils::Drawer& dr, typename PFP::MAP& map, std::vector<Dart>
* @param k shrinking factor
*/
template
<
typename
PFP
>
void
drawerEdges
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
void
drawerEdges
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
/**
* add a set of faces to a drawer
...
...
@@ -90,7 +90,7 @@ void drawerEdges(Utils::Drawer& dr, typename PFP::MAP& map, std::vector<Dart>& v
* @param k shrinking factor
*/
template
<
typename
PFP
>
void
drawerFaces
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
void
drawerFaces
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
/**
* add a set of volumes to a drawer
...
...
@@ -101,7 +101,7 @@ void drawerFaces(Utils::Drawer& dr, typename PFP::MAP& map, std::vector<Dart>& v
* @param k shrinking factor
*/
template
<
typename
PFP
>
void
drawerVolumes
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
void
drawerVolumes
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
/**
* add a vertex to a drawer
...
...
@@ -121,7 +121,7 @@ void drawerVertex(Utils::Drawer& dr, typename PFP::MAP& map, Dart d, const Verte
* @param positions attribute of positions
*/
template
<
typename
PFP
>
void
drawerEdge
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
void
drawerEdge
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
/**
* add a face to a drawer
...
...
@@ -132,7 +132,7 @@ void drawerEdge(Utils::Drawer& dr, typename PFP::MAP& map, Dart d, const Vertex
* @param k shrinking factor
*/
template
<
typename
PFP
>
void
drawerFace
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
void
drawerFace
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
/**
* add a volume to a drawer
...
...
@@ -143,7 +143,7 @@ void drawerFace(Utils::Drawer& dr, typename PFP::MAP& map, Dart d, const VertexA
* @param k shrinking factor
*/
template
<
typename
PFP
>
void
drawerVolume
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
void
drawerVolume
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
/**
* add an edge to a drawer, use between begin / end
...
...
@@ -188,13 +188,13 @@ void drawerAddFace(Utils::Drawer& dr, typename PFP::MAP& map, Dart d, const Vert
* @param k shrinking factor
*/
template
<
typename
PFP
>
void
drawerAddVolume
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
void
drawerAddVolume
(
Utils
::
Drawer
&
dr
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
k
);
}
}
// namespace Render
}
}
// namespace Algo
}
}
// namespace CGoGN
#include
"Algo/Render/GL2/drawerCells.hpp"
...
...
include/Algo/Render/GL2/mapRender.h
View file @
9c4f8a7c
...
...
@@ -100,7 +100,7 @@ protected:
static
bool
cmpVP
(
VertexPoly
*
lhs
,
VertexPoly
*
rhs
);
// multiset typedef for simple writing
typedef
std
::
multiset
<
VertexPoly
*
,
bool
(
*
)(
VertexPoly
*
,
VertexPoly
*
)
>
VPMS
;
typedef
std
::
multiset
<
VertexPoly
*
,
bool
(
*
)(
VertexPoly
*
,
VertexPoly
*
)
>
VPMS
;
class
VertexPoly
{
...
...
@@ -112,9 +112,9 @@ protected:
VertexPoly
*
next
;
VPMS
::
iterator
ear
;
VertexPoly
(
int
i
,
float
v
,
float
l
,
VertexPoly
*
p
=
NULL
)
:
id
(
i
),
value
(
v
),
length
(
l
),
prev
(
p
),
next
(
NULL
)
VertexPoly
(
int
i
,
float
v
,
float
l
,
VertexPoly
*
p
=
NULL
)
:
id
(
i
),
value
(
v
),
length
(
l
),
prev
(
p
),
next
(
NULL
)
{
if
(
prev
!=
NULL
)
if
(
prev
!=
NULL
)
prev
->
next
=
this
;
}
...
...
@@ -132,7 +132,6 @@ protected:
delete
vp
;
return
tmp
;
}
};
public:
...
...
include/Algo/Selection/collector.h
View file @
9c4f8a7c
...
...
@@ -166,6 +166,40 @@ public:
inline
typename
PFP
::
REAL
getArea
()
const
{
return
area
;
}
};
/*********************************************************
* Collector Normal Angle
*********************************************************/
/*
* collect all primitives of the connected component containing "centerDart"
* the angle between the included vertices normal vectors and the central normal vector
* stays under a given threshold
*/
template
<
typename
PFP
>
class
Collector_NormalAngle
:
public
Collector
<
PFP
>
{
protected:
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
;
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normal
;
typename
PFP
::
REAL
angleThreshold
;
public:
Collector_NormalAngle
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
n
,
typename
PFP
::
REAL
a
)
:
Collector
<
PFP
>
(
m
),
position
(
p
),
normal
(
n
),
angleThreshold
(
a
)
{}
inline
void
setAngleThreshold
(
typename
PFP
::
REAL
a
)
{
angleThreshold
=
a
;
}
inline
typename
PFP
::
REAL
getAngleThreshold
()
const
{
return
angleThreshold
;
}
inline
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
getPosition
()
const
{
return
position
;
}
inline
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
getNormal
()
const
{
return
normal
;
}
void
collectAll
(
Dart
d
)
;
void
collectBorder
(
Dart
d
)
;
};
}
// namespace Selection
}
// namespace Algo
...
...
include/Algo/Selection/collector.hpp
View file @
9c4f8a7c
...
...
@@ -280,6 +280,127 @@ void Collector_WithinSphere<PFP>::computeArea()
}
}
/*********************************************************
* Collector Normal Angle
*********************************************************/
template
<
typename
PFP
>
void
Collector_NormalAngle
<
PFP
>::
collectAll
(
Dart
d
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
this
->
init
(
d
);
this
->
insideEdges
.
reserve
(
32
);
this
->
insideFaces
.
reserve
(
32
);
this
->
border
.
reserve
(
32
);
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
);
// mark the collected inside-edges + border-edges
CellMarkerStore
<
FACE
>
fm
(
this
->
map
);
// mark the collected inside-faces + border-faces
this
->
insideVertices
.
push_back
(
this
->
centerDart
);
vm
.
mark
(
this
->
centerDart
);
VEC3
centerNormal
=
this
->
normal
[
d
];
unsigned
int
i
=
0
;
while
(
i
<
this
->
insideVertices
.
size
())
{
Dart
end
=
this
->
insideVertices
[
i
];
Dart
e
=
end
;
do
{
if
(
!
em
.
isMarked
(
e
)
||
!
fm
.
isMarked
(
e
))
// are both tests useful ?
{
const
Dart
f
=
this
->
map
.
phi1
(
e
);
const
Dart
g
=
this
->
map
.
phi1
(
f
);
REAL
a
=
Geom
::
angle
(
centerNormal
,
this
->
normal
[
f
]);
if
(
a
>
angleThreshold
)
{
this
->
border
.
push_back
(
e
);
// add to border
em
.
mark
(
e
);
fm
.
mark
(
e
);
// is it useful ?
}
else
{
if
(
!
vm
.
isMarked
(
f
))
{
this
->
insideVertices
.
push_back
(
f
);
vm
.
mark
(
f
);
}
if
(
!
em
.
isMarked
(
e
))
{
this
->
insideEdges
.
push_back
(
e
);
em
.
mark
(
e
);
}
REAL
b
=
Geom
::
angle
(
centerNormal
,
this
->
normal
[
g
]);
if
(
!
fm
.
isMarked
(
e
)
&&
b
<
angleThreshold
)
{
this
->
insideFaces
.
push_back
(
e
);
fm
.
mark
(
e
);
}
}
}
e
=
this
->
map
.
phi2_1
(
e
);
}
while
(
e
!=
end
);
++
i
;
}
}
template
<
typename
PFP
>
void
Collector_NormalAngle
<
PFP
>::
collectBorder
(
Dart
d
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
this
->
init
(
d
);
this
->
border
.
reserve
(
128
);
this
->
insideVertices
.
reserve
(
128
);
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
);
// mark the collected inside-edges + border-edges
this
->
insideVertices
.
push_back
(
this
->
centerDart
);
vm
.
mark
(
this
->
centerDart
);
VEC3
centerNormal
=
this
->
normal
[
d
];
unsigned
int
i
=
0
;
while
(
i
<
this
->
insideVertices
.
size
())
{
Dart
end
=
this
->
insideVertices
[
i
];
Dart
e
=
end
;
do
{
if
(
!
em
.
isMarked
(
e
)
)
{
const
Dart
f
=
this
->
map
.
phi1
(
e
);
REAL
a
=
Geom
::
angle
(
centerNormal
,
this
->
normal
[
f
]);
if
(
a
>
angleThreshold
)
{
this
->
border
.
push_back
(
e
);
// add to border
}
else
{
if
(
!
vm
.
isMarked
(
f
))
{
this
->
insideVertices
.
push_back
(
f
);
vm
.
mark
(
f
);
}
}
em
.
mark
(
e
);
}
e
=
this
->
map
.
phi2_1
(
e
);
}
while
(
e
!=
end
);
++
i
;
}
this
->
insideVertices
.
clear
();
}
}
// namespace Selection
}
// namespace Algo
...
...
include/Topology/generic/traversor2.hpp
View file @
9c4f8a7c
...
...
@@ -166,8 +166,12 @@ Dart Traversor2VVaF<MAP>::next()
{
Dart
d
=
m
.
phi2
(
m
.
phi_1
(
current
))
;
if
(
m
.
isBoundaryMarked
(
d
))
// jump over a boundary face
{
d
=
m
.
phi2
(
m
.
phi_1
(
d
))
;
current
=
m
.
phi1
(
m
.
phi1
(
d
))
;
current
=
m
.
phi1
(
d
);
}
else
current
=
m
.
phi1
(
m
.
phi1
(
d
))
;
if
(
current
==
d
)
current
=
m
.
phi1
(
d
)
;
stop
=
d
;
...
...
include/Utils/GLSLShader.h
View file @
9c4f8a7c
...
...
@@ -288,7 +288,6 @@ public:
virtual
void
updateClippingUniforms
()
{
CGoGNerr
<<
"Warning updateClippingUniforms not implemented"
<<
CGoGNendl
;}
/**
*
*/
...
...
@@ -341,7 +340,6 @@ public:
*/
void
addPathFileSeach
(
const
std
::
string
&
path
);
/**
* remove VBO index from binding
*/
...
...
@@ -374,7 +372,7 @@ public:
* bind, enable, and set all vertex attrib pointers
* @param stride: the stride parameter, number osf byte between two consecutive attributes
*/
void
enableVertexAttribs
(
unsigned
int
stride
=
0
,
unsigned
int
begin
=
0
)
const
;
void
enableVertexAttribs
(
unsigned
int
stride
=
0
,
unsigned
int
begin
=
0
)
const
;
/**
* disenable all vertex attribs
...
...
@@ -394,8 +392,6 @@ public:
static
void
pushTransfo
()
{
s_current_matrices
->
pushTransfo
();}
/// pop transformation matrix
static
void
popTransfo
()
{
s_current_matrices
->
popTransfo
();}
};
...
...
include/Utils/pointSprite.h
View file @
9c4f8a7c
...
...
@@ -32,6 +32,7 @@ namespace CGoGN { namespace Utils { class VBO; } }
namespace
CGoGN
{
namespace
Utils
{
...
...
@@ -63,7 +64,7 @@ public:
/**
* init shaders, texture and variables
*/
PointSprite
(
float
radius
=
1.0
f
);
PointSprite
(
float
radius
=
1.0
f
);
/**
* clean shaders, texture and variables
...
...
@@ -90,9 +91,10 @@ public:
* set position attribute
*/
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
};
}
// namespace Utils
}
// namespace CGoGN
};
}
}
#endif
include/Utils/vbo.h
View file @
9c4f8a7c
...
...
@@ -92,12 +92,12 @@ public:
/**
* get nb element in vbo (vertices, colors ...)
*/
unsigned
int
nbElts
()
{
return
m_nbElts
;}
unsigned
int
nbElts
()
{
return
m_nbElts
;
}
/**
* bind array vbo
*/
void
bind
()
const
{
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_id
);
}
void
bind
()
const
{
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_id
);
}
/**
* alloc buffer of same size than parameter
...
...
@@ -116,6 +116,12 @@ public:
template
<
typename
ATTR_HANDLER
>
void
updateData
(
const
ATTR_HANDLER
&
attrib
,
ConvertAttrib
*
conv
);
/**
* update data from given data vector
*/
template
<
typename
T
>
void
updateData
(
std
::
vector
<
T
>&
data
);
void
*
lockPtr
();
const
void
*
lockPtr
()
const
;
...
...
@@ -124,8 +130,6 @@ public:
void
copyData
(
void
*
ptr
)
const
;
void
allocate
(
unsigned
int
nbElts
);
};
...
...
include/Utils/vbo.hpp
View file @
9c4f8a7c
...
...
@@ -33,7 +33,7 @@ void VBO::updateData(const ATTR_HANDLER& attrib)
{
if
(
m_lock
)
{
CGoGNerr
<<
"
Error locked VBO"
<<
CGoGNendl
;
CGoGNerr
<<
"
Error locked VBO"
<<
CGoGNendl
;
return
;
}
m_data_size
=
sizeof
(
typename
ATTR_HANDLER
::
DATA_TYPE
)
/
sizeof
(
float
);
...
...
@@ -62,7 +62,7 @@ void VBO::updateData(const ATTR_HANDLER& attrib, ConvertAttrib* conv)
{
if
(
m_lock
)
{
CGoGNerr
<<
"
Error locked VBO"
<<
CGoGNendl
;
CGoGNerr
<<
"
Error locked VBO"
<<
CGoGNendl
;
return
;
}
m_data_size
=
conv
->
sizeElt
();
...
...
@@ -97,6 +97,21 @@ void VBO::updateData(const ATTR_HANDLER& attrib, ConvertAttrib* conv)
conv
->
release
();
}
template
<
typename
T
>
void
VBO
::
updateData
(
std
::
vector
<
T
>&
data
)
{
if
(
m_lock
)
{
CGoGNerr
<<
"Error locked VBO"
<<
CGoGNendl
;
return
;
}
m_data_size
=
sizeof
(
T
)
/
sizeof
(
float
);
m_nbElts
=
data
.
size
();
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_id
);
glBufferData
(
GL_ARRAY_BUFFER
,
m_nbElts
*
sizeof
(
T
),
&
(
data
[
0
]),
GL_STREAM_DRAW
);
}
}
// namespace Utils
}
// namespace CGoGN
include/Utils/vboRender.h
0 → 100644
View file @
9c4f8a7c
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef _VBO_RENDER_
#define _VBO_RENDER_
#include
<GL/glew.h>
namespace
CGoGN
{
namespace
Utils
{
// forward definition
class
GLSLShader
;