[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47860] trunk/blender/source/blender/ compositor: Matched FogGlow with old implementation

Jeroen Bakker j.bakker at atmind.nl
Thu Jun 14 03:32:53 CEST 2012


Revision: 47860
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47860
Author:   jbakker
Date:     2012-06-14 01:32:45 +0000 (Thu, 14 Jun 2012)
Log Message:
-----------
 Matched FogGlow with old implementation

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/CMakeLists.txt
    trunk/blender/source/blender/compositor/nodes/COM_GlareNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_VectorBlurNode.cpp

Added Paths:
-----------
    trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.h

Removed Paths:
-------------
    trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.h

Modified: trunk/blender/source/blender/compositor/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/compositor/CMakeLists.txt	2012-06-14 01:22:48 UTC (rev 47859)
+++ trunk/blender/source/blender/compositor/CMakeLists.txt	2012-06-14 01:32:45 UTC (rev 47860)
@@ -557,8 +557,6 @@
 	operations/COM_ConvolutionEdgeFilterOperation.cpp
 	operations/COM_DilateErodeOperation.cpp
 	operations/COM_DilateErodeOperation.h
-	operations/COM_FogGlowImageOperation.cpp
-	operations/COM_FogGlowImageOperation.h
 	operations/COM_GlareThresholdOperation.cpp
 	operations/COM_GlareThresholdOperation.h
 	operations/COM_GlareBaseOperation.cpp
@@ -569,6 +567,8 @@
 	operations/COM_GlareStreaksOperation.h
 	operations/COM_GlareGhostOperation.cpp
 	operations/COM_GlareGhostOperation.h
+	operations/COM_GlareFogGlowOperation.cpp
+	operations/COM_GlareFogGlowOperation.h
 	operations/COM_SetSamplerOperation.cpp
 	operations/COM_SetSamplerOperation.h
 

Modified: trunk/blender/source/blender/compositor/nodes/COM_GlareNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_GlareNode.cpp	2012-06-14 01:22:48 UTC (rev 47859)
+++ trunk/blender/source/blender/compositor/nodes/COM_GlareNode.cpp	2012-06-14 01:32:45 UTC (rev 47860)
@@ -22,7 +22,6 @@
 
 #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"
@@ -30,6 +29,7 @@
 #include "COM_MixBlendOperation.h"
 #include "COM_FastGaussianBlurOperation.h"
 #include "COM_GlareGhostOperation.h"
+#include "COM_GlareFogGlowOperation.h"
 
 GlareNode::GlareNode(bNode *editorNode): Node(editorNode)
 {
@@ -95,34 +95,25 @@
 	case 1: // fog glow
 		{
 			GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation();
-			FastGaussianBlurOperation* bluroperation = new FastGaussianBlurOperation();
-			SetValueOperation * valueoperation = new SetValueOperation();
+			GlareFogGlowOperation * glareoperation = new GlareFogGlowOperation();
 			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, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0));
 			addLink(system, mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0));
-			addLink(system, bluroperation->getOutputSocket(), mixoperation->getInputSocket(2));
+			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);
-			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);
+			glareoperation->setGlareSettings(glare);
 			mixvalueoperation->setValue(0.5f+glare->mix*0.5f);
-			this->getOutputSocket()->relinkConnections(mixoperation->getOutputSocket());
+			mixoperation->setResolutionInputSocketIndex(1);
 	
-			system->addOperation(bluroperation);
+			system->addOperation(glareoperation);
 			system->addOperation(thresholdOperation);
 			system->addOperation(mixvalueoperation);
-			system->addOperation(valueoperation);
 			system->addOperation(mixoperation);
 		}
 		break;

Modified: trunk/blender/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_VectorBlurNode.cpp	2012-06-14 01:22:48 UTC (rev 47859)
+++ trunk/blender/source/blender/compositor/nodes/COM_VectorBlurNode.cpp	2012-06-14 01:32:45 UTC (rev 47860)
@@ -22,11 +22,7 @@
 
 #include "COM_VectorBlurNode.h"
 #include "DNA_node_types.h"
-#include "COM_FogGlowImageOperation.h"
-#include "COM_BokehBlurOperation.h"
 #include "COM_VectorBlurOperation.h"
-#include "COM_SetValueOperation.h"
-#include "COM_MixBlendOperation.h"
 
 VectorBlurNode::VectorBlurNode(bNode *editorNode): Node(editorNode)
 {

Deleted: trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp	2012-06-14 01:22:48 UTC (rev 47859)
+++ trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp	2012-06-14 01:32:45 UTC (rev 47860)
@@ -1,51 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor: 
- *		Jeroen Bakker 
- *		Monique Dewanchand
- */
-
-#include "COM_FogGlowImageOperation.h"
-#include "BLI_math.h"
-
-FogGlowImageOperation::FogGlowImageOperation(): NodeOperation()
-{
-	this->addOutputSocket(COM_DT_COLOR);
-}
-void FogGlowImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
-{
-	const float cs_r = 1.f, cs_g = 1.f, cs_b = 1.f;
-
-	float u, v, w, d, r;
-	
-	v = 2.f*(y / (float)512) - 1.f;
-	u = 2.f*(x / (float)512) - 1.f;
-	r = (u*u + v*v)*256;
-	d = -sqrtf(sqrtf(sqrtf(r)));
-	w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI));
-	color[0] = expf(d*cs_r) * w;
-	color[1] = expf(d*cs_g) * w;
-	color[2] = expf(d*cs_b) * w;
-	color[3] = 1.0f;
-}
-
-void FogGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
-{
-	resolution[0] = 512;
-	resolution[1] = 512;
-}

Deleted: trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.h	2012-06-14 01:22:48 UTC (rev 47859)
+++ trunk/blender/source/blender/compositor/operations/COM_FogGlowImageOperation.h	2012-06-14 01:32:45 UTC (rev 47860)
@@ -1,39 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor: 
- *		Jeroen Bakker 
- *		Monique Dewanchand
- */
-
-#ifndef _COM_FogGlowOperation_h
-#define _COM_FogGlowOperation_h
-#include "COM_NodeOperation.h"
-#include "DNA_lamp_types.h"
-
-class FogGlowImageOperation : public NodeOperation {
-public:
-	FogGlowImageOperation();
-	
-	/**
-	 * the inner loop of this program
-	 */
-	void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
-	
-	void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
-};
-#endif

Added: trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp	                        (rev 0)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp	2012-06-14 01:32:45 UTC (rev 47860)
@@ -0,0 +1,405 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ *		Jeroen Bakker
+ *		Monique Dewanchand
+ */
+
+#include "COM_GlareFogGlowOperation.h"
+#include "MEM_guardedalloc.h"
+
+/*
+ *  2D Fast Hartley Transform, used for convolution
+ */
+
+typedef float fREAL;
+
+// returns next highest power of 2 of x, as well it's log2 in L2
+static unsigned int nextPow2(unsigned int x, unsigned int* L2)
+{
+	unsigned int pw, x_notpow2 = x & (x-1);
+	*L2 = 0;
+	while (x>>=1) ++(*L2);
+	pw = 1 << (*L2);
+	if (x_notpow2) { (*L2)++;  pw<<=1; }
+	return pw;
+}
+
+//------------------------------------------------------------------------------
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list