diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2012-10-21 02:28:44 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2012-10-21 02:28:44 +0400 |
commit | 4213eca5fc3b5f2c2b23945e9462b38e13f843c4 (patch) | |
tree | 8f296c8e6847423ec0ded76e04a38efb44543d5c /source/gameengine/VideoTexture/ImageBase.h | |
parent | 7deb8d8a26a63a338b845eae3617111316e015f9 (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/ImageBase.h')
-rw-r--r-- | source/gameengine/VideoTexture/ImageBase.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source/gameengine/VideoTexture/ImageBase.h b/source/gameengine/VideoTexture/ImageBase.h index bb3f0c19e4b..a9f25f61406 100644 --- a/source/gameengine/VideoTexture/ImageBase.h +++ b/source/gameengine/VideoTexture/ImageBase.h @@ -78,6 +78,14 @@ public: bool getFlip (void) { return m_flip; } /// set vertical flip void setFlip (bool flip) { m_flip = flip; } + /// get Z buffer + bool getZbuff (void) { return m_zbuff; } + /// set Z buffer + void setZbuff (bool zbuff) { m_zbuff = zbuff; } + /// get depth + bool getDepth (void) { return m_depth; } + /// set depth + void setDepth (bool depth) { m_depth = depth; } /// get source object PyImage * getSource (const char * id); @@ -111,6 +119,10 @@ protected: bool m_scaleChange; /// flip image vertically bool m_flip; + /// use the Z buffer as a texture + bool m_zbuff; + /// extract the Z buffer with unisgned int precision + bool m_depth; /// source image list ImageSourceList m_sources; @@ -347,7 +359,15 @@ int Image_setFlip (PyImage *self, PyObject *value, void *closure); PyObject *Image_getSource (PyImage *self, PyObject *args); // set filter source object PyObject *Image_setSource (PyImage *self, PyObject *args); - +// get Z buffer +PyObject * Image_getZbuff (PyImage * self, void * closure); +// set Z buffer +int Image_setZbuff (PyImage * self, PyObject * value, void * closure); +// get depth +PyObject * Image_getDepth (PyImage * self, void * closure); +// set depth +int Image_setDepth (PyImage * self, PyObject * value, void * closure); + // get pixel filter object PyObject *Image_getFilter (PyImage *self, void *closure); // set pixel filter object |