[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49953] branches/soc-2011-tomato: svn merge ^/trunk/blender -r49947:49952
Campbell Barton
ideasman42 at gmail.com
Fri Aug 17 15:04:23 CEST 2012
Revision: 49953
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49953
Author: campbellbarton
Date: 2012-08-17 13:04:23 +0000 (Fri, 17 Aug 2012)
Log Message:
-----------
svn merge ^/trunk/blender -r49947:49952
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49947
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehImageOperation.h
branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c
branches/soc-2011-tomato/source/blender/editors/space_node/node_view.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
branches/soc-2011-tomato/source/blender/editors/space_outliner/
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-49947
+ /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-49952
Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehImageOperation.h
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehImageOperation.h 2012-08-17 13:00:11 UTC (rev 49952)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_BokehImageOperation.h 2012-08-17 13:04:23 UTC (rev 49953)
@@ -24,42 +24,125 @@
#define _COM_BokehImageOperation_h
#include "COM_NodeOperation.h"
-
+/**
+ * @brief The BokehImageOperation class is an operation that creates an image useful to mimic the internals
+ *of a camera.
+ *
+ * features:
+ * - number of flaps
+ * - angle offset of the flaps
+ * - rounding of the flaps (also used to make a circular lens)
+ * - simulate catadioptric
+ * - simulate lensshift
+ *
+ * Per pixel the algorithm determines the edge of the bokeh on the same line as the center of the image and the pixel
+ * is evaluating.
+ *
+ * The edge is detected by finding the closest point on the direct line between the two nearest flap-corners.
+ * this edge is interpolated with a full circle.
+ * Result of this edge detection is stored as the distance between the center of the image and the edge.
+ *
+ * catadioptric lenses are simulated to interpolate between the center of the image and the distance of the edge.
+ * We now have three distances:
+ * - distance between the center of the image and the pixel to be evaluated
+ * - distance between the center of the image and the outer-edge
+ * - distance between the center of the image and the inner-edge
+ *
+ * With a simple compare it can be detected if the evaluated pixel is between the outer and inner edge.
+ */
class BokehImageOperation : public NodeOperation {
private:
+ /**
+ * @brief Settings of the bokeh image
+ */
NodeBokehImage *m_data;
+ /**
+ * @brief precalced center of the image
+ */
float m_center[2];
+
+ /**
+ * @brief 1.0-rounding
+ */
float m_inverseRounding;
+
+ /**
+ * @brief distance of a full circle lens
+ */
float m_circularDistance;
+
+ /**
+ * @brief radius when the first flap starts
+ */
float m_flapRad;
+
+ /**
+ * @brief radians of a single flap
+ */
float m_flapRadAdd;
+ /**
+ * @brief should the m_data field by deleted when this operation is finished
+ */
bool m_deleteData;
+ /**
+ * @brief detemine the coordinate of a flap cornder
+ *
+ * @param r result in bokehimage space are stored [x,y]
+ * @param flapNumber the flap number to calculate
+ * @param distance the lens distance is used to simulate lens shifts
+ */
void detemineStartPointOfFlap(float r[2], int flapNumber, float distance);
+
+ /**
+ * @brief Determine if a coordinate is inside the bokeh image
+ *
+ * @param distance the distance that will be used. This parameter is modified a bit to mimic lens shifts
+ * @param x the x coordinate of the pixel to evaluate
+ * @param y the y coordinate of the pixel to evaluate
+ * @return float range 0..1 0 is completely outside
+ */
float isInsideBokeh(float distance, float x, float y);
public:
BokehImageOperation();
/**
- * the inner loop of this program
+ * @brief the inner loop of this program
*/
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
- * Initialize the execution
+ * @brief Initialize the execution
*/
void initExecution();
/**
- * Deinitialize the execution
+ * @brief Deinitialize the execution
*/
void deinitExecution();
+ /**
+ * @brief determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, COM_BLUR_BOKEH_PIXELS]
+ * @param resolution
+ * @param preferredResolution
+ */
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+ /**
+ * @brief set the node data
+ * @param data
+ */
void setData(NodeBokehImage *data) { this->m_data = data; }
+
+ /**
+ * @brief deleteDataOnFinish
+ *
+ * There are cases that the compositor uses this operation on its own (see defocus node)
+ * the deleteDataOnFinish must only be called when the data has been created by the compositor.
+ *It should not be called when the data has been created by the node-editor/user.
+ */
void deleteDataOnFinish() { this->m_deleteData = true; }
};
#endif
Property changes on: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c: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/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-49947
+ /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c: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/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-49952
Modified: branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c 2012-08-17 13:00:11 UTC (rev 49952)
+++ branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c 2012-08-17 13:04:23 UTC (rev 49953)
@@ -2027,7 +2027,7 @@
if (ibuf->rect_float) {
fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
- if (ibuf->profile == IB_PROFILE_LINEAR_RGB) {
+ if (ELEM(ibuf->profile, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE)) {
linearrgb_to_srgb_v3_v3(r_col, fp);
}
else {
@@ -2037,9 +2037,7 @@
}
else if (ibuf->rect) {
cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
- r_col[0] = cp[0] / 255.0f;
- r_col[1] = cp[1] / 255.0f;
- r_col[2] = cp[2] / 255.0f;
+ rgb_uchar_to_float(r_col, cp);
ret = TRUE;
}
}
Modified: branches/soc-2011-tomato/source/blender/editors/space_node/node_view.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_node/node_view.c 2012-08-17 13:00:11 UTC (rev 49952)
+++ branches/soc-2011-tomato/source/blender/editors/space_node/node_view.c 2012-08-17 13:04:23 UTC (rev 49953)
@@ -375,7 +375,7 @@
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
float *fp;
- char *cp;
+ unsigned char *cp;
int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
CLAMP(x, 0, ibuf->x - 1);
@@ -383,8 +383,8 @@
if (ibuf->rect_float) {
fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
-
- if (ibuf->profile == IB_PROFILE_LINEAR_RGB) {
+ /* IB_PROFILE_NONE is default but infact its linear */
+ if (ELEM(ibuf->profile, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE)) {
linearrgb_to_srgb_v3_v3(r_col, fp);
}
else {
@@ -393,10 +393,8 @@
ret = TRUE;
}
else if (ibuf->rect) {
- cp = (char *)(ibuf->rect + y * ibuf->x + x);
- r_col[0] = cp[0] / 255.0f;
- r_col[1] = cp[1] / 255.0f;
- r_col[2] = cp[2] / 255.0f;
+ cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+ rgb_uchar_to_float(r_col, cp);
ret = TRUE;
}
}
@@ -439,7 +437,7 @@
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
float *fp;
- char *cp;
+ unsigned char *cp;
int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
CLAMP(x, 0, ibuf->x - 1);
@@ -451,7 +449,7 @@
info->channels = ibuf->channels;
if (ibuf->rect) {
- cp = (char *)(ibuf->rect + y * ibuf->x + x);
+ cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
info->col[0] = cp[0];
info->col[1] = cp[1];
Property changes on: branches/soc-2011-tomato/source/blender/editors/space_outliner
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-49947
+ /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-49952
Modified: branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c 2012-08-17 13:00:11 UTC (rev 49952)
+++ branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c 2012-08-17 13:04:23 UTC (rev 49953)
@@ -195,11 +195,10 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list