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
OpenFlipper-Free
OpenFlipper-Free
Commits
ef240480
Commit
ef240480
authored
Oct 25, 2016
by
Hans-Christian Ebke
Browse files
Merge remote-tracking branch 'remotes/origin/master'
parents
8fc676a5
35ec798f
Changes
94
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
ef240480
...
...
@@ -17,3 +17,31 @@ cppcheck:
artifacts
:
paths
:
-
cppcheck.log
VS2015-Qt-5.6.0-x64
:
script
:
"
CI
\\
VS2015-Qt-5.6.0-x64.bat"
tags
:
-
VS2015
-
Qt56
artifacts
:
paths
:
-
rel/*.exe
VS2015-Qt-5.6.0-x32
:
script
:
"
CI
\\
VS2015-Qt-5.6.0-x32.bat"
tags
:
-
VS2015
-
Qt56
artifacts
:
paths
:
-
rel/*.exe
VS2013-Qt-5.5.1-x64
:
script
:
"
CI
\\
VS2013-Qt-5.5.1-x64.bat"
tags
:
-
VS2013
-
Qt551
artifacts
:
paths
:
-
rel/*.exe
ACG/CMakeLists.txt
View file @
ef240480
...
...
@@ -8,21 +8,10 @@ if ( ${PROJECT_NAME} MATCHES "OpenFlipper")
endif
()
if
(
NOT FORCE_QT4
)
# try to use QT5 if possible otherwise stick to QT4
acg_qt5
()
else
()
set
(
QT_MAX_VERSION 4.9.9
)
set
(
QT5_FOUND false
)
endif
()
acg_qt5
()
if
(
NOT QT5_FOUND
)
message
(
STATUS
"Using QT4 for ACG"
)
acg_qt4
(
REQUIRED 4.5
)
else
()
message
(
STATUS
"Using QT5 for ACG"
)
message
(
FATAL ERROR
"Qt5 not found"
)
endif
()
acg_openmp
()
...
...
@@ -66,7 +55,7 @@ if (QJSON_FOUND)
endif
()
# use Qwt6 for QT5
if
(
NOT FORCE_QT4 AND
QT5_FOUND
)
if
(
QT5_FOUND
)
find_package
(
Qwt6
)
if
(
QWT6_FOUND
)
...
...
@@ -74,14 +63,7 @@ if (NOT FORCE_QT4 AND QT5_FOUND)
set
(
ADDITIONAL_LINK_LIBRARIES
${
ADDITIONAL_LINK_LIBRARIES
}
${
QWT6_LIBRARIES
}
)
set
(
ADDITIONAL_BUILD_DIRS
"QwtWidgets"
)
endif
()
else
()
find_package
(
Qwt5
)
if
(
Qwt5_Qt4_FOUND
)
set
(
INCLUDE_DIRS
${
INCLUDE_DIRS
}
${
Qwt5_INCLUDE_DIR
}
)
set
(
ADDITIONAL_LINK_LIBRARIES
${
ADDITIONAL_LINK_LIBRARIES
}
${
Qwt5_Qt4_LIBRARY
}
)
set
(
ADDITIONAL_BUILD_DIRS
"QwtWidgets"
)
endif
()
endif
()
include_directories
(
...
...
@@ -135,18 +117,13 @@ if (QT5_FOUND)
acg_qt5_autouic
(
uic_targets
${
ui
}
)
acg_qt5_automoc
(
moc_targets
${
headers
}
)
acg_qt5_autoqrc
(
qrc_targets
${
qrc
}
)
elseif
(
QT4_FOUND
)
acg_qt4_autouic
(
uic_targets
${
ui
}
)
acg_qt4_automoc
(
moc_targets
${
headers
}
)
acg_qt4_autoqrc
(
qrc_targets
${
qrc
}
)
endif
()
if
(
QT5_FOUND
)
acg_add_library
(
ACG SHARED
${
uic_targets
}
${
sources
}
${
headers
}
${
moc_targets
}
${
qrc_targets
}
)
elseif
(
QT4_FOUND
)
acg_add_library
(
ACG SHARED
${
uic_targets
}
${
sources
}
${
headers
}
${
moc_targets
}
${
qrc_targets
}
)
endif
()
if
(
NOT WIN32
)
set_target_properties
(
ACG PROPERTIES VERSION
${
ACG_VERSION_MAJOR
}
.
${
ACG_VERSION_MINOR
}
SOVERSION
${
ACG_VERSION_MAJOR
}
.
${
ACG_VERSION_MINOR
}
)
...
...
ACG/GL/ColorStack.cc
View file @
ef240480
...
...
@@ -103,7 +103,7 @@ void ColorStack::initialize ()
//----------------------------------------------------------------------------
bool
ColorStack
::
setMaximumIndex
(
unsigned
in
t
_idx
)
bool
ColorStack
::
setMaximumIndex
(
size_
t
_idx
)
{
if
(
initialized_
)
{
...
...
@@ -117,7 +117,7 @@ bool ColorStack::setMaximumIndex (unsigned int _idx)
//----------------------------------------------------------------------------
void
ColorStack
::
setIndex
(
unsigned
in
t
_idx
)
void
ColorStack
::
setIndex
(
size_
t
_idx
)
{
if
(
initialized_
)
{
...
...
@@ -128,7 +128,7 @@ void ColorStack::setIndex (unsigned int _idx)
//----------------------------------------------------------------------------
Vec4uc
ColorStack
::
getIndexColor
(
unsigned
in
t
_idx
)
Vec4uc
ColorStack
::
getIndexColor
(
size_
t
_idx
)
{
if
(
initialized_
)
{
...
...
@@ -144,7 +144,7 @@ Vec4uc ColorStack::getIndexColor (unsigned int _idx)
//----------------------------------------------------------------------------
void
ColorStack
::
pushIndex
(
unsigned
in
t
_idx
)
void
ColorStack
::
pushIndex
(
size_
t
_idx
)
{
if
(
initialized_
)
currentNode_
=
currentNode_
->
pushIndex
(
_idx
);
...
...
@@ -160,12 +160,12 @@ void ColorStack::popIndex ()
//----------------------------------------------------------------------------
std
::
vector
<
unsigned
in
t
>
ColorStack
::
colorToStack
(
Vec4uc
_rgba
)
const
std
::
vector
<
size_
t
>
ColorStack
::
colorToStack
(
Vec4uc
_rgba
)
const
{
std
::
vector
<
unsigned
in
t
>
rv
(
0
);
std
::
vector
<
size_
t
>
rv
(
0
);
if
(
initialized_
&&
!
error_
)
{
unsigned
in
t
idx
=
translator_
.
color2index
(
_rgba
);
const
size_
t
idx
=
translator_
.
color2index
(
_rgba
);
if
(
idx
>=
root_
->
startIndex
()
&&
idx
<
root_
->
endIndex
())
root_
->
colorToStack
(
rv
,
idx
);
}
...
...
@@ -174,7 +174,7 @@ std::vector<unsigned int> ColorStack::colorToStack (Vec4uc _rgba) const
//----------------------------------------------------------------------------
unsigned
in
t
ColorStack
::
freeIndicies
()
const
size_
t
ColorStack
::
freeIndicies
()
const
{
if
(
initialized_
)
{
...
...
@@ -186,7 +186,7 @@ unsigned int ColorStack::freeIndicies() const
//----------------------------------------------------------------------------
unsigned
in
t
ColorStack
::
currentIndex
()
const
size_
t
ColorStack
::
currentIndex
()
const
{
if
(
initialized_
)
{
...
...
@@ -198,7 +198,7 @@ unsigned int ColorStack::currentIndex () const
//----------------------------------------------------------------------------
ColorStack
::
Node
::
Node
(
unsigned
in
t
_idx
,
Node
*
_parent
,
ColorTranslator
*
_ct
)
:
ColorStack
::
Node
::
Node
(
size_
t
_idx
,
Node
*
_parent
,
ColorTranslator
*
_ct
)
:
parent_
(
_parent
),
index_
(
_idx
),
translator_
(
_ct
),
...
...
@@ -221,7 +221,7 @@ ColorStack::Node::~Node ()
//----------------------------------------------------------------------------
bool
ColorStack
::
Node
::
setMaximumIndex
(
unsigned
in
t
_idx
)
bool
ColorStack
::
Node
::
setMaximumIndex
(
size_
t
_idx
)
{
if
(
_idx
==
0
)
_idx
=
1
;
...
...
@@ -237,7 +237,7 @@ bool ColorStack::Node::setMaximumIndex (unsigned int _idx)
//----------------------------------------------------------------------------
bool
ColorStack
::
Node
::
setIndex
(
unsigned
in
t
_idx
)
const
bool
ColorStack
::
Node
::
setIndex
(
size_
t
_idx
)
const
{
if
(
colorStartIdx_
&&
colorStartIdx_
+
_idx
<
colorEndIdx_
)
{
...
...
@@ -249,7 +249,7 @@ bool ColorStack::Node::setIndex (unsigned int _idx) const
//----------------------------------------------------------------------------
bool
ColorStack
::
Node
::
getIndexColor
(
unsigned
in
t
_idx
,
Vec4uc
&
_rgba
)
const
bool
ColorStack
::
Node
::
getIndexColor
(
size_
t
_idx
,
Vec4uc
&
_rgba
)
const
{
if
(
colorStartIdx_
&&
colorStartIdx_
+
_idx
<
colorEndIdx_
)
{
...
...
@@ -261,7 +261,7 @@ bool ColorStack::Node::getIndexColor (unsigned int _idx, Vec4uc &_rgba) const
//----------------------------------------------------------------------------
ColorStack
::
Node
*
ColorStack
::
Node
::
pushIndex
(
unsigned
in
t
_idx
)
ColorStack
::
Node
*
ColorStack
::
Node
::
pushIndex
(
size_
t
_idx
)
{
ColorStack
::
Node
*
n
=
new
ColorStack
::
Node
(
_idx
,
this
,
translator_
);
nodes_
.
push_back
(
n
);
...
...
@@ -278,7 +278,7 @@ ColorStack::Node * ColorStack::Node::popIndex ()
//----------------------------------------------------------------------------
void
ColorStack
::
Node
::
colorToStack
(
std
::
vector
<
unsigned
in
t
>
&
_stack
,
unsigned
in
t
_index
)
void
ColorStack
::
Node
::
colorToStack
(
std
::
vector
<
size_
t
>
&
_stack
,
size_
t
_index
)
{
if
(
_index
>=
colorStartIdx_
&&
_index
<
colorEndIdx_
)
{
...
...
ACG/GL/ColorStack.hh
View file @
ef240480
...
...
@@ -95,31 +95,31 @@ public:
bool
initialized
()
const
{
return
initialized_
;
}
/// sets the maximum index number used in current node
bool
setMaximumIndex
(
unsigned
in
t
_idx
);
bool
setMaximumIndex
(
size_
t
_idx
);
/// sets the current color the given index (like glLoadName)
void
setIndex
(
unsigned
in
t
_idx
);
void
setIndex
(
size_
t
_idx
);
/// gets the color instead of setting it directly
Vec4uc
getIndexColor
(
unsigned
in
t
_idx
);
Vec4uc
getIndexColor
(
size_
t
_idx
);
/// creates a new node the stack (like glPushName)
void
pushIndex
(
unsigned
in
t
_idx
);
void
pushIndex
(
size_
t
_idx
);
/// pops the current node from the stack (like glPopName)
void
popIndex
();
/// converts the given color to index values on the stack
std
::
vector
<
unsigned
in
t
>
colorToStack
(
Vec4uc
_rgba
)
const
;
std
::
vector
<
size_
t
>
colorToStack
(
Vec4uc
_rgba
)
const
;
/// returns maximal available index count
unsigned
in
t
freeIndicies
()
const
;
size_
t
freeIndicies
()
const
;
/// Did an error occur during picking
bool
error
()
const
{
return
error_
&&
initialized_
;
};
/// returns the current color index
unsigned
in
t
currentIndex
()
const
;
size_
t
currentIndex
()
const
;
private:
...
...
@@ -127,40 +127,40 @@ private:
class
Node
{
public:
Node
(
unsigned
in
t
_idx
,
Node
*
_parent
,
ColorTranslator
*
_ct
);
Node
(
size_
t
_idx
,
Node
*
_parent
,
ColorTranslator
*
_ct
);
~
Node
();
/// sets the maximum index number used in current node
bool
setMaximumIndex
(
unsigned
in
t
_idx
);
bool
setMaximumIndex
(
size_
t
_idx
);
/// sets the current color the given index (like glLoadName)
bool
setIndex
(
unsigned
in
t
_idx
)
const
;
bool
setIndex
(
size_
t
_idx
)
const
;
/// gets the color instead of setting it directly
bool
getIndexColor
(
unsigned
in
t
_idx
,
Vec4uc
&
_rgba
)
const
;
bool
getIndexColor
(
size_
t
_idx
,
Vec4uc
&
_rgba
)
const
;
/// creates a new node the stack (like glPushName)
Node
*
pushIndex
(
unsigned
in
t
_idx
);
Node
*
pushIndex
(
size_
t
_idx
);
/// pops the current node from the stack (like glPopName)
Node
*
popIndex
();
void
colorToStack
(
std
::
vector
<
unsigned
in
t
>
&
_stack
,
unsigned
int
_index
);
void
colorToStack
(
std
::
vector
<
size_
t
>
&
_stack
,
size_t
size_t
);
unsigned
in
t
startIndex
()
{
return
startIdx_
;
};
unsigned
in
t
endIndex
()
{
return
endIdx_
;
};
unsigned
in
t
colorIndex
()
{
return
colorStartIdx_
;
};
size_
t
startIndex
()
const
{
return
startIdx_
;
};
size_
t
endIndex
()
const
{
return
endIdx_
;
};
size_
t
colorIndex
()
const
{
return
colorStartIdx_
;
};
private:
Node
*
parent_
;
unsigned
int
index_
;
size_t
index_
;
ColorTranslator
*
translator_
;
std
::
vector
<
Node
*>
nodes_
;
unsigned
in
t
startIdx_
;
unsigned
in
t
endIdx_
;
unsigned
in
t
colorStartIdx_
;
unsigned
in
t
colorEndIdx_
;
size_
t
startIdx_
;
size_
t
endIdx_
;
size_
t
colorStartIdx_
;
size_
t
colorEndIdx_
;
};
...
...
ACG/GL/ColorTranslator.cc
View file @
ef240480
...
...
@@ -61,6 +61,7 @@
#include
"ColorTranslator.hh"
#include
<iostream>
#include
<limits>
//== NAMESPACES ===============================================================
...
...
@@ -81,21 +82,25 @@ initialize()
glGetIntegerv
(
GL_BLUE_BITS
,
&
blue_bits_
);
glGetIntegerv
(
GL_ALPHA_BITS
,
&
alpha_bits_
);
// We currently only support up to 8 bits per channel (
if
(
red_bits_
>
8
)
red_bits_
=
8
;
if
(
green_bits_
>
8
)
green_bits_
=
8
;
if
(
blue_bits_
>
8
)
blue_bits_
=
8
;
if
(
alpha_bits_
>
8
)
alpha_bits_
=
8
;
// Compute the mask to extract the component
red_mask_
=
((
1
<<
red_bits_
)
-
1
);
green_mask_
=
((
1
<<
green_bits_
)
-
1
);
blue_mask_
=
((
1
<<
blue_bits_
)
-
1
);
alpha_mask_
=
((
1
<<
alpha_bits_
)
-
1
);
// Shift required to move the component to the lowest bits
red_shift_
=
8
-
red_bits_
;
green_shift_
=
8
-
green_bits_
;
blue_shift_
=
8
-
blue_bits_
;
alpha_shift_
=
8
-
alpha_bits_
;
red_round_
=
1
<<
(
red_shift_
-
1
);
green_round_
=
1
<<
(
green_shift_
-
1
);
blue_round_
=
1
<<
(
blue_shift_
-
1
);
...
...
@@ -110,12 +115,19 @@ initialize()
Vec4uc
ColorTranslator
::
index2color
(
unsigned
in
t
_idx
)
const
index2color
(
const
size_
t
_idx
)
const
{
assert
(
initialized
());
unsigned
char
r
,
g
,
b
,
a
;
unsigned
int
idx
(
_idx
+
1
);
// Make sure that the number fits
if
(
_idx
>
std
::
numeric_limits
<
unsigned
int
>::
max
()
)
{
std
::
cerr
<<
"Can't convert index "
<<
_idx
<<
" to RGBA. Number too large for unsigned int
\n
"
;
return
Vec4uc
(
0
,
0
,
0
,
0
);
}
unsigned
int
idx
=
(
static_cast
<
unsigned
int
>
(
_idx
)
+
1
);
b
=
((
idx
&
blue_mask_
)
<<
blue_shift_
)
|
blue_round_
;
idx
>>=
blue_bits_
;
g
=
((
idx
&
green_mask_
)
<<
green_shift_
)
|
green_round_
;
...
...
@@ -139,13 +151,18 @@ index2color(unsigned int _idx) const
//-----------------------------------------------------------------------------
in
t
size_
t
ColorTranslator
::
color2index
(
Vec4uc
_rgba
)
const
color2index
(
const
Vec4uc
_rgba
)
const
{
assert
(
initialized
());
// Work internally with#include <iostream> unsigned int for now
unsigned
int
result
;
// Combine the single unsigned chars according to masks
result
=
_rgba
[
3
]
>>
alpha_shift_
;
result
<<=
red_bits_
;
result
=
_rgba
[
0
]
>>
red_shift_
;
...
...
@@ -154,14 +171,15 @@ color2index(Vec4uc _rgba) const
result
<<=
blue_bits_
;
result
|=
_rgba
[
2
]
>>
blue_shift_
;
return
(
result
-
1
);
// Return size_t Here
return
(
static_cast
<
size_t
>
(
result
-
1
)
);
}
//-----------------------------------------------------------------------------
unsigned
in
t
size_
t
ColorTranslator
::
max_index
()
const
{
assert
(
initialized
());
...
...
ACG/GL/ColorTranslator.hh
View file @
ef240480
...
...
@@ -95,20 +95,23 @@ public:
~
ColorTranslator
()
{};
/// init (takes current GL context)
/// init (takes current GL context to get the component sizes)
/// Can't use constructor as we might not have a context at this point.
void
initialize
();
/// has it been initialized?
bool
initialized
()
const
{
return
initialized_
;
}
/// index -> color (one buffer)
Vec4uc
index2color
(
unsigned
int
_idx
)
const
;
Vec4uc
index2color
(
const
size_t
_idx
)
const
;
/// color -> index (one buffer)
in
t
color2index
(
Vec4uc
_rgba
)
const
;
size_
t
color2index
(
const
Vec4uc
_rgba
)
const
;
/// returns maximal convert
a
ble index
unsigned
in
t
max_index
()
const
;
/// returns maximal convert
i
ble index
size_
t
max_index
()
const
;
private:
...
...
ACG/GL/DrawMesh.hh
View file @
ef240480
...
...
@@ -105,8 +105,8 @@ class ACGDLLEXPORT DrawMeshBase {
void
fillInvVertexMap
(
size_t
n_vertices
,
void
*
data
);
public:
unsigned
in
t
getNumTris
()
const
{
return
numTris_
;
}
unsigned
in
t
getNumVerts
()
const
{
return
numVerts_
;
}
size_
t
getNumTris
()
const
{
return
numTris_
;
}
size_
t
getNumVerts
()
const
{
return
numVerts_
;
}
/** \brief get mesh compiler used to create the draw mesh
*/
...
...
@@ -385,22 +385,22 @@ private:
* @param _hh corresponding halfedge handle of this vertex
* @param _fh corresponding face handle of this vertex
*/
void
readVertex
(
unsigned
int
_vertex
,
const
typename
Mesh
::
VertexHandle
_vh
,
const
typename
Mesh
::
HalfedgeHandle
_hh
,
const
typename
Mesh
::
FaceHandle
_fh
);
void
readVertex
(
size_t
_vertex
,
const
typename
Mesh
::
VertexHandle
&
_vh
,
const
typename
Mesh
::
HalfedgeHandle
&
_hh
,
const
typename
Mesh
::
FaceHandle
&
_fh
);
/** \brief return a vertex color from mesh
*
* @param _vh mesh vertex handle
*/
unsigned
int
getVertexColor
(
const
typename
Mesh
::
VertexHandle
_vh
);
unsigned
int
getVertexColor
(
const
typename
Mesh
::
VertexHandle
&
_vh
);
/** \brief return a face color from mesh
*
* @param _fh mesh face handle
*/
unsigned
int
getFaceColor
(
const
typename
Mesh
::
FaceHandle
_fh
);
unsigned
int
getFaceColor
(
const
typename
Mesh
::
FaceHandle
&
_fh
);
/** \brief eventually update vertex and index buffers
*
...
...
@@ -474,7 +474,7 @@ public:
* @param _mvp model view projection transformation
* @param _pickOffset base picking id of the first vertex
*/
void
drawPickingVertices_opt
(
const
GLMatrixf
&
_mvp
,
in
t
_pickOffset
);
void
drawPickingVertices_opt
(
const
GLMatrixf
&
_mvp
,
size_
t
_pickOffset
);
/** \brief Check if optimized vertex picking is supported
...
...
@@ -559,7 +559,7 @@ public:
* @param _mvp model view projection transformation
* @param _pickOffset base picking id of the first edge
*/
void
drawPickingEdges_opt
(
const
GLMatrixf
&
_mvp
,
in
t
_pickOffset
);
void
drawPickingEdges_opt
(
const
GLMatrixf
&
_mvp
,
size_
t
_pickOffset
);
/** \brief Check if optimized face picking is supported
...
...
@@ -628,7 +628,7 @@ public:
* @param _mvp model view projection transformation
* @param _pickOffset base picking id of the first face
*/
void
drawPickingFaces_opt
(
const
GLMatrixf
&
_mvp
,
in
t
_pickOffset
);
void
drawPickingFaces_opt
(
const
GLMatrixf
&
_mvp
,
size_
t
_pickOffset
);
/** \brief Check if optimized face picking is supported
...
...
@@ -734,7 +734,7 @@ public:
* @param _mvp model view projection transformation
* @param _pickOffset base picking id of the first element
*/
void
drawPickingAny_opt
(
const
GLMatrixf
&
_mvp
,
in
t
_pickOffset
);
void
drawPickingAny_opt
(
const
GLMatrixf
&
_mvp
,
size_
t
_pickOffset
);
/** \brief Check if optimized any picking is supported
*
...
...
@@ -929,19 +929,19 @@ private:
//========================================================================
// write functions for flexible vertex format
void
writeVertexElement
(
void
*
_dstBuf
,
unsigned
int
_vertex
,
unsigned
int
_stride
,
unsigned
in
t
_elementOffset
,
unsigned
in
t
_elementSize
,
const
void
*
_elementData
);
void
writeVertexElement
(
void
*
_dstBuf
,
size_t
_vertex
,
size_t
_stride
,
size_
t
_elementOffset
,
size_
t
_elementSize
,
const
void
*
_elementData
);
void
writePosition
(
unsigned
in
t
_vertex
,
const
ACG
::
Vec3d
&
_p
);
void
writePosition
(
size_
t
_vertex
,
const
ACG
::
Vec3d
&
_p
);
void
writeNormal
(
unsigned
in
t
_vertex
,
const
ACG
::
Vec3d
&
_n
);
void
writeNormal
(
size_
t
_vertex
,
const
ACG
::
Vec3d
&
_n
);
void
writeTexcoord
(
unsigned
in
t
_vertex
,
const
ACG
::
Vec2f
&
_uv
);
void
writeTexcoord
(
size_
t
_vertex
,
const
ACG
::
Vec2f
&
_uv
);
void
writeColor
(
unsigned
in
t
_vertex
,
unsigned
int
_color
);
void
writeColor
(
size_
t
_vertex
,
unsigned
int
_color
);
void
writeVertexProperty
(
unsigned
in
t
_vertex
,
const
VertexElement
*
_elementDesc
,
const
ACG
::
Vec4f
&
_propf
);
void
writeVertexProperty
(
size_
t
_vertex
,
const
VertexElement
*
_elementDesc
,
const
ACG
::
Vec4f
&
_propf
);
void
writeVertexProperty
(
unsigned
in
t
_vertex
,
const
VertexElement
*
_elementDesc
,
const
ACG
::
Vec4d
&
_propd
);
void
writeVertexProperty
(
size_
t
_vertex
,
const
VertexElement
*
_elementDesc
,
const
ACG
::
Vec4d
&
_propd
);
/** \brief Read one vertex from the rendering vbo.
...
...
@@ -1103,7 +1103,7 @@ private:
return
normal
;
}
typename
Mesh
::
HalfedgeHandle
mapToHalfedgeHandle
(
in
t
_vertexId
);
typename
Mesh
::
HalfedgeHandle
mapToHalfedgeHandle
(
size_
t
_vertexId
);
};
...
...
ACG/GL/DrawMeshT.cc
View file @
ef240480
...
...
@@ -454,7 +454,7 @@ DrawMeshT<Mesh>::rebuild()
// read all vertices
for
(
size_t
i
=
0
;
i
<
numVerts_
;
++
i
)
readVertex
(
i
,
mesh_
.
vertex_handle
(
i
),
mesh_
.
vertex_handle
(
static_cast
<
unsigned
int
>
(
i
)
),
(
typename
Mesh
::
HalfedgeHandle
)(
-
1
),
(
typename
Mesh
::
FaceHandle
)(
-
1
));
...
...
@@ -513,7 +513,7 @@ DrawMeshT<Mesh>::rebuild()
#pragma omp parallel for
#endif
#endif
for
(
unsigned
in
t
i
=
0
;
i
<
numVerts_
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
numVerts_
;
++
i
)
{
// just pick one face, srews up face colors here so color updates need a full rebuild
const
typename
Mesh
::
HalfedgeHandle
hh
=
mapToHalfedgeHandle
(
i
);
...
...
@@ -626,7 +626,7 @@ DrawMeshT<Mesh>::rebuild()
if
(
baseProp
)
{
in
t
numAttribs
=
baseProp
->
n_elements
();
size_
t
numAttribs
=
baseProp
->
n_elements
();
const
void
*
attribData
=
propDesc
->
propDataPtr_
;
meshComp_
->
setAttribVec
(
propDesc
->
declElementID_
,
numAttribs
,
attribData
);
...
...
@@ -752,10 +752,10 @@ DrawMeshT<Mesh>::rebuild()
template
<
class
Mesh
>
void
DrawMeshT
<
Mesh
>::
readVertex
(
unsigned
in
t
_vertex
,
const
typename
Mesh
::
VertexHandle
_vh
,
const
typename
Mesh
::
HalfedgeHandle
_hh
,
const
typename
Mesh
::
FaceHandle
_fh
)
DrawMeshT
<
Mesh
>::
readVertex
(
size_
t
_vertex
,
const
typename
Mesh
::
VertexHandle
&
_vh
,
const
typename
Mesh
::
HalfedgeHandle
&
_hh
,
const
typename
Mesh
::
FaceHandle
&
_fh
)
{
static
const
typename
Mesh
::
HalfedgeHandle
invalidHEH
(
-
1
);
static
const
typename
Mesh
::
FaceHandle
invalidFH
(
-
1
);
...
...
@@ -831,7 +831,7 @@ DrawMeshT<Mesh>::readVertex(unsigned int _vertex,
template
<
class
Mesh
>
unsigned
int
DrawMeshT
<
Mesh
>::
getVertexColor
(
const
typename
Mesh
::
VertexHandle
_vh
)
DrawMeshT
<
Mesh
>::
getVertexColor
(
const
typename
Mesh
::
VertexHandle
&
_vh
)
{
static
const
typename
Mesh
::
VertexHandle
invalidVH
(
-
1
);
...
...
@@ -853,7 +853,7 @@ DrawMeshT<Mesh>::getVertexColor(const typename Mesh::VertexHandle _vh)
template
<
class
Mesh
>
unsigned
int
DrawMeshT
<
Mesh
>::
getFaceColor
(
const
typename
Mesh
::
FaceHandle
_fh
)
DrawMeshT
<
Mesh
>::
getFaceColor
(
const
typename
Mesh
::
FaceHandle
&
_fh
)
{
static
const
typename
Mesh
::
FaceHandle
invalidFH
(
-
1
);
...
...
@@ -1389,18 +1389,18 @@ void DrawMeshT<Mesh>::draw(std::map< int, GLuint>* _textureMap, bool _nonindexed
ACG
::
GLState
::
bindTexture
(
GL_TEXTURE_2D
,
(
*
_textureMap
)[
sub
->
id
]);
if
(
!
_nonindexed
)
glDrawElements
(
GL_TRIANGLES
,
sub
->
numTris
*
3
,
indexType_
,
glDrawElements
(
GL_TRIANGLES
,
static_cast
<
GLsizei
>
(
sub
->
numTris
*
3
)
,
indexType_
,
(
GLvoid
*
)(
(
size_t
)
sub
->
startIndex
*
(
indexType_
==
GL_UNSIGNED_INT
?
4
:
2
)));
// offset in bytes
else
glDrawArrays
(
GL_TRIANGLES
,
sub
->
startIndex
,
sub
->
numTris
*
3
);
glDrawArrays
(
GL_TRIANGLES
,
sub
->
startIndex
,
static_cast
<
GLsizei
>
(
sub
->
numTris
*
3
)
)
;
}
}
else
{
if
(
!
_nonindexed
)
glDrawElements
(
GL_TRIANGLES
,
numTris_
*
3
,
indexType_
,
0
);