Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
3f4e5743
Commit
3f4e5743
authored
Apr 13, 2010
by
schurade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] first work on a tensor glyph class using geometry
parent
7b351f94
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
615 additions
and
0 deletions
+615
-0
src/kernel/WModuleFactory.cpp
src/kernel/WModuleFactory.cpp
+2
-0
src/modules/geometryGlyphs/WMGeometryGlyphs.cpp
src/modules/geometryGlyphs/WMGeometryGlyphs.cpp
+298
-0
src/modules/geometryGlyphs/WMGeometryGlyphs.h
src/modules/geometryGlyphs/WMGeometryGlyphs.h
+141
-0
src/modules/geometryGlyphs/WSphereCreator.cpp
src/modules/geometryGlyphs/WSphereCreator.cpp
+103
-0
src/modules/geometryGlyphs/WSphereCreator.h
src/modules/geometryGlyphs/WSphereCreator.h
+71
-0
No files found.
src/kernel/WModuleFactory.cpp
View file @
3f4e5743
...
...
@@ -54,6 +54,7 @@
#include "../modules/triangleMeshRenderer/WMTriangleMeshRenderer.h"
#include "../modules/writeNIfTI/WMWriteNIfTI.h"
#include "../modules/vectorPlot/WMVectorPlot.h"
#include "../modules/geometryGlyphs/WMGeometryGlyphs.h"
#include "WModuleFactory.h"
#include "exceptions/WPrototypeNotUnique.h"
#include "exceptions/WPrototypeUnknown.h"
...
...
@@ -108,6 +109,7 @@ void WModuleFactory::load()
m_prototypes
.
insert
(
boost
::
shared_ptr
<
WModule
>
(
new
WMSurfaceParticles
()
)
);
m_prototypes
.
insert
(
boost
::
shared_ptr
<
WModule
>
(
new
WMClusterSlicer
()
)
);
m_prototypes
.
insert
(
boost
::
shared_ptr
<
WModule
>
(
new
WMVectorPlot
()
)
);
m_prototypes
.
insert
(
boost
::
shared_ptr
<
WModule
>
(
new
WMGeometryGlyphs
()
)
);
lock
.
unlock
();
...
...
src/modules/geometryGlyphs/WMGeometryGlyphs.cpp
0 → 100644
View file @
3f4e5743
This diff is collapsed.
Click to expand it.
src/modules/geometryGlyphs/WMGeometryGlyphs.h
0 → 100644
View file @
3f4e5743
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV-Leipzig and CNCF-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMGEOMETRYGLYPHS_H
#define WMGEOMETRYGLYPHS_H
#include <string>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Uniform>
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
#include "../../dataHandler/WDataSetSingle.h"
#include "../../dataHandler/WDataSetVector.h"
#include "../../graphicsEngine/WGEGroupNode.h"
#include "../../graphicsEngine/WTriangleMesh2.h"
/**
* Someone should add some documentation here.
* Probably the best person would be the module's
* creator, i.e. "schurade".
*
* This is only an empty template for a new module. For
* an example module containing many interesting concepts
* and extensive documentation have a look at "src/modules/template"
*
* \ingroup modules
*/
class
WMGeometryGlyphs
:
public
WModule
{
public:
/**
*
*/
WMGeometryGlyphs
();
/**
*
*/
virtual
~
WMGeometryGlyphs
();
/**
* Gives back the name of this module.
* \return the module's name.
*/
virtual
const
std
::
string
getName
()
const
;
/**
* Gives back a description of this module.
* \return description to module.
*/
virtual
const
std
::
string
getDescription
()
const
;
/**
* Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
* should never be initialized or modified in some other way. A simple new instance is required.
*
* \return the prototype used to create every module in OpenWalnut.
*/
virtual
boost
::
shared_ptr
<
WModule
>
factory
()
const
;
protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
moduleMain
();
/**
* Initialize the connectors this module is using.
*/
virtual
void
connectors
();
/**
* Initialize the properties for this module.
*/
virtual
void
properties
();
private:
void
prepareGlyphes
();
//!< initial creation of glyphs
/**
* render function
* \param mesh
*/
void
renderMesh
(
boost
::
shared_ptr
<
WTriangleMesh2
>
mesh
);
WPropBool
m_useTextureProp
;
//!< Property indicating whether to use texturing with scalar data sets.
osg
::
ref_ptr
<
WGEGroupNode
>
m_moduleNode
;
//!< Pointer to the modules group node. We need it to be able to update it when callback is invoked.
osg
::
ref_ptr
<
osg
::
Geode
>
m_outputGeode
;
//!< Pointer to geode containing the glpyhs
boost
::
shared_ptr
<
WModuleInputData
<
WDataSetSingle
>
>
m_input
;
//!< Input connector required by this module.
boost
::
shared_ptr
<
const
WDataSetSingle
>
m_dataSet
;
//!< pointer to dataSet to be able to access it throughout the whole module.
boost
::
shared_ptr
<
WTriangleMesh2
>
m_triMesh
;
//!< This triangle mesh is provided as output through the connector.
WPropInt
m_xPos
;
//!< x posistion of the slice
WPropInt
m_yPos
;
//!< y posistion of the slice
WPropInt
m_zPos
;
//!< z posistion of the slice
WPropBool
m_showonX
;
//!< in dicates whether the vector should be shown on slice X
WPropBool
m_showonY
;
//!< in dicates whether the vector should be shown on slice Y
WPropBool
m_showonZ
;
//!< in dicates whether the vector should be shown on slice Z
};
#endif // WMGEOMETRYGLYPHS_H
src/modules/geometryGlyphs/WSphereCreator.cpp
0 → 100644
View file @
3f4e5743
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WSphereCreator.h"
WSphereCreator
::
WSphereCreator
()
{
}
WSphereCreator
::~
WSphereCreator
()
{
}
boost
::
shared_ptr
<
WTriangleMesh2
>
WSphereCreator
::
createSphere
(
int
resolution
,
float
zoom
,
float
xOff
,
float
yOff
,
float
zOff
)
{
boost
::
shared_ptr
<
WTriangleMesh2
>
sphere
=
createIcosahedronSphere
(
resolution
);
for
(
size_t
i
=
0
;
i
<
sphere
->
vertSize
();
++
i
)
{
osg
::
Vec3
v
=
sphere
->
getVertex
(
i
);
v
.
normalize
();
osg
::
Vec4
c
(
fabs
(
v
[
0
]
),
fabs
(
v
[
1
]
),
fabs
(
v
[
2
]
),
1.0
);
sphere
->
setVertexColor
(
i
,
c
);
}
sphere
->
zoomMesh
(
zoom
);
sphere
->
translateMesh
(
xOff
,
yOff
,
zOff
);
return
sphere
;
}
boost
::
shared_ptr
<
WTriangleMesh2
>
WSphereCreator
::
createIcosahedronSphere
(
int
iterations
)
{
float
t
=
(
1
+
sqrt
(
5
)
)
/
2
;
float
tau
=
t
/
sqrt
(
1
+
t
*
t
);
float
one
=
1
/
sqrt
(
1
+
t
*
t
);
boost
::
shared_ptr
<
WTriangleMesh2
>
sphere
=
boost
::
shared_ptr
<
WTriangleMesh2
>
(
new
WTriangleMesh2
(
12
,
20
)
);
sphere
->
addVertex
(
tau
,
one
,
0.0
);
sphere
->
addVertex
(
-
tau
,
one
,
0.0
);
sphere
->
addVertex
(
-
tau
,
-
one
,
0.0
);
sphere
->
addVertex
(
tau
,
-
one
,
0.0
);
sphere
->
addVertex
(
one
,
0.0
,
tau
);
sphere
->
addVertex
(
one
,
0.0
,
-
tau
);
sphere
->
addVertex
(
-
one
,
0.0
,
-
tau
);
sphere
->
addVertex
(
-
one
,
0.0
,
tau
);
sphere
->
addVertex
(
0.0
,
tau
,
one
);
sphere
->
addVertex
(
0.0
,
-
tau
,
one
);
sphere
->
addVertex
(
0.0
,
-
tau
,
-
one
);
sphere
->
addVertex
(
0.0
,
tau
,
-
one
);
sphere
->
addTriangle
(
4
,
8
,
7
);
sphere
->
addTriangle
(
4
,
7
,
9
);
sphere
->
addTriangle
(
5
,
6
,
11
);
sphere
->
addTriangle
(
5
,
10
,
6
);
sphere
->
addTriangle
(
0
,
4
,
3
);
sphere
->
addTriangle
(
0
,
3
,
5
);
sphere
->
addTriangle
(
2
,
7
,
1
);
sphere
->
addTriangle
(
2
,
1
,
6
);
sphere
->
addTriangle
(
8
,
0
,
11
);
sphere
->
addTriangle
(
8
,
11
,
1
);
sphere
->
addTriangle
(
9
,
10
,
3
);
sphere
->
addTriangle
(
9
,
2
,
10
);
sphere
->
addTriangle
(
8
,
4
,
0
);
sphere
->
addTriangle
(
11
,
0
,
5
);
sphere
->
addTriangle
(
4
,
9
,
3
);
sphere
->
addTriangle
(
5
,
3
,
10
);
sphere
->
addTriangle
(
7
,
8
,
1
);
sphere
->
addTriangle
(
6
,
1
,
11
);
sphere
->
addTriangle
(
7
,
2
,
9
);
sphere
->
addTriangle
(
6
,
10
,
2
);
for
(
int
i
=
0
;
i
<
iterations
;
++
i
)
{
sphere
->
doLoopSubD
();
}
return
sphere
;
}
src/modules/geometryGlyphs/WSphereCreator.h
0 → 100644
View file @
3f4e5743
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WSPHERECREATOR_H
#define WSPHERECREATOR_H
#include <boost/shared_ptr.hpp>
#include "../../graphicsEngine/WTriangleMesh2.h"
/**
* TODO(schurade): Document this!
*/
class
WSphereCreator
{
public:
/**
* constructor, does nothing
*/
WSphereCreator
();
/**
* destructor
*/
~
WSphereCreator
();
/**
* creates a sphere mesh by executing a given number of loopsubd on a
*
* \param resolution
* \param zoom
* \param xOff
* \param yOff
* \param zOff
*/
boost
::
shared_ptr
<
WTriangleMesh2
>
createSphere
(
int
resolution
,
float
zoom
=
1.
,
float
xOff
=
0.
,
float
yOff
=
0.
,
float
zOff
=
0.
);
protected:
private:
/**
* creates a sphere mesh by executing a given number of loopsubd on a icosahedrom
*
* \param iterations
*/
boost
::
shared_ptr
<
WTriangleMesh2
>
createIcosahedronSphere
(
int
iterations
);
};
#endif // WSPHERECREATOR_H
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