Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
4c4c1266
Commit
4c4c1266
authored
Jan 21, 2011
by
Sebastian Eichelbaum
Browse files
[CHANGE] - some fine tunings
parent
2ac1ccc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
41 deletions
+12
-41
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
+11
-40
src/modules/isosurfaceRaytracer/WMIsosurfaceRaytracer.cpp
src/modules/isosurfaceRaytracer/WMIsosurfaceRaytracer.cpp
+1
-1
No files found.
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
View file @
4c4c1266
...
...
@@ -32,23 +32,24 @@
#include <osg/Geometry>
#include <osg/Drawable>
#include "../../kernel/WKernel.h"
#include "../../common/WPropertyHelper.h"
#include "../../common/math/WMath.h"
#include "../../common/math/WPlane.h"
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WGridRegular3D.h"
#include "../../dataHandler/WDataTexture3D_2.h"
#include "../../dataHandler/WGridRegular3D.h"
#include "../../graphicsEngine/WGEColormapping.h"
#include "../../graphicsEngine/WGEGeodeUtils.h"
#include "../../graphicsEngine/WGETextureUtils.h"
#include "../../graphicsEngine/callbacks/WGELinearTranslationCallback.h"
#include "../../graphicsEngine/callbacks/WGENodeMaskCallback.h"
#include "../../graphicsEngine/callbacks/WGEShaderAnimationCallback.h"
#include "../../graphicsEngine/WGEColormapping.h"
#include "../../graphicsEngine/WGEGeodeUtils.h"
#include "../../graphicsEngine/shaders/WGEShader.h"
#include "../../graphicsEngine/shaders/WGEShaderDefineOptions.h"
#include "../../graphicsEngine/offscreen/WGEOffscreenRenderPass.h"
#include "../../graphicsEngine/offscreen/WGEOffscreenRenderNode.h"
#include "../../graphicsEngine/offscreen/WGEOffscreenRenderPass.h"
#include "../../graphicsEngine/shaders/WGEPropertyUniform.h"
#include "../../graphicsEngine/shaders/WGEShader.h"
#include "../../graphicsEngine/shaders/WGEShaderDefineOptions.h"
#include "../../kernel/WKernel.h"
#include "WMImageSpaceLIC.h"
#include "WMImageSpaceLIC.xpm"
...
...
@@ -163,7 +164,7 @@ void WMImageSpaceLIC::initOSG( boost::shared_ptr< WGridRegular3D > grid, boost::
if
(
mesh
&&
!
m_useSlices
->
get
(
true
)
)
{
// we have a mesh and want to use it
warnLog
()
<<
"MESH."
;
// create geometry and geode
osg
::
Geometry
*
surfaceGeometry
=
new
osg
::
Geometry
();
osg
::
ref_ptr
<
osg
::
Geode
>
surfaceGeode
=
osg
::
ref_ptr
<
osg
::
Geode
>
(
new
osg
::
Geode
);
...
...
@@ -197,6 +198,7 @@ void WMImageSpaceLIC::initOSG( boost::shared_ptr< WGridRegular3D > grid, boost::
}
else
{
warnLog
()
<<
"SLICE"
;
// we want the tex matrix for each slice to be modified too,
osg
::
ref_ptr
<
osg
::
TexMat
>
texMat
;
...
...
@@ -234,33 +236,6 @@ void WMImageSpaceLIC::initOSG( boost::shared_ptr< WGridRegular3D > grid, boost::
}
}
/**
* Generates a white noise texture with given resolution.
*
* \param resX the resolution
*
* \return a image with resX*resX resolution.
*/
osg
::
ref_ptr
<
osg
::
Image
>
genWhiteNoise
(
size_t
resX
)
{
std
::
srand
(
time
(
0
)
);
osg
::
ref_ptr
<
osg
::
Image
>
randImage
=
new
osg
::
Image
();
randImage
->
allocateImage
(
resX
,
resX
,
1
,
GL_LUMINANCE
,
GL_UNSIGNED_BYTE
);
unsigned
char
*
randomLuminance
=
randImage
->
data
();
// should be 4 megs
for
(
unsigned
int
x
=
0
;
x
<
resX
;
x
++
)
{
for
(
unsigned
int
y
=
0
;
y
<
resX
;
y
++
)
{
// - stylechecker says "use rand_r" but I am not sure about portability.
unsigned
char
r
=
(
unsigned
char
)(
std
::
rand
()
%
255
);
// NOLINT
randomLuminance
[
(
y
*
resX
)
+
x
]
=
r
;
}
}
return
randImage
;
}
void
WMImageSpaceLIC
::
moduleMain
()
{
// get notified about data changes
...
...
@@ -279,11 +254,7 @@ void WMImageSpaceLIC::moduleMain()
const
size_t
resX
=
1024
;
// finally, create a texture from the image
osg
::
ref_ptr
<
osg
::
Texture2D
>
randTexture
=
new
osg
::
Texture2D
();
randTexture
->
setFilter
(
osg
::
Texture2D
::
MIN_FILTER
,
osg
::
Texture2D
::
NEAREST
);
randTexture
->
setFilter
(
osg
::
Texture2D
::
MAG_FILTER
,
osg
::
Texture2D
::
NEAREST
);
randTexture
->
setImage
(
genWhiteNoise
(
resX
)
);
randTexture
->
setResizeNonPowerOfTwoHint
(
false
);
osg
::
ref_ptr
<
osg
::
Texture2D
>
randTexture
=
wge
::
genWhiteNoiseTexture
(
resX
);
// done.
ready
();
...
...
src/modules/isosurfaceRaytracer/WMIsosurfaceRaytracer.cpp
View file @
4c4c1266
...
...
@@ -243,7 +243,7 @@ void WMIsosurfaceRaytracer::moduleMain()
osg
::
StateSet
*
rootState
=
cube
->
getOrCreateStateSet
();
osg
::
ref_ptr
<
WGETexture3D
>
texture3D
=
dataSet
->
getTexture2
();
texture3D
->
bind
(
cube
);
WGEColormapping
::
apply
(
cube
,
m_shader
,
1
);
WGEColormapping
::
apply
(
cube
,
m_shader
,
2
);
////////////////////////////////////////////////////////////////////////////////////////////////////
// setup all those uniforms
...
...
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