[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48826] branches/soc-2011-tomato: Merging r48813 through r48825 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Wed Jul 11 09:49:09 CEST 2012


Revision: 48826
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48826
Author:   nazgul
Date:     2012-07-11 07:49:08 +0000 (Wed, 11 Jul 2012)
Log Message:
-----------
Merging r48813 through r48825 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48813
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48825

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenlib/intern/voronoi.c
    branches/soc-2011-tomato/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.h
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_OpenCLKernels.cl
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
    branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
    branches/soc-2011-tomato/source/blender/gpu/intern/gpu_draw.c
    branches/soc-2011-tomato/source/gameengine/Ketsji/BL_Texture.cpp

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
    branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.h
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/
    branches/soc-2011-tomato/source/blender/nodes/composite/nodes/node_composite_trackpos.c


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48812
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48825

Modified: branches/soc-2011-tomato/source/blender/blenlib/intern/voronoi.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/intern/voronoi.c	2012-07-11 07:47:09 UTC (rev 48825)
+++ branches/soc-2011-tomato/source/blender/blenlib/intern/voronoi.c	2012-07-11 07:49:08 UTC (rev 48826)
@@ -39,7 +39,7 @@
 #include "BLI_voronoi.h"
 #include "BLI_utildefines.h"
 
-#define VORONOI_EPS 1e-3
+#define VORONOI_EPS 1e-2
 
 enum {
 	voronoiEventType_Site = 0,

Modified: branches/soc-2011-tomato/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/nodes/COM_BokehBlurNode.cpp	2012-07-11 07:47:09 UTC (rev 48825)
+++ branches/soc-2011-tomato/source/blender/compositor/nodes/COM_BokehBlurNode.cpp	2012-07-11 07:49:08 UTC (rev 48826)
@@ -37,32 +37,24 @@
 
 void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
 {
-//	Object *camob = context->getScene()->camera;
+	BokehBlurOperation *operation = new BokehBlurOperation();
+	InputSocket *inputSizeSocket = this->getInputSocket(2);
+	bool connectedSizeSocket = inputSizeSocket->isConnected();
 
-//	if (this->getInputSocket(2)->isConnected()) {
-//		VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
-//		ConvertDepthToRadiusOperation *converter = new ConvertDepthToRadiusOperation();
-//		converter->setfStop(this->getbNode()->custom3);
-//		converter->setCameraObject(camob);
-//		operation->setMaxBlur((int)this->getbNode()->custom4);
-//		operation->setQuality(context->getQuality());
-//		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
-//		this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
-//		this->getInputSocket(2)->relinkConnections(converter->getInputSocket(0), 2, graph);
-//		addLink(graph, converter->getOutputSocket(), operation->getInputSocket(2));
-//		graph->addOperation(operation);
-//		graph->addOperation(converter);
-//		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-//	}
-//	else {
-		BokehBlurOperation *operation = new BokehBlurOperation();
-		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
-		this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
-		this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
-		operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
-		operation->setQuality(context->getQuality());
-		operation->setbNode(this->getbNode());
-		graph->addOperation(operation);
-		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-//	}
+	const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket();
+	const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
+
+	this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+	this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
+	this->getInputSocket(2)->relinkConnections(operation->getInputSocket(3), 2, graph);
+	this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
+	//operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
+	operation->setQuality(context->getQuality());
+	operation->setbNode(this->getbNode());
+	graph->addOperation(operation);
+	this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
+
+	if (!connectedSizeSocket) {
+		operation->setSize(size);
+	}
 }


Property changes on: branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.h
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.cpp	2012-07-11 07:47:09 UTC (rev 48825)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.cpp	2012-07-11 07:49:08 UTC (rev 48826)
@@ -33,12 +33,13 @@
 	this->addInputSocket(COM_DT_COLOR);
 	this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
 	this->addInputSocket(COM_DT_VALUE);
+	this->addInputSocket(COM_DT_VALUE);
 	this->addOutputSocket(COM_DT_COLOR);
 	this->setComplex(true);
 	this->setOpenCL(true);
 
 	this->m_size = 1.0f;
-
+	this->m_sizeavailable = false;
 	this->m_inputProgram = NULL;
 	this->m_inputBokehProgram = NULL;
 	this->m_inputBoundingBoxReader = NULL;
@@ -46,12 +47,18 @@
 
 void *BokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
 {
+	lockMutex();
+	if (!this->m_sizeavailable) {
+		updateSize(memoryBuffers);
+	}
 	void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+	unlockMutex();
 	return buffer;
 }
 
 void BokehBlurOperation::initExecution()
 {
+	initMutex();
 	this->m_inputProgram = getInputSocketReader(0);
 	this->m_inputBokehProgram = getInputSocketReader(1);
 	this->m_inputBoundingBoxReader = getInputSocketReader(2);
@@ -87,7 +94,10 @@
 		int bufferstartx = inputBuffer->getRect()->xmin;
 		int bufferstarty = inputBuffer->getRect()->ymin;
 		int pixelSize = this->m_size * this->getWidth() / 100.0f;
-
+		if (pixelSize==0){
+			this->m_inputProgram->read(color, x, y, COM_PS_NEAREST, inputBuffers);
+			return;
+		}
 		int miny = y - pixelSize;
 		int maxy = y + pixelSize;
 		int minx = x - pixelSize;
@@ -126,6 +136,7 @@
 
 void BokehBlurOperation::deinitExecution()
 {
+	deinitMutex();
 	this->m_inputProgram = NULL;
 	this->m_inputBokehProgram = NULL;
 	this->m_inputBoundingBoxReader = NULL;
@@ -136,10 +147,17 @@
 	rcti newInput;
 	rcti bokehInput;
 
-	newInput.xmax = input->xmax + (this->m_size * this->getWidth() / 100.0f);
-	newInput.xmin = input->xmin - (this->m_size * this->getWidth() / 100.0f);
-	newInput.ymax = input->ymax + (this->m_size * this->getWidth() / 100.0f);
-	newInput.ymin = input->ymin - (this->m_size * this->getWidth() / 100.0f);
+	if (this->m_sizeavailable) {
+		newInput.xmax = input->xmax + (this->m_size * this->getWidth() / 100.0f);
+		newInput.xmin = input->xmin - (this->m_size * this->getWidth() / 100.0f);
+		newInput.ymax = input->ymax + (this->m_size * this->getWidth() / 100.0f);
+		newInput.ymin = input->ymin - (this->m_size * this->getWidth() / 100.0f);
+	} else {
+		newInput.xmax = input->xmax + (10.0f * this->getWidth() / 100.0f);
+		newInput.xmin = input->xmin - (10.0f * this->getWidth() / 100.0f);
+		newInput.ymax = input->ymax + (10.0f * this->getWidth() / 100.0f);
+		newInput.ymin = input->ymin - (10.0f * this->getWidth() / 100.0f);
+	}
 
 	NodeOperation *operation = getInputOperation(1);
 	bokehInput.xmax = operation->getWidth();
@@ -157,6 +175,17 @@
 	if (operation->determineDependingAreaOfInterest(input, readOperation, output) ) {
 		return true;
 	}
+	if (!this->m_sizeavailable) {
+		rcti sizeInput;
+		sizeInput.xmin = 0;
+		sizeInput.ymin = 0;
+		sizeInput.xmax = 5;
+		sizeInput.ymax = 5;
+		operation = getInputOperation(3);
+		if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output) ) {
+			return true;
+		}
+	}
 	return false;
 }
 
