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
f102c718
Commit
f102c718
authored
Aug 04, 2010
by
Alexander Wiebel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE
#343
] fit for different slices now, though still only one
manipulatable by now. Can be activated now.
parent
099e89ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
4 deletions
+75
-4
src/modules/homeGlyphs/WMHomeGlyphs.cpp
src/modules/homeGlyphs/WMHomeGlyphs.cpp
+69
-4
src/modules/homeGlyphs/WMHomeGlyphs.h
src/modules/homeGlyphs/WMHomeGlyphs.h
+6
-0
No files found.
src/modules/homeGlyphs/WMHomeGlyphs.cpp
View file @
f102c718
...
...
@@ -119,6 +119,15 @@ void WMHomeGlyphs::moduleMain()
void
WMHomeGlyphs
::
renderSlice
(
size_t
sliceId
)
{
enum
sliceTypeEnum
{
xSlice
,
ySlice
,
zSlice
};
sliceTypeEnum
sliceType
=
ySlice
;
debugLog
()
<<
"Rendering slice ... "
<<
sliceId
;
// Please look here http://www.ci.uchicago.edu/~schultz/sphinx/home-glyph.htm
if
(
m_moduleNode
)
...
...
@@ -151,12 +160,48 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
// preparation of osg stuff for the glyphs
m_moduleNode
=
new
WGEGroupNode
();
debugLog
()
<<
"start loop ... "
<<
sliceId
;
size_t
nA
;
size_t
nB
;
switch
(
sliceType
)
{
case
xSlice
:
nA
=
nY
;
nB
=
nZ
;
break
;
case
ySlice
:
nA
=
nX
;
nB
=
nZ
;
break
;
case
zSlice
:
nA
=
nX
;
nB
=
nY
;
break
;
}
size_t
nbGlyphs
=
nA
*
nB
;
// std::cout<< "sphere->xyzwNum" << sphere->xyzwNum << std::endl;
// run through the positions in the slice and draw the glyphs
for
(
size_t
yId
=
0
;
yId
<
nY
;
++
y
Id
)
for
(
size_t
aId
=
0
;
aId
<
nA
;
++
a
Id
)
{
for
(
size_t
zId
=
0
;
zId
<
nZ
;
++
z
Id
)
for
(
size_t
bId
=
0
;
bId
<
nB
;
++
b
Id
)
{
size_t
posId
=
sliceId
+
yId
*
nX
+
zId
*
nX
*
nY
;
size_t
posId
;
switch
(
sliceType
)
{
case
xSlice
:
posId
=
sliceId
+
aId
*
nX
+
bId
*
nX
*
nY
;
break
;
case
ySlice
:
posId
=
aId
+
sliceId
*
nX
+
bId
*
nX
*
nY
;
break
;
case
zSlice
:
posId
=
aId
+
bId
*
nX
+
sliceId
*
nX
*
nY
;
break
;
}
wmath
::
WValue
<
double
>
coeffs
=
dataSet
->
getSphericalHarmonicAt
(
posId
).
getCoefficients
();
WAssert
(
coeffs
.
size
()
==
15
,
"This module can handle only 4th order spherical harmonics."
...
...
@@ -211,6 +256,7 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
osg
::
ref_ptr
<
osg
::
Vec3Array
>
vertArray
=
new
osg
::
Vec3Array
(
glyph
->
xyzwNum
);
wmath
::
WPosition
glyphPos
=
grid
->
getPosition
(
posId
);
// std::cout<< "xyzwNum" << glyph->xyzwNum<<std::endl;
for
(
unsigned
int
vertId
=
0
;
vertId
<
glyph
->
xyzwNum
;
++
vertId
)
{
(
*
vertArray
)[
vertId
][
0
]
=
glyph
->
xyzw
[
4
*
vertId
]
/
radius
+
glyphPos
[
0
];
...
...
@@ -237,7 +283,7 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
// normals
osg
::
ref_ptr
<
osg
::
Vec3Array
>
normals
=
osg
::
ref_ptr
<
osg
::
Vec3Array
>
(
new
osg
::
Vec3Array
(
glyph
->
normNum
)
);
// std::cout<< "normNum" << glyph->normNum<<std::endl;
for
(
unsigned
int
vertId
=
0
;
vertId
<
glyph
->
normNum
;
++
vertId
)
{
(
*
normals
)[
vertId
][
0
]
=
glyph
->
norm
[
3
*
vertId
];
...
...
@@ -253,6 +299,7 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
// colors
osg
::
ref_ptr
<
osg
::
Vec4Array
>
colors
=
osg
::
ref_ptr
<
osg
::
Vec4Array
>
(
new
osg
::
Vec4Array
(
glyph
->
rgbaNum
)
);
// std::cout<< "rgbaNum" << glyph->rgbaNum<<std::endl;
for
(
unsigned
int
vertId
=
0
;
vertId
<
glyph
->
rgbaNum
;
++
vertId
)
{
(
*
colors
)[
vertId
][
0
]
=
glyph
->
rgba
[
4
*
vertId
]
/
255.0
;
...
...
@@ -272,6 +319,7 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
}
}
debugLog
()
<<
"end loop ... "
<<
sliceId
;
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getScene
()
->
insert
(
m_moduleNode
);
...
...
@@ -283,3 +331,20 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
delete
[]
res
;
delete
[]
esh
;
}
void
WMHomeGlyphs
::
activate
()
{
if
(
m_moduleNode
)
{
if
(
m_active
->
get
()
)
{
m_moduleNode
->
setNodeMask
(
0xFFFFFFFF
);
}
else
{
m_moduleNode
->
setNodeMask
(
0x0
);
}
}
WModule
::
activate
();
}
src/modules/homeGlyphs/WMHomeGlyphs.h
View file @
f102c718
...
...
@@ -118,6 +118,12 @@ private:
*/
void
execute
();
/**
* Gets signaled from the properties object when something was changed. Now, only m_active is used. This method therefore simply
* activates/deactivates the glyphs.
*/
void
activate
();
/**
* Renders all glyphs for the given slice
* \param sliceId The number of the slice to be rendered.
...
...
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