Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-02-14 06:17:52 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-02-14 06:17:52 +0300
commit903cc89e3098aea5aa368a82a7fb5765df7c1b5e (patch)
tree4d665f3e4756ddced2fd4af77ea9518a63eeb5aa /source/blender/freestyle/intern/application/AppCanvas.cpp
parentfdaa46063502cc643d282d79824f7590dc8dd7fe (diff)
Added support for pixel-based density and Z depth information.
Availability of pixel-based density and Z depth information depends on passes of a render layer being rendered. - Density information is available if the diffuse pass of the render layer is enabled. It is accessible through the DensityF0D and DensityF1D functions provided by the Freestyle Python API. These functions return 0 if the diffuse pass is disabled. - Z depth information is available if the Z pass is enabled. It can be accessed through LocalAverageDepthF0D and LocalAverageDepthF1D. These functions return 0 if the Z pass is disabled.
Diffstat (limited to 'source/blender/freestyle/intern/application/AppCanvas.cpp')
-rwxr-xr-xsource/blender/freestyle/intern/application/AppCanvas.cpp40
1 files changed, 34 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp
index 848d8ce08bb..4ee7244a7dd 100755
--- a/source/blender/freestyle/intern/application/AppCanvas.cpp
+++ b/source/blender/freestyle/intern/application/AppCanvas.cpp
@@ -109,20 +109,48 @@ void AppCanvas::Erase()
// Abstract
-#include "../image/GaussianFilter.h"
void AppCanvas::readColorPixels(int x,int y,int w, int h, RGBImage& oImage) const
{
- //static unsigned number = 0;
float *rgb = new float[3*w*h];
- //_pViewer->readPixels(x,y,w,h,AppGLWidget::RGB,rgb);
+ memset(rgb, 0, sizeof(float) * 3 * w * h);
+ if (_pass_diffuse) {
+ int rectx = width(), recty = height();
+ int i, ii, j, jj;
+ for (j = 0; j < h; j++) {
+ jj = y + j;
+ if (jj < 0 || jj >= recty)
+ continue;
+ for (i = 0; i < w; i++) {
+ ii = x + i;
+ if (ii < 0 || ii >= rectx)
+ continue;
+ memcpy(rgb + (w * j + i) * 3, _pass_diffuse + (rectx * jj + ii) * 3, sizeof(float) * 3);
+ }
+ }
+ }
oImage.setArray(rgb, width(), height(), w,h, x, y, false);
}
void AppCanvas::readDepthPixels(int x,int y,int w, int h, GrayImage& oImage) const
{
- float *rgb = new float[w*h];
- //_pViewer->readPixels(x,y,w,h,AppGLWidget::DEPTH,rgb);
- oImage.setArray(rgb, width(), height(), w,h, x, y, false);
+ float *z = new float[w*h];
+ memset(z, 0, sizeof(float) * w * h);
+ if (_pass_z) {
+ int rectx = width(), recty = height();
+ int i, ii, j, jj;
+ for (j = 0; j < h; j++) {
+ jj = y + j;
+ if (jj < 0 || jj >= recty)
+ continue;
+ for (i = 0; i < w; i++) {
+ ii = x + i;
+ if (ii < 0 || ii >= rectx)
+ continue;
+ z[w * j + i] = _pass_z[rectx * jj + ii];
+ }
+ }
+ }
+ oImage.setArray(z, width(), height(), w,h, x, y, false);
}
void AppCanvas::RenderStroke(Stroke *iStroke) {