@@ -166,7 +195,9 @@
                                        list<cl_kernel> *clKernelsToCleanUp) 
 {
 	cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL);
-
+	if (!this->m_sizeavailable) {
+		updateSize(inputMemoryBuffers);
+	}
 	cl_int radius = this->getWidth() * this->m_size / 100.0f;
 	cl_int step = this->getStep();
 	
@@ -181,3 +212,14 @@
 	
 	device->COM_clEnqueueRange(kernel, outputMemoryBuffer, 9, this);
 }
+
+void BokehBlurOperation::updateSize(MemoryBuffer **memoryBuffers)
+{
+	if (!this->m_sizeavailable) {
+		float result[4];
+		this->getInputSocketReader(3)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
+		this->m_size = result[0];
+		CLAMP(this->m_size, 0.0f, 10.0f);
+		this->m_sizeavailable = true;
+	}
+}

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.h
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.h	2012-07-11 07:47:09 UTC (rev 48825)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehBlurOperation.h	2012-07-11 07:49:08 UTC (rev 48826)
@@ -30,7 +30,9 @@
 	SocketReader *m_inputProgram;
 	SocketReader *m_inputBokehProgram;
 	SocketReader *m_inputBoundingBoxReader;
+	void updateSize(MemoryBuffer **memoryBuffers);
 	float m_size;
+	bool m_sizeavailable;
 	float m_bokehMidX;
 	float m_bokehMidY;
 	float m_bokehDimension;
@@ -55,7 +57,7 @@
 	
 	bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
 
-	void setSize(float size) { this->m_size = size; }
+	void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; }
 	

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list