diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-02 15:33:29 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-02 15:39:09 +0300 |
commit | 8cfca8e1bd85a300732d92b30741d5c243797a31 (patch) | |
tree | 364b1932cf482cee01a510287d972fb042a5db3a /release/scripts/modules/gpu_extras | |
parent | c8ac1280bb7e69bffadff4cf8c8f71f9c0ec6616 (diff) |
PyGPU: only use 3D shaders and rename string enums
Since rB6269d66da, creating formats no longer depends solely on the
shader, but now depends on the dimensions used to fill the VBOs.
This allows 3D shaders to work flawlessly when assigned dimensions are
2D.
So there's no real benefit to us having shaders that are limited to 2D
use anymore.
This limitation makes it difficult to implement other builtin shaders
as they indirectly require a 2D version.
So this commit removes the 2D versions of the builtin sahders used in
Python , renames the string enums but keeps the old enums working for
backward compatibility.
(This brings parts of the changes reviewed in D15836).
Diffstat (limited to 'release/scripts/modules/gpu_extras')
-rw-r--r-- | release/scripts/modules/gpu_extras/presets.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/release/scripts/modules/gpu_extras/presets.py b/release/scripts/modules/gpu_extras/presets.py index eba8d6c161d..f68824d76c8 100644 --- a/release/scripts/modules/gpu_extras/presets.py +++ b/release/scripts/modules/gpu_extras/presets.py @@ -42,7 +42,7 @@ def draw_circle_2d(position, color, radius, *, segments=None): vbo = GPUVertBuf(len=len(verts), format=fmt) vbo.attr_fill(id=pos_id, data=verts) batch = GPUBatch(type='LINE_STRIP', buf=vbo) - shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR') + shader = gpu.shader.from_builtin('UNIFORM_COLOR') batch.program_set(shader) shader.uniform_float("color", color) batch.draw() @@ -67,7 +67,7 @@ def draw_texture_2d(texture, position, width, height): coords = ((0, 0), (1, 0), (1, 1), (0, 1)) - shader = gpu.shader.from_builtin('2D_IMAGE') + shader = gpu.shader.from_builtin('IMAGE') batch = batch_for_shader( shader, 'TRI_FAN', {"pos": coords, "texCoord": coords}, @@ -77,7 +77,7 @@ def draw_texture_2d(texture, position, width, height): gpu.matrix.translate(position) gpu.matrix.scale((width, height)) - shader = gpu.shader.from_builtin('2D_IMAGE') + shader = gpu.shader.from_builtin('IMAGE') shader.bind() if isinstance(texture, int): |