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 /doc | |
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 'doc')
-rw-r--r-- | doc/python_api/rst/bge.texture.rst | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst index 07d83f66bd4..0c9e9da0661 100644 --- a/doc/python_api/rst/bge.texture.rst +++ b/doc/python_api/rst/bge.texture.rst @@ -351,6 +351,15 @@ When the texture object is deleted, the new texture is deleted and the old textu use whole viewport to render + .. attribute:: depth + + use depth component of render as array of float - not suitable for texture source, + should only be used with bge.texture.imageToArray(mode='F') + + .. attribute:: zbuff + + use depth component of render as grey scale color - suitable for texture source + .. class:: ImageViewport() Image source from viewport @@ -399,6 +408,15 @@ When the texture object is deleted, the new texture is deleted and the old textu use whole viewport to capture + .. attribute:: depth + + use depth component of viewport as array of float - not suitable for texture source, + should only be used with bge.texture.imageToArray(mode='F') + + .. attribute:: zbuff + + use depth component of viewport as grey scale color - suitable for texture source + .. class:: Texture(gameObj) Texture objects @@ -518,13 +536,16 @@ When the texture object is deleted, the new texture is deleted and the old textu 0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel. Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order. "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255. + A special mode "F" allows to return the image as an array of float. This mode should only be used to retrieve + the depth buffer of the ImageViewport and ImageRender object. The default mode is "RGBA". + :type mode: string :rtype: :class:`~bgl.buffer` :return: A object representing the image as one dimensional array of bytes of size (pixel_size*width*height), line by line starting from the bottom of the image. The pixel size and format is determined by the mode - parameter. + parameter. For mode 'F', the array is a one dimensional array of float of size (width*height). .. function:: materialID(object,name) |