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
ccd73535
Commit
ccd73535
authored
Dec 14, 2011
by
Sebastian Eichelbaum
Browse files
[ADD] - added some options for both effects
parent
0ee166c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
2 deletions
+30
-2
src/core/graphicsEngine/postprocessing/WGEPostprocessingNode.cpp
...e/graphicsEngine/postprocessing/WGEPostprocessingNode.cpp
+8
-0
src/core/graphicsEngine/postprocessing/WGEPostprocessingNode.h
...ore/graphicsEngine/postprocessing/WGEPostprocessingNode.h
+5
-0
src/core/graphicsEngine/postprocessing/WGEPostprocessorCelShading.cpp
...phicsEngine/postprocessing/WGEPostprocessorCelShading.cpp
+1
-1
src/core/graphicsEngine/postprocessing/WGEPostprocessorEdgeEnhance.cpp
...hicsEngine/postprocessing/WGEPostprocessorEdgeEnhance.cpp
+9
-0
src/core/graphicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
...hicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
+7
-1
No files found.
src/core/graphicsEngine/postprocessing/WGEPostprocessingNode.cpp
View file @
ccd73535
...
...
@@ -26,6 +26,7 @@
#include "../../common/WItemSelection.h"
#include "../shaders/WGEShaderPropertyDefineOptions.h"
#include "../callbacks/WGENodeMaskCallback.h"
#include "../WGEUtils.h"
#include "WGEPostprocessor.h"
...
...
@@ -43,6 +44,8 @@ WGEPostprocessingNode::WGEPostprocessingNode( osg::ref_ptr< osg::Camera > refere
// this node has some properties:
boost
::
shared_ptr
<
WItemSelection
>
m_possibleSelections
=
boost
::
shared_ptr
<
WItemSelection
>
(
new
WItemSelection
()
);
m_possibleSelections
->
addItem
(
"None"
,
"No postprocessing."
);
m_showHud
=
m_properties
->
addProperty
(
"Texture Debug"
,
"If set, all intermediate texture are shown on screen for debugging."
,
false
);
m_active
=
m_properties
->
addProperty
(
"Enable"
,
"If set, post-processing is enabled."
,
false
,
true
);
m_activePostprocessor
=
m_properties
->
addProperty
(
"Postprocessor"
,
"Selection one of the postprocessors."
,
m_possibleSelections
->
getSelectorFirst
(),
...
...
@@ -50,12 +53,17 @@ WGEPostprocessingNode::WGEPostprocessingNode( osg::ref_ptr< osg::Camera > refere
WPropertyHelper
::
PC_SELECTONLYONE
::
addTo
(
m_activePostprocessor
);
WPropertyHelper
::
PC_NOTEMPTY
::
addTo
(
m_activePostprocessor
);
// control texture HUD
osg
::
ref_ptr
<
WGENodeMaskCallback
>
textureHudCallback
=
new
WGENodeMaskCallback
(
m_showHud
);
// get available postprocessors and setup the node
WGEPostprocessor
::
ProcessorList
processors
=
WGEPostprocessor
::
getPostprocessors
();
for
(
WGEPostprocessor
::
ProcessorList
::
const_iterator
iter
=
processors
.
begin
();
iter
!=
processors
.
end
();
++
iter
)
{
// offscreen node
osg
::
ref_ptr
<
WGEOffscreenRenderNode
>
offscreen
(
new
WGEOffscreenRenderNode
(
reference
,
width
,
height
,
noHud
)
);
offscreen
->
getTextureHUD
()
->
addUpdateCallback
(
textureHudCallback
);
// the geometry render step
osg
::
ref_ptr
<
WGEOffscreenRenderPass
>
render
=
offscreen
->
addGeometryRenderPass
(
m_childs
,
...
...
src/core/graphicsEngine/postprocessing/WGEPostprocessingNode.h
View file @
ccd73535
...
...
@@ -154,6 +154,11 @@ private:
*/
WPropBool
m_active
;
/**
* Activate to show the texture HUDs
*/
WPropBool
m_showHud
;
/**
* The property containing the currently active method or a combination.
*/
...
...
src/core/graphicsEngine/postprocessing/WGEPostprocessorCelShading.cpp
View file @
ccd73535
...
...
@@ -40,7 +40,7 @@ WGEPostprocessorCelShading::WGEPostprocessorCelShading( osg::ref_ptr< WGEOffscre
"This postprocessor reduces color by binning colors."
)
{
// we also provide a property
WPropInt
bins
=
m_properties
->
addProperty
(
"Number of Bins"
,
"The number of color bins used for cel shading."
,
2
);
WPropInt
bins
=
m_properties
->
addProperty
(
"Number of Bins"
,
"The number of color bins used for cel shading."
,
10
);
bins
->
setMin
(
1
);
bins
->
setMax
(
100
);
...
...
src/core/graphicsEngine/postprocessing/WGEPostprocessorEdgeEnhance.cpp
View file @
ccd73535
...
...
@@ -24,6 +24,7 @@
#include <osg/Camera>
#include "../shaders/WGEPropertyUniform.h"
#include "../shaders/WGEShaderPropertyDefineOptions.h"
#include "WGEPostprocessorEdgeEnhance.h"
...
...
@@ -41,6 +42,12 @@ WGEPostprocessorEdgeEnhance::WGEPostprocessorEdgeEnhance( osg::ref_ptr< WGEOffsc
{
// we also provide a property
WPropBool
whiteEdge
=
m_properties
->
addProperty
(
"White Edge"
,
"If set, the edge is drawn in white instead of black."
,
false
);
WPropDouble
edgeThresholdL
=
m_properties
->
addProperty
(
"Edge Lower Threshold"
,
"Define the edge threshold. Filters way
\"
weak
\"
edges."
,
0.0
);
WPropDouble
edgeThresholdU
=
m_properties
->
addProperty
(
"Edge Upper Threshold"
,
"Define the edge threshold. Filters way
\"
weak
\"
edges."
,
1.0
);
edgeThresholdL
->
setMin
(
0.0
);
edgeThresholdL
->
setMax
(
1.0
);
edgeThresholdU
->
setMin
(
0.0
);
edgeThresholdU
->
setMax
(
1.0
);
// Use the standard postprocessor uber-shader
WGEShader
::
RefPtr
s
=
new
WGEShader
(
"WGEPostprocessor"
);
...
...
@@ -54,6 +61,8 @@ WGEPostprocessorEdgeEnhance::WGEPostprocessorEdgeEnhance( osg::ref_ptr< WGEOffsc
// create the rendering pass
osg
::
ref_ptr
<
WGEOffscreenTexturePass
>
pass
=
offscreen
->
addTextureProcessingPass
(
s
,
"Edge Detection"
);
pass
->
getOrCreateStateSet
()
->
addUniform
(
new
WGEPropertyUniform
<
WPropDouble
>
(
"u_edgeEdgeThresholdUpper"
,
edgeThresholdU
)
);
pass
->
getOrCreateStateSet
()
->
addUniform
(
new
WGEPropertyUniform
<
WPropDouble
>
(
"u_edgeEdgeThresholdLower"
,
edgeThresholdL
)
);
// attach color0 output
m_resultTexture
=
pass
->
attach
(
osg
::
Camera
::
COLOR_BUFFER0
,
GL_RGB
);
...
...
src/core/graphicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
View file @
ccd73535
...
...
@@ -42,6 +42,12 @@
*/
uniform
int
u_celShadingBins
=
2
;
/**
* The threshold used to clip away "unwanted" borders. Basically removes noise
*/
uniform
float
u_edgeEdgeThresholdLower
=
0
.
25
;
uniform
float
u_edgeEdgeThresholdUpper
=
0
.
75
;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Varying
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -96,7 +102,7 @@ float getEdge()
0
.
0
*
edgebl
+
1
.
0
*
edgeb
+
0
.
0
*
edgebr
);
return
edge
;
return
smoothstep
(
u_edgeEdgeThresholdLower
,
u_edgeEdgeThresholdUpper
,
edge
)
;
}
/**
...
...
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