diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/doxygen/Doxyfile | 2 | ||||
-rw-r--r-- | doc/python_api/examples/bpy.types.Image.py | 1 | ||||
-rw-r--r-- | doc/python_api/examples/gpu.6.py | 33 |
3 files changed, 34 insertions, 2 deletions
diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile index b8f54f548b4..0176a888377 100644 --- a/doc/doxygen/Doxyfile +++ b/doc/doxygen/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = Blender # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = V3.2 +PROJECT_NUMBER = V3.3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/doc/python_api/examples/bpy.types.Image.py b/doc/python_api/examples/bpy.types.Image.py index 715623f6f76..f0c1a780e24 100644 --- a/doc/python_api/examples/bpy.types.Image.py +++ b/doc/python_api/examples/bpy.types.Image.py @@ -44,4 +44,3 @@ image_dest = image_src.copy() image_dest.update() print(image_dest.size) print(image_dest.pixels[0:4]) - diff --git a/doc/python_api/examples/gpu.6.py b/doc/python_api/examples/gpu.6.py index be164a03028..5576b2d0bfe 100644 --- a/doc/python_api/examples/gpu.6.py +++ b/doc/python_api/examples/gpu.6.py @@ -29,3 +29,36 @@ def draw(): bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL') + +""" +3D Image +-------- + +Similar to the 2D Image shader, but works with 3D positions for the image vertices. +To use this example you have to provide an image that should be displayed. +""" +import bpy +import gpu +from gpu_extras.batch import batch_for_shader + +IMAGE_NAME = "Untitled" +image = bpy.data.images[IMAGE_NAME] +texture = gpu.texture.from_image(image) + +shader = gpu.shader.from_builtin('3D_IMAGE') +batch = batch_for_shader( + shader, 'TRIS', + { + "pos": ((0, 0, 0), (0, 1, 1), (1, 1, 1), (1, 1, 1), (1, 0, 0), (0, 0, 0)), + "texCoord": ((0, 0), (0, 1), (1, 1), (1, 1), (1, 0), (0, 0)), + }, +) + + +def draw(): + shader.bind() + shader.uniform_sampler("image", texture) + batch.draw(shader) + + +bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW') |