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:
authorBenoit Bolsee <benoit.bolsee@online.be>2012-10-21 02:28:44 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2012-10-21 02:28:44 +0400
commit4213eca5fc3b5f2c2b23945e9462b38e13f843c4 (patch)
tree8f296c8e6847423ec0ded76e04a38efb44543d5c /source/gameengine/VideoTexture/ImageRender.cpp
parent7deb8d8a26a63a338b845eae3617111316e015f9 (diff)
BGE VideoTexture: add depth buffer access to ImageViewport and ImageRender.
2 new attributes to ImageViewport and ImageRender object: depth: set to True to retrieve the depth buffer as an array of float (not suitable for texture source). zbuff: set to True to retrieve the depth buffer as a grey scale pixel array (suitable for texture source). A new mode 'F' is added to VideoTexture.imageToArray() to allow returning the image buffer as a one dimensional array of float. This mode should only be used to retrieve the depth buffer of ImageViewport and ImageRender objects. Example: viewport = VideoTexture.ImageViewport() viewport.depth = True depth = VideoTexture.imageToArray(viewport,'F') # show depth of bottom left pixel # 1.0 = infinite, 0.0 = on near clip plane. print(depth[0])
Diffstat (limited to 'source/gameengine/VideoTexture/ImageRender.cpp')
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 2135d0a07eb..85857165403 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -385,6 +385,8 @@ static PyGetSetDef imageRenderGetSets[] =
{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbor)", NULL},
{(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+ {(char*)"zbuff", (getter)Image_getZbuff, (setter)Image_setZbuff, (char*)"use depth buffer as texture", NULL},
+ {(char*)"depth", (getter)Image_getDepth, (setter)Image_setDepth, (char*)"get depth information from z-buffer using unsigned int precision", NULL},
{(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
{NULL}
};
@@ -547,6 +549,8 @@ static PyGetSetDef imageMirrorGetSets[] =
{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbor)", NULL},
{(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+ {(char*)"zbuff", (getter)Image_getZbuff, (setter)Image_setZbuff, (char*)"use depth buffer as texture", NULL},
+ {(char*)"depth", (getter)Image_getDepth, (setter)Image_setDepth, (char*)"get depth information from z-buffer using unsigned int precision", NULL},
{(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
{NULL}
};