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
1f068a95
Commit
1f068a95
authored
Jan 06, 2011
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - missed to port DVR and ImaeSpaceLIC to new shader preprocessor scheme.
parent
6bbee087
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
26 deletions
+55
-26
src/graphicsEngine/WGEShaderDefine.h
src/graphicsEngine/WGEShaderDefine.h
+1
-1
src/modules/directVolumeRendering/WMDirectVolumeRendering.cpp
...modules/directVolumeRendering/WMDirectVolumeRendering.cpp
+46
-19
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
+6
-4
src/modules/modules-base.toolbox
src/modules/modules-base.toolbox
+1
-1
src/modules/modules-others.toolbox
src/modules/modules-others.toolbox
+1
-1
No files found.
src/graphicsEngine/WGEShaderDefine.h
View file @
1f068a95
...
...
@@ -129,7 +129,7 @@ WGEShaderDefine< ValueType >::~WGEShaderDefine()
}
template
<
typename
ValueType
>
std
::
string
WGEShaderDefine
<
ValueType
>::
process
(
const
std
::
string
&
file
,
const
std
::
string
&
code
)
const
std
::
string
WGEShaderDefine
<
ValueType
>::
process
(
const
std
::
string
&
/*file*/
,
const
std
::
string
&
code
)
const
{
if
(
!
getActive
()
)
{
...
...
src/modules/directVolumeRendering/WMDirectVolumeRendering.cpp
View file @
1f068a95
...
...
@@ -41,6 +41,8 @@
#include "../../graphicsEngine/WGEManagedGroupNode.h"
#include "../../graphicsEngine/WGEUtils.h"
#include "../../graphicsEngine/WGEShader.h"
#include "../../graphicsEngine/WGEShaderDefine.h"
#include "../../graphicsEngine/WGEShaderDefineOptions.h"
#include "../../graphicsEngine/WGERequirement.h"
#include "../../kernel/WKernel.h"
#include "WMDirectVolumeRendering.xpm"
...
...
@@ -173,6 +175,30 @@ void WMDirectVolumeRendering::moduleMain()
{
m_shader
=
osg
::
ref_ptr
<
WGEShader
>
(
new
WGEShader
(
"WMDirectVolumeRendering"
,
m_localPath
)
);
// setup all the defines needed
// local illumination model
WGEShaderDefineOptions
::
SPtr
illuminationAlgoDefines
=
WGEShaderDefineOptions
::
SPtr
(
new
WGEShaderDefineOptions
(
"LOCALILLUMINATION_NONE"
)
);
illuminationAlgoDefines
->
addOption
(
"LOCALILLUMINATION_PHONG"
);
m_shader
->
addPreprocessor
(
illuminationAlgoDefines
);
// gradient texture settings
WGEShaderDefine
<
std
::
string
>::
SPtr
gradTexSamplerDefine
=
m_shader
->
setDefine
(
"GRADIENTTEXTURE_SAMPLER"
,
std
::
string
(
"tex1"
)
);
WGEShaderDefineSwitch
::
SPtr
gradTexEnableDefine
=
m_shader
->
setDefine
(
"GRADIENTTEXTURE_ENABLED"
);
// transfer function texture settings
WGEShaderDefine
<
std
::
string
>::
SPtr
tfTexSamplerDefine
=
m_shader
->
setDefine
(
"TRANSFERFUNCTION_SAMPLER"
,
std
::
string
(
"tex2"
)
);
WGEShaderDefineSwitch
::
SPtr
tfTexEnableDefine
=
m_shader
->
setDefine
(
"TRANSFERFUNCTION_ENABLED"
);
// jitter
WGEShaderDefine
<
std
::
string
>::
SPtr
jitterSamplerDefine
=
m_shader
->
setDefine
(
"JITTERTEXTURE_SAMPLER"
,
std
::
string
(
"tex3"
)
);
WGEShaderDefine
<
int
>::
SPtr
jitterSizeXDefine
=
m_shader
->
setDefine
(
"JITTERTEXTURE_SIZEX"
,
0
);
WGEShaderDefineSwitch
::
SPtr
jitterEnableDefine
=
m_shader
->
setDefine
(
"JITTERTEXTURE_ENABLED"
);
// opacity correction enabled?
WGEShaderDefineSwitch
::
SPtr
opacityCorrectionEnableDefine
=
m_shader
->
setDefine
(
"OPACITYCORRECTION_ENABLED"
);
// let the main loop awake if the data changes or the properties changed.
m_moduleState
.
setResetable
(
true
,
true
);
m_moduleState
.
add
(
m_input
->
getDataChangedCondition
()
);
...
...
@@ -222,6 +248,9 @@ void WMDirectVolumeRendering::moduleMain()
{
debugLog
()
<<
"Data changed. Uploading new data as texture."
;
// there are several updates. Clear the root node and later on insert the new rendering.
rootNode
->
clear
();
// First, grab the grid
boost
::
shared_ptr
<
WGridRegular3D
>
grid
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
dataSet
->
getGrid
()
);
if
(
!
grid
)
...
...
@@ -255,16 +284,8 @@ void WMDirectVolumeRendering::moduleMain()
// setup illumination
////////////////////////////////////////////////////////////////////////////////////////////////////
size_t
localIlluminationAlgo
=
m_localIlluminationAlgo
->
get
(
true
).
getItemIndexOfSelected
(
0
);
m_shader
->
eraseAllDefines
();
switch
(
localIlluminationAlgo
)
{
case
Phong
:
m_shader
->
setDefine
(
"LOCALILLUMINATION_PHONG"
);
break
;
default:
break
;
}
// set proper illumination define
illuminationAlgoDefines
->
activateOption
(
m_localIlluminationAlgo
->
get
(
true
).
getItemIndexOfSelected
(
0
)
);
// if there is a gradient field available -> apply as texture too
boost
::
shared_ptr
<
WDataSetVector
>
gradients
=
m_gradients
->
getData
();
...
...
@@ -275,8 +296,11 @@ void WMDirectVolumeRendering::moduleMain()
// bind the texture to the node
rootState
->
setTextureAttributeAndModes
(
1
,
gradients
->
getTexture
()
->
getTexture
(),
osg
::
StateAttribute
::
ON
);
rootState
->
addUniform
(
new
osg
::
Uniform
(
"tex1"
,
1
)
);
m_shader
->
setDefine
(
"GRADIENTTEXTURE_SAMPLER"
,
"tex1"
);
m_shader
->
setDefine
(
"GRADIENTTEXTURE_ENABLED"
);
gradTexEnableDefine
->
setActive
(
true
);
}
else
{
gradTexEnableDefine
->
setActive
(
false
);
// disable gradient texture
}
////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -284,6 +308,7 @@ void WMDirectVolumeRendering::moduleMain()
////////////////////////////////////////////////////////////////////////////////////////////////////
// try to load the tf from file if existent
tfTexEnableDefine
->
setActive
(
false
);
if
(
m_tfLoaderEnabled
->
get
(
true
)
)
{
osg
::
ref_ptr
<
osg
::
Image
>
tfImg
=
osgDB
::
readImageFile
(
m_tfLoaderFile
->
get
(
true
).
file_string
()
);
...
...
@@ -296,8 +321,7 @@ void WMDirectVolumeRendering::moduleMain()
// apply it
rootState
->
setTextureAttributeAndModes
(
2
,
tfTexture
,
osg
::
StateAttribute
::
ON
);
rootState
->
addUniform
(
new
osg
::
Uniform
(
"tex2"
,
2
)
);
m_shader
->
setDefine
(
"TRANSFERFUNCTION_SAMPLER"
,
"tex2"
);
m_shader
->
setDefine
(
"TRANSFERFUNCTION_ENABLED"
);
tfTexEnableDefine
->
setActive
(
true
);
// enable it
}
else
{
...
...
@@ -311,6 +335,7 @@ void WMDirectVolumeRendering::moduleMain()
////////////////////////////////////////////////////////////////////////////////////////////////////
// create some random noise
jitterSamplerDefine
->
setActive
(
false
);
if
(
m_stochasticJitterEnabled
->
get
(
true
)
)
{
const
size_t
size
=
64
;
...
...
@@ -322,9 +347,8 @@ void WMDirectVolumeRendering::moduleMain()
randTexture
->
setImage
(
genWhiteNoise
(
size
)
);
rootState
->
setTextureAttributeAndModes
(
3
,
randTexture
,
osg
::
StateAttribute
::
ON
);
rootState
->
addUniform
(
new
osg
::
Uniform
(
"tex3"
,
3
)
);
m_shader
->
setDefine
(
"JITTERTEXTURE_SAMPLER"
,
"tex3"
);
m_shader
->
setDefine
(
"JITTERTEXTURE_SIZEX"
,
size
);
m_shader
->
setDefine
(
"JITTERTEXTURE_ENABLED"
);
jitterSamplerDefine
->
setActive
(
true
);
jitterSizeXDefine
->
setValue
(
size
);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -334,7 +358,11 @@ void WMDirectVolumeRendering::moduleMain()
// create some random noise
if
(
m_opacityCorrectionEnabled
->
get
(
true
)
)
{
m_shader
->
setDefine
(
"OPACITYCORRECTION_ENABLED"
);
opacityCorrectionEnableDefine
->
setActive
(
true
);
}
else
{
opacityCorrectionEnableDefine
->
setActive
(
false
);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -357,7 +385,6 @@ void WMDirectVolumeRendering::moduleMain()
// update node
debugLog
()
<<
"Adding new rendering."
;
rootNode
->
clear
();
rootNode
->
insert
(
cube
);
// insert root node if needed. This way, we ensure that the root node gets added only if the proxy cube has been added AND the bbox
// can be calculated properly by the OSG to ensure the proxy cube is centered in the scene if no other item has been added earlier.
...
...
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
View file @
1f068a95
...
...
@@ -44,6 +44,7 @@
#include "../../graphicsEngine/callbacks/WGEShaderAnimationCallback.h"
#include "../../graphicsEngine/WGEGeodeUtils.h"
#include "../../graphicsEngine/WGEShader.h"
#include "../../graphicsEngine/WGEShaderDefineOptions.h"
#include "../../graphicsEngine/WGEOffscreenRenderPass.h"
#include "../../graphicsEngine/WGEOffscreenRenderNode.h"
#include "../../graphicsEngine/WGEPropertyUniform.h"
...
...
@@ -303,6 +304,9 @@ void WMImageSpaceLIC::moduleMain()
// setup all the passes needed for image space advection
osg
::
ref_ptr
<
WGEShader
>
transformationShader
=
new
WGEShader
(
"WMImageSpaceLIC-Transformation"
,
m_localPath
);
WGEShaderDefineOptions
::
SPtr
availableDataDefines
=
WGEShaderDefineOptions
::
SPtr
(
new
WGEShaderDefineOptions
(
"SCALARDATA"
)
);
availableDataDefines
->
addOption
(
"VECTORDATA"
);
transformationShader
->
addPreprocessor
(
availableDataDefines
);
osg
::
ref_ptr
<
WGEOffscreenRenderPass
>
transformation
=
offscreen
->
addGeometryRenderPass
(
m_output
,
transformationShader
,
...
...
@@ -422,8 +426,7 @@ void WMImageSpaceLIC::moduleMain()
// prepare offscreen render chain
edgeDetection
->
bind
(
randTexture
,
1
);
transformationShader
->
eraseDefine
(
"SCALARDATA"
);
transformationShader
->
setDefine
(
"VECTORDATA"
);
availableDataDefines
->
activateOption
(
1
);
// vector input
transformation
->
bind
(
dataSetVec
->
getTexture
()
->
getTexture
(),
0
);
}
else
if
(
dataSetScal
)
...
...
@@ -439,8 +442,7 @@ void WMImageSpaceLIC::moduleMain()
// prepare offscreen render chain
edgeDetection
->
bind
(
randTexture
,
1
);
transformationShader
->
eraseDefine
(
"VECTORDATA"
);
transformationShader
->
setDefine
(
"SCALARDATA"
);
availableDataDefines
->
activateOption
(
0
);
// scalar input
transformation
->
bind
(
dataSetScal
->
getTexture
()
->
getTexture
(),
0
);
transformation
->
bind
(
randTexture
,
1
);
}
...
...
src/modules/modules-base.toolbox
View file @
1f068a95
...
...
@@ -10,7 +10,7 @@ ADD_SUBDIRECTORY( fiberDisplay )
ADD_SUBDIRECTORY( functionalMRIViewer )
ADD_SUBDIRECTORY( gridRenderer )
ADD_SUBDIRECTORY( hud )
#
ADD_SUBDIRECTORY( imageSpaceLIC )
ADD_SUBDIRECTORY( imageSpaceLIC )
ADD_SUBDIRECTORY( isosurfaceRaytracer )
ADD_SUBDIRECTORY( lic )
ADD_SUBDIRECTORY( marchingCubes )
...
...
src/modules/modules-others.toolbox
View file @
1f068a95
...
...
@@ -13,7 +13,7 @@ ADD_SUBDIRECTORY( dataTypeConversion )
ADD_SUBDIRECTORY( deterministicFTMori )
ADD_SUBDIRECTORY( detTractClustering )
ADD_SUBDIRECTORY( detTractCulling )
#
ADD_SUBDIRECTORY( directVolumeRendering )
ADD_SUBDIRECTORY( directVolumeRendering )
ADD_SUBDIRECTORY( effectiveConnectivityCluster )
ADD_SUBDIRECTORY( fiberDisplaySimple )
ADD_SUBDIRECTORY( fiberParameterColoring )
...
...
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