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
Sauvage
CGoGN
Commits
e8aa0a38
Commit
e8aa0a38
authored
Jun 06, 2012
by
Kenneth Vanhoey
Browse files
merged with CGoGN
parents
c4a630cd
70500ef4
Changes
246
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/clipping.cpp
View file @
e8aa0a38
...
...
@@ -726,8 +726,6 @@ void Clipping::initGUI()
m_planeDrawable
->
getPrecisionDrawing
(
planesPrecision1
,
planesPrecision2
);
dock
.
spinBox_GridResolution
->
setValue
(
planesPrecision1
);
setCallBack
(
dock
.
pushButton_addSphere
,
SIGNAL
(
clicked
()),
SLOT
(
slot_pushButton_addSphere
()));
setCallBack
(
dock
.
spinBox_SphereResolution
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slot_spinBox_SphereResolution
(
int
)));
...
...
@@ -737,8 +735,6 @@ void Clipping::initGUI()
m_sphereDrawable
->
getPrecisionDrawing
(
spheresPrecision1
,
spheresPrecision2
);
dock
.
spinBox_SphereResolution
->
setValue
(
spheresPrecision1
);
setCallBack
(
dock
.
doubleSpinBox_ColorAttenuationFactor
,
SIGNAL
(
valueChanged
(
double
)),
SLOT
(
slot_doubleSpinBox_ColorAttenuationFactor
(
double
)));
setCallBack
(
dock
.
radioButton_ClippingModeAnd
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_radioButton_ClippingMode
(
bool
)));
setCallBack
(
dock
.
radioButton_ColorAttenuationModeLinear
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_radioButton_ColorAttenuationMode
(
bool
)));
...
...
@@ -755,7 +751,6 @@ void Clipping::initGUI()
else
if
(
colorAttMode
==
Utils
::
ClippingShader
::
COLOR_ATTENUATION_MODE_QUADRATIC
)
dock
.
radioButton_ColorAttenuationModeQuadratic
->
setChecked
(
true
);
setCallBack
(
dock
.
PushButton_ApplyStaticClippingPreset
,
SIGNAL
(
clicked
()),
SLOT
(
slot_pushButton_applyStaticClippingPreset
()));
dock
.
comboBox_StaticClippingPresets
->
addItem
(
"Dual Planes"
);
...
...
@@ -763,7 +758,6 @@ void Clipping::initGUI()
dock
.
comboBox_StaticClippingPresets
->
addItem
(
"Tube"
);
dock
.
comboBox_StaticClippingPresets
->
addItem
(
"Molecule"
);
setCallBack
(
dock
.
PushButton_ApplyAnimatedClippingPreset
,
SIGNAL
(
clicked
()),
SLOT
(
slot_pushButton_applyAnimatedClippingPreset
()));
dock
.
comboBox_AnimatedClippingPresets
->
addItem
(
"Moving Dual Planes"
);
...
...
@@ -777,7 +771,6 @@ void Clipping::initGUI()
// timer used for animation
m_timer
=
new
QTimer
(
this
);
setCallBack
(
m_timer
,
SIGNAL
(
timeout
()),
SLOT
(
slot_animationTimer
())
);
}
void
Clipping
::
cb_Open
()
...
...
@@ -804,7 +797,7 @@ void Clipping::importMesh(std::string& filename)
return
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
attrNames
[
0
])
;
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
else
if
(
extension
==
std
::
string
(
".ts"
))
{
...
...
@@ -814,7 +807,7 @@ void Clipping::importMesh(std::string& filename)
return
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
attrNames
[
0
])
;
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".map"
))
{
...
...
@@ -824,10 +817,9 @@ void Clipping::importMesh(std::string& filename)
return
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
)
;
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
)
;
}
updateVBOprimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
|
Algo
::
Render
::
GL2
::
LINES
|
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
],
allDarts
);
...
...
@@ -1125,12 +1117,12 @@ int main(int argc, char** argv)
if
(
argc
==
2
)
{
std
::
string
filename
(
argv
[
1
]);
sqt
.
importMesh
(
filename
);
std
::
string
filename
(
argv
[
1
]);
sqt
.
importMesh
(
filename
);
}
else
{
sqt
.
position
=
sqt
.
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
sqt
.
position
=
sqt
.
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
sqt
.
myMap
,
sqt
.
position
);
prim
.
hexaGrid_topo
(
10
,
10
,
10
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
...
...
Apps/Examples/clipping.h
View file @
e8aa0a38
...
...
@@ -28,11 +28,11 @@
#include
<iostream>
#include
"Utils/Qt/qtSimple.h"
#include
"Utils/qtInputs.h"
#include
"Utils/
Qt/
qtInputs.h"
#include
"ui_clipping.h"
// inclure qtui.h juste après le ui_xxx.h
#include
"Utils/qtui.h"
#include
"Utils/
Qt/
qtui.h"
#include
"Topology/generic/parameters.h"
#include
"Topology/map/embeddedMap3.h"
...
...
@@ -77,11 +77,11 @@ class Clipping: public Utils::QT::SimpleQT
public:
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
T
VEC3
T
VEC3
;
typedef
PFP
::
VEC3
VEC3
;
//Manip Carte
MAP
myMap
;
T
VEC3
position
;
VertexAttribute
<
VEC3
>
position
;
Dart
dglobal
;
//Render
...
...
Apps/Examples/concave_rendering.cpp
View file @
e8aa0a38
...
...
@@ -50,7 +50,6 @@ using namespace CGoGN ;
float
Ifont
[
74
*
2
]
=
{
0.145434
f
,
0.126469
f
,
0.141475
f
,
0.096252
f
,
0.133621
f
,
0.0730446
f
,
0.120846
f
,
0.0558913
f
,
0.0764256
f
,
0.0359233
f
,
0.0
f
,
0.028701
f
,
0.0
f
,
0.0215257
f
,
0.0
f
,
0.0143506
f
,
0.0
f
,
0.00717529
f
,
0.0
f
,
0.0
f
,
0.0560801
f
,
0.0
f
,
0.11216
f
,
0.0
f
,
0.16824
f
,
0.0
f
,
0.22432
f
,
0.0
f
,
0.2804
f
,
0.0
f
,
0.33648
f
,
0.0
f
,
0.39256
f
,
0.0
f
,
0.448641
f
,
0.0
f
,
0.448641
f
,
0.00717529
f
,
0.448641
f
,
0.0143506
f
,
0.448641
f
,
0.0215257
f
,
0.448641
f
,
0.028701
f
,
0.406716
f
,
0.0313208
f
,
0.373254
f
,
0.0363483
f
,
0.347367
f
,
0.0446329
f
,
0.328172
f
,
0.0570242
f
,
...
...
@@ -127,10 +126,13 @@ struct PFP: public PFP_STANDARD
typedef
EmbeddedMap2
MAP
;
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
// declaration of the map
PFP
::
MAP
myMap
;
MAP
myMap
;
// and attribute of position
Attribute
Handler
<
PFP
::
VEC3
>
position
;
Vertex
Attribute
<
VEC3
>
position
;
unsigned
int
nb_ears
;
...
...
@@ -241,8 +243,7 @@ void MyQT::cb_keyPress(int code)
int
main
(
int
argc
,
char
**
argv
)
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Dart
d0
=
myMap
.
newFace
(
12
);
position
[
d0
]
=
PFP
::
VEC3
(
0
,
20
,
0
);
...
...
@@ -267,8 +268,6 @@ int main(int argc, char **argv)
d0
=
myMap
.
phi1
(
d0
);
position
[
d0
]
=
PFP
::
VEC3
(
0
,
30
,
0
);
d0
=
myMap
.
newFace
(
4
);
position
[
d0
]
=
PFP
::
VEC3
(
-
5
,
14
,
-
5
);
d0
=
myMap
.
phi1
(
d0
);
...
...
@@ -279,8 +278,6 @@ int main(int argc, char **argv)
position
[
d0
]
=
PFP
::
VEC3
(
0
,
20
,
-
5
);
d0
=
myMap
.
phi1
(
d0
);
Dart
d1
=
myMap
.
newFace
(
10
);
position
[
d1
]
=
PFP
::
VEC3
(
0
,
0
,
0
);
...
...
@@ -307,7 +304,6 @@ int main(int argc, char **argv)
d1
=
myMap
.
phi1
(
d1
);
position
[
d1
]
=
PFP
::
VEC3
(
0
,
8
,
0
);
Dart
d2
=
myMap
.
newFace
(
12
);
position
[
d2
]
=
PFP
::
VEC3
(
0
,
-
20
,
0
);
...
...
@@ -335,8 +331,6 @@ int main(int argc, char **argv)
position
[
d2
]
=
PFP
::
VEC3
(
0
,
-
16
,
0
);
d2
=
myMap
.
phi1
(
d2
);
#define NB 32
//SPIRAL
...
...
@@ -361,7 +355,6 @@ int main(int argc, char **argv)
d3
=
myMap
.
phi1
(
d3
);
}
//CIRCLE
Dart
d6
=
myMap
.
newFace
(
NB
);
...
...
@@ -411,7 +404,6 @@ int main(int argc, char **argv)
d9
=
myMap
.
phi1
(
d9
);
}
// interface:
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
...
...
Apps/Examples/extrusionView.cpp
View file @
e8aa0a38
...
...
@@ -51,7 +51,10 @@ struct PFP: public PFP_STANDARD
typedef
EmbeddedMap2
MAP
;
};
PFP
::
MAP
myMap
;
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
MAP
myMap
;
void
MyQT
::
cb_initGL
()
{
...
...
@@ -99,7 +102,7 @@ int main(int argc, char **argv)
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
PFP
::
T
VEC3
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
)
;
VertexAttribute
<
VEC3
>
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
)
;
// define the face extruded (here a cross)
std
::
vector
<
PFP
::
VEC3
>
objV
;
...
...
Apps/Examples/mcmesh.cpp
View file @
e8aa0a38
...
...
@@ -30,8 +30,7 @@ MCMesh::MCMesh() :
m_render
(
NULL
),
m_flatShader
(
NULL
),
m_simpleColorShader
(
NULL
)
{
}
{}
void
MCMesh
::
initGUI
()
{
...
...
@@ -130,24 +129,18 @@ void MCMesh::slot_drawFaces(bool b)
updateGL
();
}
void
MCMesh
::
MC
()
{
myMap
.
clear
(
false
);
// elargir l'image pour le calcul de la courbure
Algo
::
MC
::
Image
<
DATATYPE
>*
myImgFr
=
myImg
->
addFrame
(
1
);
Algo
::
MC
::
WindowingGreater
<
DATATYPE
>
myWindFunc
;
myWindFunc
.
setIsoValue
(
DATATYPE
(
127
));
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
if
(
!
position
.
isValid
())
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
// instanciation du mc
Algo
::
MC
::
MarchingCube
<
DATATYPE
,
Algo
::
MC
::
WindowingGreater
,
PFP
>
mc
(
myImgFr
,
&
myMap
,
position
,
myWindFunc
,
false
);
...
...
@@ -159,12 +152,8 @@ void MCMesh::MC()
updateGL
();
}
void
MCMesh
::
updateRender
()
{
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
nb
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
nb
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
...
...
@@ -190,7 +179,9 @@ void MCMesh::sphere()
DATATYPE
*
img
=
new
DATATYPE
[
128
*
128
*
128
];
DATATYPE
*
ptr
=
img
;
for
(
int
x
=
0
;
x
<
128
;
++
x
)
{
for
(
int
y
=
0
;
y
<
128
;
++
y
)
{
for
(
int
z
=
0
;
z
<
128
;
++
z
)
{
Geom
::
Vec3f
V
(
x
-
64
,
y
-
64
,
z
-
64
);
...
...
@@ -199,6 +190,8 @@ void MCMesh::sphere()
else
*
ptr
++
=
0
;
}
}
}
myImg
=
new
Algo
::
MC
::
Image
<
DATATYPE
>
(
img
,
128
,
128
,
128
,
1.0
f
,
1.0
f
,
1.0
f
,
false
);
}
...
...
@@ -235,4 +228,3 @@ int main(int argc, char **argv)
return
app
.
exec
();
}
Apps/Examples/mcmesh.h
View file @
e8aa0a38
...
...
@@ -26,7 +26,7 @@
#include
"Utils/Qt/qtSimple.h"
#include
"ui_mcmesh.h"
#include
"Utils/qtui.h"
#include
"Utils/
Qt/
qtui.h"
#include
"Topology/generic/parameters.h"
#include
"Topology/map/map2.h"
...
...
@@ -52,11 +52,10 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
typedef
unsigned
char
DATATYPE
;
class
MCMesh
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
...
...
@@ -67,7 +66,6 @@ public:
Utils
::
QT
::
uiDockInterface
dock
;
float
shininess
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
;
...
...
@@ -75,7 +73,7 @@ public:
bool
m_drawEdges
;
bool
m_drawFaces
;
PFP
::
T
VEC3
position
;
VertexAttribute
<
VEC3
>
position
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
...
...
@@ -83,7 +81,6 @@ public:
Utils
::
ShaderFlat
*
m_flatShader
;
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
DATATYPE
valLabel
;
Algo
::
MC
::
Image
<
DATATYPE
>*
myImg
;
...
...
@@ -100,10 +97,7 @@ public:
void
fromFile
(
char
*
fname
);
void
sphere
();
public
slots
:
void
slot_drawEdges
(
bool
b
)
;
void
slot_drawFaces
(
bool
b
)
;
};
Apps/Examples/simpleGMap2.cpp
View file @
e8aa0a38
...
...
@@ -29,7 +29,7 @@
SimpleGMap2
::
SimpleGMap2
()
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Dart
d
=
Algo
::
Modelisation
::
createTetrahedron
<
PFP
>
(
myMap
);
position
[
d
]
=
VEC3
(
0
,
0
,
0
);
...
...
@@ -57,7 +57,6 @@ SimpleGMap2::SimpleGMap2()
void
SimpleGMap2
::
initGUI
()
{
}
void
SimpleGMap2
::
cb_initGL
()
...
...
@@ -80,7 +79,6 @@ void SimpleGMap2::cb_redraw()
Algo
::
Render
::
GL1
::
renderTopoGMD2
<
PFP
>
(
myMap
,
position
,
true
,
true
,
true
,
0.9
f
,
0.9
f
,
0.9
f
);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
...
...
@@ -97,4 +95,3 @@ int main(int argc, char **argv)
return
app
.
exec
()
;
}
Apps/Examples/simpleGMap2.h
View file @
e8aa0a38
...
...
@@ -51,7 +51,7 @@ class SimpleGMap2 : public Utils::QT::SimpleQT
public:
MAP
myMap
;
PFP
::
T
VEC3
position
;
VertexAttribute
<
VEC3
>
position
;
SimpleGMap2
()
;
...
...
Apps/Examples/simpleGMap3.cpp
View file @
e8aa0a38
...
...
@@ -30,9 +30,9 @@
SimpleGMap3
::
SimpleGMap3
()
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
);
volume
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VOLUME
,
"volume"
);
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
normal
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"normal"
);
volume
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
>
(
"volume"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
3
,
1
,
1
);
...
...
@@ -88,12 +88,10 @@ SimpleGMap3::SimpleGMap3()
myMap
.
unsewVolumes
(
d
);
myMap
.
check
();
}
void
SimpleGMap3
::
initGUI
()
{
}
void
SimpleGMap3
::
cb_initGL
()
...
...
@@ -122,7 +120,6 @@ void SimpleGMap3::cb_redraw()
Algo
::
Render
::
GL1
::
renderTriQuadPoly
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL1
::
LINE
,
1.0
,
position
,
normal
);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
...
...
@@ -139,4 +136,3 @@ int main(int argc, char **argv)
return
app
.
exec
()
;
}
Apps/Examples/simpleGMap3.h
View file @
e8aa0a38
...
...
@@ -52,9 +52,9 @@ class SimpleGMap3 : public Utils::QT::SimpleQT
public:
MAP
myMap
;
PFP
::
T
VEC3
position
;
PFP
::
T
VEC3
normal
;
PFP
::
T
VEC3
volume
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
>
normal
;
VolumeAttribute
<
VEC3
>
volume
;
SimpleGMap3
()
;
...
...
@@ -63,4 +63,3 @@ public:
void
cb_initGL
()
;
void
cb_redraw
()
;
};
Apps/Examples/simpleMap3.cpp
View file @
e8aa0a38
...
...
@@ -28,12 +28,11 @@
#include
"Algo/Modelisation/primitives3d.h"
#include
"Algo/Modelisation/subdivision3.h"
SimpleMap3
::
SimpleMap3
()
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
2
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
...
...
@@ -73,7 +72,6 @@ SimpleMap3::SimpleMap3()
void
SimpleMap3
::
initGUI
()
{
}
void
SimpleMap3
::
cb_initGL
()
...
...
@@ -96,7 +94,6 @@ void SimpleMap3::cb_redraw()
Algo
::
Render
::
GL1
::
renderTopoMD3
<
PFP
>
(
myMap
,
position
,
true
,
true
,
true
,
0.9
f
,
0.9
f
,
0.9
f
);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
...
...
@@ -113,4 +110,3 @@ int main(int argc, char **argv)
return
app
.
exec
()
;
}
Apps/Examples/simpleMap3.h
View file @
e8aa0a38
...
...
@@ -52,7 +52,7 @@ public:
MAP
myMap
;
SelectorTrue
allDarts
;
PFP
::
T
VEC3
position
;
VertexAttribute
<
VEC3
>
position
;
SimpleMap3
()
;
...
...
Apps/Examples/texturesExample.cpp
View file @
e8aa0a38
/*
* texturesExample.cpp
*
* Created on: Jul 21, 2011
* Author: thery
*/
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#include
"texturesExample.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Algo/Modelisation/polyhedron.h"
TexView
::
TexView
()
:
m_render
(
NULL
),
m_positionVBO
(
NULL
),
m_texcoordVBO
(
NULL
),
m_texture
(
NULL
),
m_shader
(
NULL
),
m_modeMask
(
false
),
m_fileName
(
""
)
{
}
m_render
(
NULL
),
m_positionVBO
(
NULL
),
m_texcoordVBO
(
NULL
),
m_texture
(
NULL
),
m_shader
(
NULL
),
m_modeMask
(
false
),
m_fileName
(
""
)
{}
TexView
::~
TexView
()
{
...
...
@@ -45,7 +66,6 @@ void TexView::cb_initGL()
createMask
(
8
);
m_mask
->
update
();
m_shader
=
new
Utils
::
ShaderSimpleTexture
();
m_shader
->
setAttributePosition
(
m_positionVBO
);
m_shader
->
setAttributeTexCoord
(
m_texcoordVBO
);
...
...
@@ -60,10 +80,8 @@ void TexView::cb_initGL()
m_shader2
->
setTextures
(
m_texture
,
m_mask
);
registerShader
(
m_shader2
);
glEnable
(
GL_TEXTURE_2D
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
...
...
@@ -73,7 +91,6 @@ void TexView::cb_redraw()
glEnable
(
GL_LIGHTING
);
if
(
m_shader
)
{
if
(
m_modeMask
)
{
m_shader2
->
activeTextures
();
...
...
@@ -84,14 +101,11 @@ void TexView::cb_redraw()
m_shader
->
activeTexture
();
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
}
}
void
TexView
::
cb_keyPress
(
int
code
)
{
switch
(
code
)
{
case
'l'
:
...
...
@@ -156,8 +170,6 @@ void TexView::cb_Open()
}
}
void
TexView
::
createMask
(
unsigned
int
nb
)
{
if
(
nb
==
0
)
...
...
@@ -167,6 +179,7 @@ void TexView::createMask(unsigned int nb)
unsigned
int
sz1
=
m_mask
->
size
()[
1
]
/
nb
;
for
(
unsigned
int
j
=
0
;
j
<
m_mask
->
size
()[
1
];
++
j
)
{
for
(
unsigned
int
i
=
0
;
i
<
m_mask
->
size
()[
0
];
++
i
)
{
bool
b1
=
(
i
/
sz0
)
%
2
==
0
;
...
...
@@ -176,10 +189,9 @@ void TexView::createMask(unsigned int nb)
else
(
*
m_mask
)(
i
,
j
)
=
0.0
f
;
}
}
}
void
TexView
::
computeImage
()
{
std
::
vector
<
Geom
::
Vec3f
>
colorTable
;
...
...
@@ -206,8 +218,6 @@ void TexView::computeImage()
#undef WIDTHCHECKER
}
int
main
(
int
argc
,
char
**
argv
)
{
// interface:
...
...
@@ -216,8 +226,8 @@ int main(int argc, char**argv)
PFP
::
MAP
&
m
=
tv
.
myMap
;
Attribute
Handler
<
PFP
::
VEC3
>
position
=
m
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
Attribute
Handler
<
Geom
::
Vec2f
>
texcoord
=
m
.
addAttribute
<
Geom
::
Vec2f
>
(
VERTEX
,
"texcoord"
);
Vertex
Attribute
<
VEC3
>
position
=
m
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Vertex
Attribute
<
Geom
::
Vec2f
>
texcoord
=
m
.
addAttribute
<
Geom
::
Vec2f
,
VERTEX
>
(
"texcoord"
);
#define NB 96
...
...
Apps/Examples/texturesExample.h
View file @
e8aa0a38
...
...
@@ -50,6 +50,7 @@ struct PFP: public PFP_STANDARD
};