Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
f612b0dd
Commit
f612b0dd
authored
Oct 23, 2014
by
Christian Schulte zu Berge
Browse files
Removed unnecessary tgt files.
refs #386
parent
3ee6e28c
Changes
50
Show whitespace changes
Inline
Side-by-side
application/campvispainter.cpp
View file @
f612b0dd
...
...
@@ -27,7 +27,6 @@
#include "tgt/assert.h"
#include "tgt/camera.h"
#include "tgt/glcontextmanager.h"
#include "tgt/quadric.h"
#include "tgt/shadermanager.h"
#include "tgt/texture.h"
#include "tgt/textureunit.h"
...
...
core/coreapi.h
View file @
f612b0dd
...
...
@@ -25,8 +25,6 @@
#ifndef CAMPVIS_COREAPI_H__
#define CAMPVIS_COREAPI_H__
#include "sigslot/sigslot.h"
#ifdef CAMPVIS_DYNAMIC_LIBS
#ifdef CAMPVIS_CORE_BUILD_DLL
// building library -> export symbols
...
...
ext/tgt/CMakeLists.txt
View file @
f612b0dd
...
...
@@ -22,36 +22,26 @@ FILE(GLOB TGT_HEADERS *.h event/*.h navigation/*.h)
SET
(
TGT_SOURCES
assert.cpp
bounds.cpp
bspline.cpp
buffer.cpp
camera.cpp
catmullromspline.cpp
curve.cpp
exception.cpp
filesystem.cpp
font.cpp
framebufferobject.cpp
frustum.cpp
glcanvas.cpp
glcontextmanager.cpp
gpucapabilities.cpp
gpucapabilitieswindows.cpp
guiapplication.cpp
init.cpp
light.cpp
logmanager.cpp
job.cpp
naturalcubicspline.cpp
openglgarbagecollector.cpp
opengljobprocessor.cpp
painter.cpp
runnable.cpp
shadermanager.cpp
spline.cpp
stopwatch.cpp
tesselator.cpp
texture.cpp
texturemanager.cpp
texturereader.cpp
texturereaderdevil.cpp
texturereadertga.cpp
...
...
@@ -75,13 +65,11 @@ SET(TGT_SOURCES
# Qt related stuff:
IF
(
TGT_WITH_QT
)
LIST
(
APPEND TGT_HEADERS
qt/qtapplication.h
qt/qtcanvas.h
qt/qtthreadedcanvas.h
qt/qttimer.h
)
LIST
(
APPEND TGT_SOURCES
qt/qtapplication.cpp
qt/qtcanvas.cpp
qt/qtthreadedcanvas.cpp
qt/qttimer.cpp
)
...
...
ext/tgt/bspline.cpp
deleted
100644 → 0
View file @
3ee6e28c
/**********************************************************************
* *
* tgt - Tiny Graphics Toolbox *
* *
* Copyright (C) 2006-2011 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the tgt library. This library is free *
* software; you can redistribute it and/or modify it under the terms *
* of the GNU Lesser General Public License version 2.1 as published *
* by the Free Software Foundation. *
* *
* 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 in the file "LICENSE.txt" along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
**********************************************************************/
#include "tgt/bspline.h"
namespace
tgt
{
BSpline
::
BSpline
(
const
std
::
vector
<
vec3
>&
ctrlPoints
,
int
degree
,
GLuint
stepCount
)
:
Curve
(
stepCount
,
Bounds
(),
true
,
true
)
,
degree_
(
degree
)
,
ctrlPoints_
(
ctrlPoints
)
{
tgtAssert
(
degree_
>
0
,
"Degree of a B-Spline must be greater zero."
);
tgtAssert
(
static_cast
<
int
>
(
ctrlPoints_
.
size
())
>
degree_
,
"The number of control points must exceed the spline's degree."
);
generateKnotVector
();
}
BSpline
::
BSpline
(
const
std
::
vector
<
vec3
>&
ctrlPoints
,
const
std
::
vector
<
float
>&
knotValues
,
int
degree
,
GLuint
stepCount
)
:
Curve
(
stepCount
,
Bounds
(),
true
,
true
)
,
degree_
(
degree
)
,
ctrlPoints_
(
ctrlPoints
)
{
tgtAssert
(
degree_
>
0
,
"Degree of a B-Spline must be greater zero."
);
tgtAssert
(
static_cast
<
int
>
(
ctrlPoints_
.
size
())
>
degree_
,
"The number of control points must exceed the spline's degree."
);
tgtAssert
(
knotValues
.
size
()
==
ctrlPoints_
.
size
(),
"The number of knot values must match the number of control points."
);
// tgtAssert( std::adjacent_find(knotValues.begin(), knotValues.end(), std::greater<float>()) == knotValues.end(),
// "Knot values must be in non-decreasing order");
knots_
=
knotValues
;
generateKnotVector
();
}
vec3
BSpline
::
getPoint
(
GLfloat
t
)
{
// evaluate spline by Cox-deBoor recursion (also known as deCasteljau recursion)
vec3
point
(
0.
f
);
for
(
size_t
i
=
0
;
i
<
ctrlPoints_
.
size
();
++
i
)
point
+=
evalBasisFunction
(
static_cast
<
int
>
(
i
),
degree_
,
t
)
*
ctrlPoints_
.
at
(
i
);
return
point
;
}
vec3
BSpline
::
getDerivative
(
GLfloat
/*t*/
)
{
// TODO
return
vec3
(
0.
f
);
}
// private
float
BSpline
::
evalBasisFunction
(
int
knotID
,
int
deg
,
float
u
)
{
// Cox-deBoor recursion
if
(
deg
==
0
)
{
if
(
u
>=
knots_
.
at
(
knotID
)
&&
u
<
knots_
.
at
(
knotID
+
1
)
)
return
1.
f
;
else
return
0.
f
;
}
else
{
float
factor1
,
factor2
;
if
(
knots_
.
at
(
knotID
+
deg
)
==
knots_
.
at
(
knotID
))
factor1
=
0.
f
;
else
factor1
=
(
u
-
knots_
.
at
(
knotID
))
/
(
knots_
.
at
(
knotID
+
deg
)
-
knots_
.
at
(
knotID
));
if
(
knots_
.
at
(
knotID
+
deg
+
1
)
==
knots_
.
at
(
knotID
+
1
))
factor2
=
0.
f
;
else
factor2
=
(
knots_
.
at
(
knotID
+
deg
+
1
)
-
u
)
/
(
knots_
.
at
(
knotID
+
deg
+
1
)
-
knots_
.
at
(
knotID
+
1
));
return
factor1
*
evalBasisFunction
(
knotID
,
deg
-
1
,
u
)
+
factor2
*
evalBasisFunction
(
knotID
+
1
,
deg
-
1
,
u
);
}
}
// private
void
BSpline
::
generateKnotVector
()
{
if
(
knots_
.
empty
())
{
// No knot values have been passed => generate uniform distribution.
// In order to force the spline to interpolate the start and end control points,
// (degree_+1) knots of value 0.0 or 1.0 are inserted at the beginning and the end
// of the knot vector, respectively.
// total number of knot values and number of inner knots
size_t
numKnots
=
ctrlPoints_
.
size
()
+
degree_
+
1
;
size_t
innerKnots
=
numKnots
-
2
*
(
degree_
+
1
);
// start knots (for interpolation of the first control point)
for
(
int
i
=
0
;
i
<=
degree_
;
++
i
)
{
knots_
.
push_back
(
0.
f
);
}
// inner knots
if
(
innerKnots
>
0
)
{
float
step
=
1.
f
/
static_cast
<
float
>
(
innerKnots
+
1
);
for
(
size_t
i
=
1
;
i
<=
innerKnots
;
++
i
)
{
knots_
.
push_back
(
i
*
step
);
}
}
// end knots (for interpolation of the last control point)
for
(
int
i
=
0
;
i
<=
degree_
;
++
i
)
{
knots_
.
push_back
(
1.
f
+
1e-6
f
);
}
}
else
{
// scale and shift passed knot values to interval [0.0, 1.0] and
// add (degree_+1)/2 knots at the beginning and end of the knot vector,
// respectively.
std
::
vector
<
float
>
tempKnots
=
knots_
;
knots_
.
clear
();
int
knotsToAdd
=
degree_
;
int
firstKnot
=
tgt
::
iceil
((
degree_
+
1
)
/
2.
f
)
-
1
;
int
lastKnot
=
static_cast
<
int
>
(
tempKnots
.
size
())
-
tgt
::
ifloor
((
degree_
+
1
)
/
2.
f
);
float
minKnot
=
tempKnots
.
at
(
firstKnot
);
float
maxKnot
=
tempKnots
.
at
(
lastKnot
);
float
shift
=
-
minKnot
;
float
scale
=
(
1.
f
+
1e-6
f
)
/
(
maxKnot
-
minKnot
);
for
(
int
i
=
0
;
i
<
knotsToAdd
;
++
i
)
{
knots_
.
push_back
(
0.
f
);
}
for
(
int
i
=
firstKnot
;
i
<=
lastKnot
;
++
i
)
{
knots_
.
push_back
(
(
tempKnots
.
at
(
i
)
+
shift
)
*
scale
);
}
for
(
int
i
=
0
;
i
<
knotsToAdd
;
++
i
)
{
knots_
.
push_back
(
1.
f
+
1e-6
f
);
}
}
}
}
// namespace
ext/tgt/bspline.h
deleted
100644 → 0
View file @
3ee6e28c
/**********************************************************************
* *
* tgt - Tiny Graphics Toolbox *
* *
* Copyright (C) 2006-2011 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the tgt library. This library is free *
* software; you can redistribute it and/or modify it under the terms *
* of the GNU Lesser General Public License version 2.1 as published *
* by the Free Software Foundation. *
* *
* 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 in the file "LICENSE.txt" along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
**********************************************************************/
#ifndef TGT_BSPLINE_H
#define TGT_BSPLINE_H
#include <vector>
#include "tgt/curve.h"
#include "tgt/vector.h"
namespace
tgt
{
/**
* Uniform B-Spline of arbitrary degree, which is evaluated by Cox-deBoor recursion.
*
* In order to force the spline to interpolate the first and last control point,
* degree+1 knot values are repeated at the beginning and the end of
* the knot vector, respectively.
*
*/
class
TGT_API
BSpline
:
public
Curve
{
public:
/**
* Constructor expecting the spline's control points. The inner knot values are
* distributed uniformly and range from 0.0 till 1.0.
*
* @param ctrlPoints The spline's control points. Note: The number of control points must
* exceed the spline's degree.
* @param degree The spline's degree, i.e. the degree of its basis functions. By default,
* a cubic B-Spline is generated. Note: The degree must be greater zero.
* @param stepCount Only relevant, if the spline is to be rendered: It specifies the number
* of line segments the spline is divided into.
*/
BSpline
(
const
std
::
vector
<
vec3
>&
ctrlPoints
,
int
degree
=
3
,
GLuint
stepCount
=
50
);
/**
* Constructor expecting the spline's control points and the corresponding knot values.
* The passed knot-vector is rescaled uniformly and shifted to match the interval [0.0, 1.0].
*
* @param ctrlPoints The spline's control points. Note: The number of control points must
* exceed the spline's degree.
* @param knotValues The spline's knot values. Note: The number of knot values must match
* the number of control points and must be passed in non-decreasing order.
* @param degree The spline's degree, i.e. the degree of its basis functions. By default,
* a cubic B-Spline is generated. Note: The degree must be greater zero.
* @param stepCount Only relevant, if the spline is to be rendered: It specifies the number
* of line segments the spline is divided into.
*/
BSpline
(
const
std
::
vector
<
vec3
>&
ctrlPoints
,
const
std
::
vector
<
float
>&
knotValues
,
int
degree
=
3
,
GLuint
stepCount
=
50
);
/**
* Evaluates the B-Spline at an arbitrary position t within the interval [0.0,1.0].
*/
vec3
getPoint
(
GLfloat
t
);
/**
* Calculates the B-Spline's first derivative (tangent) at an arbitrary position t
* within the interval [0.0,1.0]. Not implemented, yet.
*/
vec3
getDerivative
(
GLfloat
t
);
private:
// Cox-deBoor recursion
float
evalBasisFunction
(
int
knotID
,
int
deg
,
float
u
);
// generates the spline's knot values
void
generateKnotVector
();
// degree and control points
int
degree_
;
std
::
vector
<
vec3
>
ctrlPoints_
;
// knot vector (internally generated)
std
::
vector
<
float
>
knots_
;
};
}
// namespace
#endif // TGT_BSPLINE_H
ext/tgt/camera.cpp
View file @
f612b0dd
...
...
@@ -27,7 +27,6 @@
#include "tgt/assert.h"
#include "tgt/glmath.h"
#include "tgt/quaternion.h"
#include "tgt/spline.h"
#include "tgt/tgt_gl.h"
#include <cmath>
...
...
@@ -152,46 +151,6 @@ mat4 Camera::getProjectionMatrix() const {
return
getFrustumMatrix
();
}
line3
Camera
::
getViewRay
(
ivec2
vp
,
ivec2
pixel
)
const
{
GLint
viewport
[
4
];
GLdouble
modelview
[
16
];
GLdouble
projection
[
16
];
tgt
::
mat4
projection_tgt
=
getProjectionMatrix
();
tgt
::
mat4
modelview_tgt
=
getViewMatrix
();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
modelview
[
i
+
0
]
=
modelview_tgt
[
i
].
x
;
modelview
[
i
+
4
]
=
modelview_tgt
[
i
].
y
;
modelview
[
i
+
8
]
=
modelview_tgt
[
i
].
z
;
modelview
[
i
+
12
]
=
modelview_tgt
[
i
].
w
;
projection
[
i
+
0
]
=
projection_tgt
[
i
].
x
;
projection
[
i
+
4
]
=
projection_tgt
[
i
].
y
;
projection
[
i
+
8
]
=
projection_tgt
[
i
].
z
;
projection
[
i
+
12
]
=
projection_tgt
[
i
].
w
;
}
viewport
[
0
]
=
0
;
viewport
[
1
]
=
0
;
viewport
[
2
]
=
static_cast
<
GLint
>
(
vp
.
x
);
viewport
[
3
]
=
static_cast
<
GLint
>
(
vp
.
y
);
GLdouble
winX
,
winY
,
winZ
;
winX
=
pixel
.
x
;
winY
=
vp
.
y
-
pixel
.
y
;
winZ
=
1.0
f
;
tgt
::
dvec3
posFar
;
gluUnProject
(
winX
,
winY
,
winZ
,
modelview
,
projection
,
viewport
,
&
posFar
.
x
,
&
posFar
.
y
,
&
posFar
.
z
);
LGL_ERROR
;
winZ
=
0.0
f
;
tgt
::
dvec3
posNear
;
gluUnProject
(
winX
,
winY
,
winZ
,
modelview
,
projection
,
viewport
,
&
posNear
.
x
,
&
posNear
.
y
,
&
posNear
.
z
);
LGL_ERROR
;
tgt
::
line3
l
(
posNear
,
posFar
);
return
l
;
}
vec3
Camera
::
project
(
ivec2
vp
,
vec3
point
)
const
{
GLint
viewport
[
4
];
GLdouble
modelview
[
16
];
...
...
ext/tgt/camera.h
View file @
f612b0dd
...
...
@@ -31,7 +31,6 @@
#include "tgt/frustum.h"
#include "tgt/types.h"
#include "tgt/vector.h"
#include "tgt/line.h"
#include "tgt/matrix.h"
#include "tgt/quaternion.h"
#include "tgt/glcanvas.h"
...
...
@@ -274,7 +273,6 @@ public:
/// This method returns the projection matrix
virtual
mat4
getProjectionMatrix
()
const
;
line3
getViewRay
(
ivec2
vp
,
ivec2
pixel
)
const
;
vec3
project
(
ivec2
vp
,
vec3
point
)
const
;
bool
operator
==
(
const
Camera
&
rhs
)
const
;
...
...
ext/tgt/catmullromspline.cpp
deleted
100644 → 0
View file @
3ee6e28c
/**********************************************************************
* *
* tgt - Tiny Graphics Toolbox *
* *
* Copyright (C) 2006-2011 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the tgt library. This library is free *
* software; you can redistribute it and/or modify it under the terms *
* of the GNU Lesser General Public License version 2.1 as published *
* by the Free Software Foundation. *
* *
* 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 in the file "LICENSE.txt" along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
**********************************************************************/
#include "catmullromspline.h"
//using tgt::vec2;
using
std
::
vector
;
namespace
tgt
{
CatmullRomSpline
::
CatmullRomSpline
()
{}
CatmullRomSpline
::
CatmullRomSpline
(
const
vector
<
vec2
>&
points
)
{
setPoints
(
points
);
}
void
CatmullRomSpline
::
setPoints
(
const
vector
<
vec2
>&
points
)
{
points_
=
points
;
if
(
points_
.
size
()
>
1
)
{
const
vec2
&
first
=
points
[
0
];
const
vec2
&
second
=
points
[
1
];
float
deltaX
=
second
.
x
-
first
.
x
;
float
deltaY
=
second
.
y
-
first
.
y
;
if
(
deltaX
==
0.
f
)
deltaX
+=
0.001
f
;
if
(
deltaY
==
0.
f
)
deltaY
+=
0.001
f
;
vec2
virtualPoint
(
first
.
x
-
deltaX
,
first
.
y
-
deltaY
);
points_
.
insert
(
points_
.
begin
(),
virtualPoint
);
}
}
float
CatmullRomSpline
::
getPoint
(
float
t
)
const
{
if
(
points_
.
size
()
==
1
)
{
return
points_
[
0
].
y
;
}
else
{
float
delta
=
points_
[
points_
.
size
()
-
1
].
x
-
points_
[
1
].
x
;
float
x
=
t
*
delta
;
size_t
i
=
0
;
while
(
points_
[
i
].
x
<
x
)
++
i
;
float
x2
=
points_
[
i
].
x
;
float
p2
=
points_
[
i
].
y
;
float
x1
=
points_
[
i
-
1
].
x
;
float
p1
=
points_
[
i
-
1
].
y
;
float
m1
;
if
(
i
!=
1
)
{
float
p0
=
points_
[
i
-
2
].
y
;
m1
=
0.5
f
*
(
p2
-
p0
);
}
else
m1
=
p2
-
p1
;
i
++
;
float
m2
;
if
(
i
<
points_
.
size
())
{
float
p3
=
points_
[
i
].
y
;
m2
=
0.5
f
*
(
p3
-
p1
);
}
else
m2
=
p2
-
p1
;
const
float
t2
=
(
x
-
x1
)
/
(
x2
-
x1
);
const
float
h00
=
(
1
+
2
*
t2
)
*
(
1
-
t2
)
*
(
1
-
t2
);
const
float
h10
=
t2
*
(
1
-
t2
)
*
(
1
-
t2
);
const
float
h01
=
t2
*
t2
*
(
3
-
2
*
t2
);
const
float
h11
=
t2
*
t2
*
(
t2
-
1
);
return
h00
*
p1
+
h10
*
m1
+
h01
*
p2
+
h11
*
m2
;
}
}
}
// namespace
ext/tgt/catmullromspline.h
deleted
100644 → 0
View file @
3ee6e28c
/**********************************************************************
* *
* tgt - Tiny Graphics Toolbox *
* *
* Copyright (C) 2006-2011 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the tgt library. This library is free *
* software; you can redistribute it and/or modify it under the terms *
* of the GNU Lesser General Public License version 2.1 as published *
* by the Free Software Foundation. *
* *
* 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 in the file "LICENSE.txt" along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
**********************************************************************/
#ifndef VRN_CATMULLROMSPLINE_H
#define VRN_CATMULLROMSPLINE_H
#include <vector>
#include "tgt/types.h"
#include "tgt/vector.h"
namespace
tgt
{
class
TGT_API
SplineTmp
{
public:
virtual
float
getPoint
(
float
t
)
const
=
0
;
};
// temporary replacement for "real" spline class
class
TGT_API
CatmullRomSpline
:
public
SplineTmp
{
public:
CatmullRomSpline
();
CatmullRomSpline
(
const
std
::
vector
<
tgt
::
vec2
>&
points
);
void
setPoints
(
const
std
::
vector
<
tgt
::
vec2
>&
points
);
float
getPoint
(
float
t
)
const
;
private:
std
::
vector
<
tgt
::
vec2
>
points_
;
};
}
// namespace
#endif // VRN_CATMULLROMSPLINE_H
ext/tgt/curve.cpp
deleted
100644 → 0
View file @
3ee6e28c
/**********************************************************************
* *
* tgt - Tiny Graphics Toolbox *
* *
* Copyright (C) 2006-2011 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the tgt library. This library is free *
* software; you can redistribute it and/or modify it under the terms *
* of the GNU Lesser General Public License version 2.1 as published *
* by the Free Software Foundation. *
* *
* 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 in the file "LICENSE.txt" along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
**********************************************************************/
#include "tgt/curve.h"
#include "tgt/types.h"
namespace
tgt
{
Curve
::
Curve
(
GLuint
stepCount
,
const
Bounds
&
bounds
,
bool
_static
,
bool
visible
)
:
Renderable
(
bounds
,
_static
,
visible
)
{
setStepCount
(
stepCount
);
setDrawStyle
(
LINE
);
}
void
Curve
::
render
()
{
if
(
visible_
)
render
(
0.0
,
1.0
);
}
void
Curve
::
setStepCount
(
GLuint
stepCount
)
{
tgtAssert
(
stepCount
>
0
,
"Step count is expected to be greater zero."
);
stepCount_
=
stepCount
;
}
GLuint
Curve
::
getStepCount
()
{
return
stepCount_
;
}
void
Curve
::
setDrawStyle
(
DrawStyle
drawStyle
)
{
drawStyle_
=
drawStyle
;
}
tgt
::
Curve
::
DrawStyle
Curve
::
getDrawStyle
()
{
return
drawStyle_
;