Commit ae6e0d00 authored by schultezub's avatar schultezub

added shadow intensity property to SimpleRaycaster

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@304 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 099ffa57
......@@ -78,7 +78,7 @@ namespace TUMVis {
break;
}
// avoid expensive context-switches for contexts without oending jobs.
// avoid expensive context-switches for contexts without pending jobs.
if (a->second->empty())
continue;
......
......@@ -39,11 +39,13 @@ namespace TUMVis {
: RaycastingProcessor(canvasSize, "modules/vis/simpleraycaster.frag", true)
, _targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, _enableShadowing("EnableShadowing", "Enable Hard Shadows", false, InvalidationLevel::INVALID_SHADER)
, _shadowIntensity("ShadowIntensity", "Shadow Intensity", .5f, .0f, 1.f)
{
addDecorator(new ProcessorDecoratorShading());
addProperty(&_enableShadowing);
addProperty(&_targetImageID);
addProperty(&_enableShadowing);
addProperty(&_shadowIntensity);
decoratePropertyCollection(this);
// TODO: remove hack
......@@ -63,6 +65,9 @@ namespace TUMVis {
GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 , GL_COLOR_ATTACHMENT2 };
glDrawBuffers(3, buffers);
if (_enableShadowing.getValue())
_shader->setUniform("_shadowIntensity", _shadowIntensity.getValue());
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDepthFunc(GL_ALWAYS);
QuadRdr.renderQuad();
......
......@@ -57,6 +57,10 @@ uniform vec3 _cameraPosition;
uniform float _samplingStepSize;
#ifdef ENABLE_SHADOWING
uniform float _shadowIntensity;
#endif
// TODO: copy+paste from Voreen - eliminate or improve.
const float SAMPLING_BASE_INTERVAL_RCP = 200.0;
......@@ -104,7 +108,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
|| any(greaterThan(position, vec3(1.0, 1.0, 1.0)));
}
// apply shadow to color
color.rgb *= (1.0 - shadowFactor);
color.rgb *= (1.0 - shadowFactor * _shadowIntensity);
}
#endif
......
......@@ -65,6 +65,7 @@ namespace TUMVis {
DataNameProperty _targetImageID; ///< image ID for output image
BoolProperty _enableShadowing;
FloatProperty _shadowIntensity;
protected:
/// \see RaycastingProcessor::processImpl()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment