diff options
Diffstat (limited to 'source/blender/compositor/nodes/COM_GlareNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_GlareNode.cpp | 157 |
1 files changed, 42 insertions, 115 deletions
diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp index dc367040c9a..7b34fa4d286 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cpp +++ b/source/blender/compositor/nodes/COM_GlareNode.cpp @@ -22,136 +22,63 @@ #include "COM_GlareNode.h" #include "DNA_node_types.h" -#include "COM_FogGlowImageOperation.h" #include "COM_GlareThresholdOperation.h" #include "COM_GlareSimpleStarOperation.h" #include "COM_GlareStreaksOperation.h" #include "COM_SetValueOperation.h" -#include "COM_MixBlendOperation.h" +#include "COM_MixGlareOperation.h" #include "COM_FastGaussianBlurOperation.h" #include "COM_GlareGhostOperation.h" +#include "COM_GlareFogGlowOperation.h" -GlareNode::GlareNode(bNode *editorNode): Node(editorNode) +GlareNode::GlareNode(bNode *editorNode) : Node(editorNode) { + /* pass */ } -void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)\ -{ +void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext *context) \ + { bNode *node = this->getbNode(); - NodeGlare *glare = (NodeGlare*)node->storage; - - switch (glare->type) { - - default: - case 3: - { - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - GlareGhostOperation * glareoperation = new GlareGhostOperation(); - SetValueOperation * mixvalueoperation = new SetValueOperation(); - MixBlendOperation * mixoperation = new MixBlendOperation(); - - this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system); - addLink(system, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); - addLink(system, mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); - addLink(system, glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); - addLink(system, thresholdOperation->getInputSocket(0)->getConnection()->getFromSocket(), mixoperation->getInputSocket(1)); - this->getOutputSocket()->relinkConnections(mixoperation->getOutputSocket()); - - thresholdOperation->setThreshold(glare->threshold); - glareoperation->setGlareSettings(glare); - mixvalueoperation->setValue(0.5f+glare->mix*0.5f); - mixoperation->setResolutionInputSocketIndex(1); - - system->addOperation(glareoperation); - system->addOperation(thresholdOperation); - system->addOperation(mixvalueoperation); - system->addOperation(mixoperation); - } - case 2: // streaks - { - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - GlareStreaksOperation * glareoperation = new GlareStreaksOperation(); - SetValueOperation * mixvalueoperation = new SetValueOperation(); - MixBlendOperation * mixoperation = new MixBlendOperation(); + NodeGlare *glare = (NodeGlare *)node->storage; - this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system); - addLink(system, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); - addLink(system, mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); - addLink(system, glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); - addLink(system, thresholdOperation->getInputSocket(0)->getConnection()->getFromSocket(), mixoperation->getInputSocket(1)); - this->getOutputSocket()->relinkConnections(mixoperation->getOutputSocket()); + GlareBaseOperation *glareoperation = NULL; - thresholdOperation->setThreshold(glare->threshold); - glareoperation->setGlareSettings(glare); - mixvalueoperation->setValue(0.5f+glare->mix*0.5f); - mixoperation->setResolutionInputSocketIndex(1); - - system->addOperation(glareoperation); - system->addOperation(thresholdOperation); - system->addOperation(mixvalueoperation); - system->addOperation(mixoperation); - } - break; - case 1: // fog glow - { - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - 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), 0, system); - addLink(system, thresholdOperation->getOutputSocket(), bluroperation->getInputSocket(0)); - 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); - 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()); + switch (glare->type) { - system->addOperation(bluroperation); - system->addOperation(thresholdOperation); - system->addOperation(mixvalueoperation); - system->addOperation(valueoperation); - system->addOperation(mixoperation); - } - break; - - case 0: // simple star - { - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - GlareSimpleStarOperation * glareoperation = new GlareSimpleStarOperation(); - SetValueOperation * mixvalueoperation = new SetValueOperation(); - MixBlendOperation * mixoperation = new MixBlendOperation(); - - this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system); - addLink(system, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); - addLink(system, mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); - addLink(system, glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); - addLink(system, thresholdOperation->getInputSocket(0)->getConnection()->getFromSocket(), mixoperation->getInputSocket(1)); - this->getOutputSocket()->relinkConnections(mixoperation->getOutputSocket()); + default: + case 3: + glareoperation = new GlareGhostOperation(); + break; + case 2: // streaks + glareoperation = new GlareStreaksOperation(); + break; + case 1: // fog glow + glareoperation = new GlareFogGlowOperation(); + break; + case 0: // simple star + glareoperation = new GlareSimpleStarOperation(); + break; + } + GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); + SetValueOperation *mixvalueoperation = new SetValueOperation(); + MixGlareOperation *mixoperation = new MixGlareOperation(); + mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); - thresholdOperation->setThreshold(glare->threshold); - glareoperation->setGlareSettings(glare); - mixvalueoperation->setValue(0.5f+glare->mix*0.5f); - mixoperation->setResolutionInputSocketIndex(1); + this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system); + addLink(system, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); + addLink(system, mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); + addLink(system, glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); + addLink(system, thresholdOperation->getInputSocket(0)->getConnection()->getFromSocket(), mixoperation->getInputSocket(1)); + this->getOutputSocket()->relinkConnections(mixoperation->getOutputSocket()); + thresholdOperation->setGlareSettings(glare); + glareoperation->setGlareSettings(glare); + mixvalueoperation->setValue(0.5f + glare->mix * 0.5f); + mixoperation->setResolutionInputSocketIndex(1); - system->addOperation(glareoperation); - system->addOperation(thresholdOperation); - system->addOperation(mixvalueoperation); - system->addOperation(mixoperation); - } - break; + system->addOperation(glareoperation); + system->addOperation(thresholdOperation); + system->addOperation(mixvalueoperation); + system->addOperation(mixoperation); + } -} |