From 998a850f9f2747065ffe379097907232a85cd2d5 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 21 May 2012 10:20:30 +0000 Subject: Added switch in dilate/erode between old (Step) and new (Distance) algorithm Connected the Glare Fog Flow to use Fast Gaussian in stead of Bokeh blur --- .../compositor/nodes/COM_DilateErodeNode.cpp | 41 ++++++++++++++++------ source/blender/compositor/nodes/COM_GlareNode.cpp | 16 +++++---- 2 files changed, 40 insertions(+), 17 deletions(-) (limited to 'source/blender/compositor/nodes') diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp index 2118f5b8e47..55759ba410f 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp @@ -33,16 +33,37 @@ DilateErodeNode::DilateErodeNode(bNode *editorNode): Node(editorNode) void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) { + bNode *editorNode = this->getbNode(); - DilateErodeOperation *operation = new DilateErodeOperation(); - operation->setDistance(editorNode->custom2); - operation->setInset(2.0f); + if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { + DilateErodeDistanceOperation *operation = new DilateErodeDistanceOperation(); + operation->setDistance(editorNode->custom2); + operation->setInset(editorNode->custom3); + + this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0)); - this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0)); - - AntiAliasOperation * antiAlias = new AntiAliasOperation(); - addLink(graph, operation->getOutputSocket(), antiAlias->getInputSocket(0)); - this->getOutputSocket(0)->relinkConnections(antiAlias->getOutputSocket(0)); - graph->addOperation(operation); - graph->addOperation(antiAlias); + if (editorNode->custom3 < 2.0f) { + AntiAliasOperation * antiAlias = new AntiAliasOperation(); + addLink(graph, operation->getOutputSocket(), antiAlias->getInputSocket(0)); + this->getOutputSocket(0)->relinkConnections(antiAlias->getOutputSocket(0)); + graph->addOperation(antiAlias); + } else { + this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); + } + graph->addOperation(operation); + } else { + if (editorNode->custom2 > 0) { + DilateStepOperation * operation = new DilateStepOperation(); + operation->setIterations(editorNode->custom2); + this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0)); + this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); + graph->addOperation(operation); + } else { + ErodeStepOperation * operation = new ErodeStepOperation(); + operation->setIterations(-editorNode->custom2); + this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0)); + this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); + graph->addOperation(operation); + } + } } diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp index c65adc862b1..e882c16814a 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cpp +++ b/source/blender/compositor/nodes/COM_GlareNode.cpp @@ -23,12 +23,12 @@ #include "COM_GlareNode.h" #include "DNA_node_types.h" #include "COM_FogGlowImageOperation.h" -#include "COM_BokehBlurOperation.h" #include "COM_GlareThresholdOperation.h" #include "COM_GlareSimpleStarOperation.h" #include "COM_GlareStreaksOperation.h" #include "COM_SetValueOperation.h" #include "COM_MixBlendOperation.h" +#include "COM_FastGaussianBlurOperation.h" GlareNode::GlareNode(bNode *editorNode): Node(editorNode) { @@ -70,29 +70,31 @@ void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext * case 1: // fog glow { GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - FogGlowImageOperation * kerneloperation = new FogGlowImageOperation(); - BokehBlurOperation * bluroperation = new BokehBlurOperation(); + FastGaussianBlurOperation* bluroperation = new FastGaussianBlurOperation(); SetValueOperation * valueoperation = new SetValueOperation(); SetValueOperation * mixvalueoperation = new SetValueOperation(); MixBlendOperation * mixoperation = new MixBlendOperation(); mixoperation->setResolutionInputSocketIndex(1); this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), true, 0, system); addLink(system, thresholdOperation->getOutputSocket(), bluroperation->getInputSocket(0)); - addLink(system, kerneloperation->getOutputSocket(), bluroperation->getInputSocket(1)); - addLink(system, valueoperation->getOutputSocket(), bluroperation->getInputSocket(2)); + addLink(system, valueoperation->getOutputSocket(), bluroperation->getInputSocket(1)); addLink(system, mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); addLink(system, bluroperation->getOutputSocket(), mixoperation->getInputSocket(2)); addLink(system, thresholdOperation->getInputSocket(0)->getConnection()->getFromSocket(), mixoperation->getInputSocket(1)); thresholdOperation->setThreshold(glare->threshold); - bluroperation->setSize(0.003f*glare->size); + NodeBlurData * data = new NodeBlurData(); + data->relative = 0; + data->sizex = glare->size; + data->sizey = glare->size; + bluroperation->setData(data); + bluroperation->deleteDataWhenFinished(); bluroperation->setQuality(context->getQuality()); valueoperation->setValue(1.0f); mixvalueoperation->setValue(0.5f+glare->mix*0.5f); this->getOutputSocket()->relinkConnections(mixoperation->getOutputSocket()); system->addOperation(bluroperation); - system->addOperation(kerneloperation); system->addOperation(thresholdOperation); system->addOperation(mixvalueoperation); system->addOperation(valueoperation); -- cgit v1.2.3