diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2012-06-14 07:11:36 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2012-06-14 07:11:36 +0400 |
commit | fac417a3baf132e7d04540e1fbdefe7d3a1fa17b (patch) | |
tree | e167461558b6b239a12a16fefe16df5faeba2137 /source/blender/compositor/nodes/COM_GlareNode.cpp | |
parent | cc82653b728408d5e30524549a419fe20fa6a967 (diff) |
Fixed glares
Diffstat (limited to 'source/blender/compositor/nodes/COM_GlareNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_GlareNode.cpp | 123 |
1 files changed, 29 insertions, 94 deletions
diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp index 6e8e66c83ac..dcb8f3a3a4c 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cpp +++ b/source/blender/compositor/nodes/COM_GlareNode.cpp @@ -26,7 +26,7 @@ #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" @@ -40,109 +40,44 @@ void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext * bNode *node = this->getbNode(); NodeGlare *glare = (NodeGlare*)node->storage; + GlareBaseOperation * glareoperation = NULL; + 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); - } + glareoperation = new GlareGhostOperation(); + break; case 2: // streaks - { - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - GlareStreaksOperation * glareoperation = new GlareStreaksOperation(); - 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); - } + glareoperation = new GlareStreaksOperation(); break; case 1: // fog glow - { - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - GlareFogGlowOperation * glareoperation = new GlareFogGlowOperation(); - 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); - } + glareoperation = new GlareFogGlowOperation(); 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()); + 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); + } |