fake-bpy-module 20240210__py3-none-any.whl → 20240326__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- addon_utils/__init__.pyi +54 -11
- animsys_refactor/__init__.pyi +36 -7
- aud/__init__.pyi +307 -321
- bgl/__init__.pyi +2926 -865
- bl_app_override/__init__.pyi +14 -4
- bl_app_override/helpers/__init__.pyi +24 -3
- bl_app_template_utils/__init__.pyi +19 -5
- bl_console_utils/__init__.pyi +0 -1
- bl_console_utils/autocomplete/__init__.pyi +2 -3
- bl_console_utils/autocomplete/complete_calltip/__init__.pyi +24 -6
- bl_console_utils/autocomplete/complete_import/__init__.pyi +14 -4
- bl_console_utils/autocomplete/complete_namespace/__init__.pyi +24 -6
- bl_console_utils/autocomplete/intellisense/__init__.pyi +9 -3
- bl_i18n_utils/__init__.pyi +2 -3
- bl_i18n_utils/bl_extract_messages/__init__.pyi +74 -16
- bl_i18n_utils/merge_po/__init__.pyi +4 -2
- bl_i18n_utils/settings/__init__.pyi +53 -7
- bl_i18n_utils/utils/__init__.pyi +332 -45
- bl_i18n_utils/utils_cli/__init__.pyi +29 -7
- bl_i18n_utils/utils_languages_menu/__init__.pyi +4 -2
- bl_i18n_utils/utils_rtl/__init__.pyi +9 -3
- bl_keymap_utils/__init__.pyi +2 -3
- bl_keymap_utils/io/__init__.pyi +44 -10
- bl_keymap_utils/keymap_from_toolbar/__init__.pyi +4 -2
- bl_keymap_utils/keymap_hierarchy/__init__.pyi +4 -2
- bl_keymap_utils/platform_helpers/__init__.pyi +9 -3
- bl_keymap_utils/versioning/__init__.pyi +4 -2
- bl_math/__init__.pyi +21 -22
- bl_operators/__init__.pyi +30 -24
- bl_operators/add_mesh_torus/__init__.pyi +171 -38
- bl_operators/anim/__init__.pyi +1065 -227
- bl_operators/assets/__init__.pyi +427 -93
- bl_operators/bmesh/__init__.pyi +0 -1
- bl_operators/bmesh/find_adjacent/__init__.pyi +44 -10
- bl_operators/clip/__init__.pyi +1342 -288
- bl_operators/console/__init__.pyi +647 -141
- bl_operators/constraint/__init__.pyi +524 -113
- bl_operators/file/__init__.pyi +396 -85
- bl_operators/freestyle/__init__.pyi +532 -114
- bl_operators/geometry_nodes/__init__.pyi +2412 -597
- bl_operators/image/__init__.pyi +380 -83
- bl_operators/mesh/__init__.pyi +401 -86
- bl_operators/node/__init__.pyi +1756 -385
- bl_operators/object/__init__.pyi +2022 -553
- bl_operators/object_align/__init__.pyi +145 -32
- bl_operators/object_quick_effects/__init__.pyi +555 -125
- bl_operators/object_randomize_transform/__init__.pyi +136 -33
- bl_operators/presets/__init__.pyi +3516 -709
- bl_operators/rigidbody/__init__.pyi +401 -86
- bl_operators/screen_play_rendered_anim/__init__.pyi +129 -30
- bl_operators/sequencer/__init__.pyi +731 -150
- bl_operators/spreadsheet/__init__.pyi +145 -31
- bl_operators/userpref/__init__.pyi +3416 -825
- bl_operators/uvcalc_follow_active/__init__.pyi +149 -33
- bl_operators/uvcalc_lightmap/__init__.pyi +187 -35
- bl_operators/uvcalc_transform/__init__.pyi +344 -74
- bl_operators/vertexpaint_dirt/__init__.pyi +140 -31
- bl_operators/view3d/__init__.pyi +697 -147
- bl_operators/wm/__init__.pyi +6287 -1534
- bl_previews_utils/__init__.pyi +0 -1
- bl_previews_utils/bl_previews_render/__init__.pyi +34 -8
- bl_rna_utils/__init__.pyi +0 -1
- bl_rna_utils/data_path/__init__.pyi +12 -3
- bl_text_utils/__init__.pyi +0 -1
- bl_text_utils/external_editor/__init__.pyi +4 -2
- bl_ui/__init__.pyi +567 -170
- bl_ui/anim/__init__.pyi +164 -34
- bl_ui/asset_shelf/__init__.pyi +146 -32
- bl_ui/generic_ui_list/__init__.pyi +471 -100
- bl_ui/node_add_menu/__init__.pyi +196 -41
- bl_ui/node_add_menu_compositor/__init__.pyi +3017 -622
- bl_ui/node_add_menu_geometry/__init__.pyi +8075 -1592
- bl_ui/node_add_menu_shader/__init__.pyi +1709 -349
- bl_ui/node_add_menu_texture/__init__.pyi +1502 -306
- bl_ui/properties_animviz/__init__.pyi +32 -3
- bl_ui/properties_collection/__init__.pyi +787 -180
- bl_ui/properties_constraint/__init__.pyi +28635 -5524
- bl_ui/properties_data_armature/__init__.pyi +1905 -449
- bl_ui/properties_data_bone/__init__.pyi +1560 -337
- bl_ui/properties_data_camera/__init__.pyi +2269 -495
- bl_ui/properties_data_curve/__init__.pyi +2362 -535
- bl_ui/properties_data_curves/__init__.pyi +951 -204
- bl_ui/properties_data_empty/__init__.pyi +317 -70
- bl_ui/properties_data_gpencil/__init__.pyi +2924 -735
- bl_ui/properties_data_grease_pencil/__init__.pyi +1631 -189
- bl_ui/properties_data_lattice/__init__.pyi +472 -105
- bl_ui/properties_data_light/__init__.pyi +1570 -338
- bl_ui/properties_data_lightprobe/__init__.pyi +938 -209
- bl_ui/properties_data_mesh/__init__.pyi +3205 -768
- bl_ui/properties_data_metaball/__init__.pyi +774 -171
- bl_ui/properties_data_modifier/__init__.pyi +1554 -329
- bl_ui/properties_data_pointcloud/__init__.pyi +821 -195
- bl_ui/properties_data_shaderfx/__init__.pyi +154 -35
- bl_ui/properties_data_speaker/__init__.pyi +782 -169
- bl_ui/properties_data_volume/__init__.pyi +1243 -282
- bl_ui/properties_freestyle/__init__.pyi +4071 -1031
- bl_ui/properties_grease_pencil_common/__init__.pyi +2399 -484
- bl_ui/properties_mask_common/__init__.pyi +1256 -250
- bl_ui/properties_material/__init__.pyi +2351 -543
- bl_ui/properties_material_gpencil/__init__.pyi +1590 -366
- bl_ui/properties_object/__init__.pyi +2179 -513
- bl_ui/properties_output/__init__.pyi +2956 -706
- bl_ui/properties_paint_common/__init__.pyi +947 -141
- bl_ui/properties_particle/__init__.pyi +8322 -1971
- bl_ui/properties_physics_cloth/__init__.pyi +2254 -509
- bl_ui/properties_physics_common/__init__.pyi +200 -45
- bl_ui/properties_physics_dynamicpaint/__init__.pyi +4454 -966
- bl_ui/properties_physics_field/__init__.pyi +1695 -365
- bl_ui/properties_physics_fluid/__init__.pyi +6127 -1281
- bl_ui/properties_physics_geometry_nodes/__init__.pyi +157 -33
- bl_ui/properties_physics_rigidbody/__init__.pyi +1254 -279
- bl_ui/properties_physics_rigidbody_constraint/__init__.pyi +2053 -484
- bl_ui/properties_physics_softbody/__init__.pyi +2394 -543
- bl_ui/properties_render/__init__.pyi +8312 -1934
- bl_ui/properties_scene/__init__.pyi +2211 -540
- bl_ui/properties_texture/__init__.pyi +4185 -1014
- bl_ui/properties_view_layer/__init__.pyi +2803 -665
- bl_ui/properties_workspace/__init__.pyi +626 -149
- bl_ui/properties_world/__init__.pyi +1092 -235
- bl_ui/space_clip/__init__.pyi +11475 -2806
- bl_ui/space_console/__init__.pyi +967 -203
- bl_ui/space_dopesheet/__init__.pyi +4260 -967
- bl_ui/space_filebrowser/__init__.pyi +4852 -1188
- bl_ui/space_graph/__init__.pyi +3251 -703
- bl_ui/space_image/__init__.pyi +12218 -2968
- bl_ui/space_info/__init__.pyi +964 -201
- bl_ui/space_nla/__init__.pyi +2756 -585
- bl_ui/space_node/__init__.pyi +5661 -1266
- bl_ui/space_outliner/__init__.pyi +2294 -479
- bl_ui/space_properties/__init__.pyi +417 -93
- bl_ui/space_sequencer/__init__.pyi +12436 -3010
- bl_ui/space_spreadsheet/__init__.pyi +184 -37
- bl_ui/space_statusbar/__init__.pyi +135 -31
- bl_ui/space_text/__init__.pyi +2556 -543
- bl_ui/space_time/__init__.pyi +1151 -244
- bl_ui/space_toolsystem_common/__init__.pyi +368 -67
- bl_ui/space_toolsystem_toolbar/__init__.pyi +1378 -229
- bl_ui/space_topbar/__init__.pyi +4214 -888
- bl_ui/space_userpref/__init__.pyi +13920 -3468
- bl_ui/space_view3d/__init__.pyi +42751 -9613
- bl_ui/space_view3d_toolbar/__init__.pyi +16379 -3860
- bl_ui/utils/__init__.pyi +42 -5
- bl_ui_utils/__init__.pyi +0 -1
- bl_ui_utils/bug_report_url/__init__.pyi +4 -2
- bl_ui_utils/layout/__init__.pyi +4 -2
- blend_render_info/__init__.pyi +13 -4
- blf/__init__.pyi +15 -18
- bmesh/__init__.pyi +18 -18
- bmesh/geometry/__init__.pyi +5 -6
- bmesh/ops/__init__.pyi +1337 -1158
- bmesh/types/__init__.pyi +464 -374
- bmesh/utils/__init__.pyi +64 -70
- bpy/__init__.pyi +6 -7
- bpy/app/__init__.pyi +36 -38
- bpy/app/handlers/__init__.pyi +37 -38
- bpy/app/icons/__init__.pyi +8 -11
- bpy/app/timers/__init__.pyi +18 -17
- bpy/app/translations/__init__.pyi +32 -30
- bpy/msgbus/__init__.pyi +25 -20
- bpy/ops/__init__.pyi +63 -64
- bpy/ops/action/__init__.pyi +408 -436
- bpy/ops/anim/__init__.pyi +459 -577
- bpy/ops/armature/__init__.pyi +396 -498
- bpy/ops/asset/__init__.pyi +187 -213
- bpy/ops/boid/__init__.pyi +50 -68
- bpy/ops/brush/__init__.pyi +72 -97
- bpy/ops/buttons/__init__.pyi +202 -193
- bpy/ops/cachefile/__init__.pyi +198 -188
- bpy/ops/camera/__init__.pyi +24 -31
- bpy/ops/clip/__init__.pyi +1021 -1082
- bpy/ops/cloth/__init__.pyi +11 -15
- bpy/ops/collection/__init__.pyi +36 -51
- bpy/ops/console/__init__.pyi +155 -209
- bpy/ops/constraint/__init__.pyi +286 -254
- bpy/ops/curve/__init__.pyi +597 -659
- bpy/ops/curves/__init__.pyi +191 -225
- bpy/ops/cycles/__init__.pyi +21 -30
- bpy/ops/dpaint/__init__.pyi +34 -47
- bpy/ops/ed/__init__.pyi +160 -176
- bpy/ops/export_anim/__init__.pyi +51 -34
- bpy/ops/export_mesh/__init__.pyi +47 -45
- bpy/ops/export_scene/__init__.pyi +659 -504
- bpy/ops/file/__init__.pyi +469 -474
- bpy/ops/fluid/__init__.pyi +89 -119
- bpy/ops/font/__init__.pyi +325 -361
- bpy/ops/geometry/__init__.pyi +86 -114
- bpy/ops/gizmogroup/__init__.pyi +22 -28
- bpy/ops/gpencil/__init__.pyi +1900 -1976
- bpy/ops/graph/__init__.pyi +875 -894
- bpy/ops/grease_pencil/__init__.pyi +572 -508
- bpy/ops/image/__init__.pyi +805 -855
- bpy/ops/import_anim/__init__.pyi +66 -46
- bpy/ops/import_curve/__init__.pyi +7 -11
- bpy/ops/import_mesh/__init__.pyi +19 -25
- bpy/ops/import_scene/__init__.pyi +164 -147
- bpy/ops/info/__init__.pyi +88 -85
- bpy/ops/lattice/__init__.pyi +86 -90
- bpy/ops/marker/__init__.pyi +135 -146
- bpy/ops/mask/__init__.pyi +372 -436
- bpy/ops/material/__init__.pyi +18 -25
- bpy/ops/mball/__init__.pyi +93 -99
- bpy/ops/mesh/__init__.pyi +2525 -2664
- bpy/ops/nla/__init__.pyi +398 -455
- bpy/ops/node/__init__.pyi +1015 -1207
- bpy/ops/object/__init__.pyi +3423 -3390
- bpy/ops/outliner/__init__.pyi +667 -685
- bpy/ops/paint/__init__.pyi +719 -672
- bpy/ops/paintcurve/__init__.pyi +64 -85
- bpy/ops/palette/__init__.pyi +48 -67
- bpy/ops/particle/__init__.pyi +323 -367
- bpy/ops/pose/__init__.pyi +569 -474
- bpy/ops/poselib/__init__.pyi +77 -100
- bpy/ops/preferences/__init__.pyi +460 -512
- bpy/ops/ptcache/__init__.pyi +46 -63
- bpy/ops/render/__init__.pyi +121 -155
- bpy/ops/rigidbody/__init__.pyi +148 -143
- bpy/ops/scene/__init__.pyi +336 -380
- bpy/ops/screen/__init__.pyi +454 -530
- bpy/ops/script/__init__.pyi +19 -28
- bpy/ops/sculpt/__init__.pyi +734 -587
- bpy/ops/sculpt_curves/__init__.pyi +51 -56
- bpy/ops/sequencer/__init__.pyi +1617 -1500
- bpy/ops/sound/__init__.pyi +392 -315
- bpy/ops/spreadsheet/__init__.pyi +31 -42
- bpy/ops/surface/__init__.pyi +198 -163
- bpy/ops/text/__init__.pyi +479 -545
- bpy/ops/text_editor/__init__.pyi +11 -15
- bpy/ops/texture/__init__.pyi +26 -36
- bpy/ops/transform/__init__.pyi +825 -941
- bpy/ops/ui/__init__.pyi +246 -295
- bpy/ops/uilist/__init__.pyi +34 -38
- bpy/ops/uv/__init__.pyi +912 -824
- bpy/ops/view2d/__init__.pyi +157 -197
- bpy/ops/view3d/__init__.pyi +777 -878
- bpy/ops/wm/__init__.pyi +4102 -3595
- bpy/ops/workspace/__init__.pyi +42 -58
- bpy/ops/world/__init__.pyi +6 -9
- bpy/path/__init__.pyi +166 -109
- bpy/props/__init__.pyi +478 -395
- bpy/types/__init__.pyi +87194 -81467
- bpy/utils/__init__.pyi +325 -169
- bpy/utils/previews/__init__.pyi +108 -21
- bpy/utils/units/__init__.pyi +37 -39
- bpy_extras/__init__.pyi +4 -9
- bpy_extras/anim_utils/__init__.pyi +25 -55
- bpy_extras/asset_utils/__init__.pyi +3 -13
- bpy_extras/id_map_utils/__init__.pyi +1 -4
- bpy_extras/image_utils/__init__.pyi +33 -23
- bpy_extras/io_utils/__init__.pyi +116 -66
- bpy_extras/keyconfig_utils/__init__.pyi +5 -3
- bpy_extras/mesh_utils/__init__.pyi +42 -34
- bpy_extras/node_utils/__init__.pyi +4 -4
- bpy_extras/object_utils/__init__.pyi +58 -43
- bpy_extras/view3d_utils/__init__.pyi +64 -63
- bpy_restrict_state/__init__.pyi +14 -2
- bpy_types/__init__.pyi +3873 -998
- console_python/__init__.pyi +41 -8
- console_shell/__init__.pyi +24 -6
- {fake_bpy_module-20240210.dist-info → fake_bpy_module-20240326.dist-info}/METADATA +1 -1
- fake_bpy_module-20240326.dist-info/RECORD +343 -0
- {fake_bpy_module-20240210.dist-info → fake_bpy_module-20240326.dist-info}/WHEEL +1 -1
- freestyle/__init__.pyi +4 -5
- freestyle/chainingiterators/__init__.pyi +229 -73
- freestyle/functions/__init__.pyi +624 -402
- freestyle/predicates/__init__.pyi +381 -169
- freestyle/shaders/__init__.pyi +424 -155
- freestyle/types/__init__.pyi +1572 -726
- freestyle/utils/ContextFunctions/__init__.pyi +54 -43
- freestyle/utils/__init__.pyi +67 -31
- gpu/__init__.pyi +3 -4
- gpu/capabilities/__init__.pyi +57 -37
- gpu/matrix/__init__.pyi +14 -17
- gpu/platform/__init__.pyi +5 -6
- gpu/select/__init__.pyi +2 -5
- gpu/shader/__init__.pyi +14 -12
- gpu/state/__init__.pyi +48 -62
- gpu/texture/__init__.pyi +7 -7
- gpu/types/__init__.pyi +670 -229
- gpu_extras/__init__.pyi +1 -2
- gpu_extras/batch/__init__.pyi +27 -6
- gpu_extras/presets/__init__.pyi +67 -27
- graphviz_export/__init__.pyi +9 -3
- idprop/__init__.pyi +0 -1
- idprop/types/__init__.pyi +42 -13
- imbuf/__init__.pyi +6 -10
- imbuf/types/__init__.pyi +8 -16
- keyingsets_builtins/__init__.pyi +3149 -702
- keyingsets_utils/__init__.pyi +69 -15
- mathutils/__init__.pyi +951 -876
- mathutils/bvhtree/__init__.pyi +47 -48
- mathutils/geometry/__init__.pyi +237 -242
- mathutils/interpolate/__init__.pyi +3 -6
- mathutils/kdtree/__init__.pyi +23 -26
- mathutils/noise/__init__.pyi +50 -51
- nodeitems_builtins/__init__.pyi +50 -11
- nodeitems_utils/__init__.pyi +58 -11
- rna_info/__init__.pyi +230 -27
- rna_keymap_ui/__init__.pyi +29 -7
- rna_prop_ui/__init__.pyi +69 -13
- rna_xml/__init__.pyi +29 -7
- sys_info/__init__.pyi +4 -2
- bpy_extras/bmesh_utils/__init__.pyi +0 -7
- bpy_extras/extensions/__init__.pyi +0 -5
- bpy_extras/extensions/junction_module/__init__.pyi +0 -13
- bpy_extras/node_shader_utils/__init__.pyi +0 -132
- bpy_extras/wm_utils/__init__.pyi +0 -5
- bpy_extras/wm_utils/progress_report/__init__.pyi +0 -30
- fake_bpy_module-20240210.dist-info/RECORD +0 -349
- {fake_bpy_module-20240210.dist-info → fake_bpy_module-20240326.dist-info}/top_level.txt +0 -0
gpu/types/__init__.pyi
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import sys
|
|
2
1
|
import typing
|
|
3
2
|
import bpy.types
|
|
4
3
|
import mathutils
|
|
@@ -6,173 +5,178 @@ import mathutils
|
|
|
6
5
|
GenericType = typing.TypeVar("GenericType")
|
|
7
6
|
|
|
8
7
|
class Buffer:
|
|
9
|
-
"""For Python access to GPU functions requiring a pointer.
|
|
8
|
+
"""For Python access to GPU functions requiring a pointer.return the buffer as a list"""
|
|
10
9
|
|
|
11
10
|
dimensions: typing.Any
|
|
12
|
-
""" Undocumented, consider
|
|
11
|
+
""" Undocumented, consider contributing."""
|
|
13
12
|
|
|
14
13
|
class GPUBatch:
|
|
15
|
-
"""Reusable container for drawable geometry.
|
|
14
|
+
"""Reusable container for drawable geometry."""
|
|
16
15
|
|
|
17
|
-
def draw(self, program:
|
|
16
|
+
def draw(self, program: GPUShader = None):
|
|
18
17
|
"""Run the drawing program with the parameters assigned to the batch.
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
:param program: Program that performs the drawing operations.
|
|
20
|
+
If None is passed, the last program set to this batch will run.
|
|
21
|
+
:type program: GPUShader
|
|
22
22
|
"""
|
|
23
23
|
...
|
|
24
24
|
|
|
25
25
|
def draw_instanced(
|
|
26
|
-
self, program:
|
|
26
|
+
self, program: GPUShader, instance_start: int = 0, instance_count: int = 0
|
|
27
27
|
):
|
|
28
|
-
"""Draw multiple instances of the drawing program with the parameters assigned
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
"""Draw multiple instances of the drawing program with the parameters assigned
|
|
29
|
+
to the batch. In the vertex shader, gl_InstanceID will contain the instance
|
|
30
|
+
number being drawn.
|
|
31
|
+
|
|
32
|
+
:param program: Program that performs the drawing operations.
|
|
33
|
+
:type program: GPUShader
|
|
34
|
+
:param instance_start: Number of the first instance to draw.
|
|
35
|
+
:type instance_start: int
|
|
36
|
+
:param instance_count: Number of instances to draw. When not provided or set to 0
|
|
37
|
+
the number of instances will be determined by the number of rows in the first
|
|
38
|
+
vertex buffer.
|
|
39
|
+
:type instance_count: int
|
|
36
40
|
"""
|
|
37
41
|
...
|
|
38
42
|
|
|
39
|
-
def draw_range(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
def draw_range(self, program: GPUShader, elem_start: int = 0, elem_count: int = 0):
|
|
44
|
+
"""Run the drawing program with the parameters assigned to the batch. Only draw
|
|
45
|
+
the elem_count elements of the index buffer starting at elem_start
|
|
46
|
+
|
|
47
|
+
:param program: Program that performs the drawing operations.
|
|
48
|
+
:type program: GPUShader
|
|
49
|
+
:param elem_start: First index to draw. When not provided or set to 0 drawing
|
|
50
|
+
will start from the first element of the index buffer.
|
|
51
|
+
:type elem_start: int
|
|
52
|
+
:param elem_count: Number of elements of the index buffer to draw. When not
|
|
53
|
+
provided or set to 0 all elements from elem_start to the end of the
|
|
54
|
+
index buffer will be drawn.
|
|
55
|
+
:type elem_count: int
|
|
50
56
|
"""
|
|
51
57
|
...
|
|
52
58
|
|
|
53
|
-
def program_set(self, program:
|
|
54
|
-
"""Assign a shader to this batch that will be used for drawing when not overwritten later.
|
|
59
|
+
def program_set(self, program: GPUShader):
|
|
60
|
+
"""Assign a shader to this batch that will be used for drawing when not overwritten later.
|
|
61
|
+
Note: This method has to be called in the draw context that the batch will be drawn in.
|
|
62
|
+
This function does not need to be called when you always
|
|
63
|
+
set the shader when calling `gpu.types.GPUBatch.draw`.
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
:param program: The program/shader the batch will use in future draw calls.
|
|
66
|
+
:type program: GPUShader
|
|
58
67
|
"""
|
|
59
68
|
...
|
|
60
69
|
|
|
61
|
-
def vertbuf_add(self, buf:
|
|
62
|
-
"""Add another vertex buffer to the Batch.
|
|
70
|
+
def vertbuf_add(self, buf: GPUVertBuf):
|
|
71
|
+
"""Add another vertex buffer to the Batch.
|
|
72
|
+
It is not possible to add more vertices to the batch using this method.
|
|
73
|
+
Instead it can be used to add more attributes to the existing vertices.
|
|
74
|
+
A good use case would be when you have a separate
|
|
75
|
+
vertex buffer for vertex positions and vertex normals.
|
|
76
|
+
Current a batch can have at most 16 vertex buffers.
|
|
63
77
|
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
:param buf: The vertex buffer that will be added to the batch.
|
|
79
|
+
:type buf: GPUVertBuf
|
|
66
80
|
"""
|
|
67
81
|
...
|
|
68
82
|
|
|
69
83
|
class GPUFrameBuffer:
|
|
70
|
-
"""This object gives access to framebuffer functionalities.
|
|
84
|
+
"""This object gives access to framebuffer functionalities.
|
|
85
|
+
When a 'layer' is specified in a argument, a single layer of a 3D or array texture is attached to the frame-buffer.
|
|
86
|
+
For cube map textures, layer is translated into a cube map face.
|
|
87
|
+
"""
|
|
71
88
|
|
|
72
89
|
is_bound: typing.Any
|
|
73
90
|
""" Checks if this is the active framebuffer in the context."""
|
|
74
91
|
|
|
75
|
-
|
|
76
|
-
def bind():
|
|
92
|
+
def bind(self):
|
|
77
93
|
"""Context manager to ensure balanced bind calls, even in the case of an error."""
|
|
78
94
|
...
|
|
79
95
|
|
|
80
|
-
def clear(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"""Fill color, depth and stencil textures with specific value. Common values: color=(0.0, 0.0, 0.0, 1.0), depth=1.0, stencil=0.
|
|
96
|
+
def clear(self, color=None, depth: float = None, stencil: int = None):
|
|
97
|
+
"""Fill color, depth and stencil textures with specific value.
|
|
98
|
+
Common values: color=(0.0, 0.0, 0.0, 1.0), depth=1.0, stencil=0.
|
|
84
99
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
:type stencil: int
|
|
100
|
+
:param color: float sequence each representing (r, g, b, a).
|
|
101
|
+
:param depth: depth value.
|
|
102
|
+
:type depth: float
|
|
103
|
+
:param stencil: stencil value.
|
|
104
|
+
:type stencil: int
|
|
91
105
|
"""
|
|
92
106
|
...
|
|
93
107
|
|
|
94
|
-
@staticmethod
|
|
95
108
|
def read_color(
|
|
109
|
+
self,
|
|
96
110
|
x: int,
|
|
97
|
-
y
|
|
98
|
-
xsize
|
|
99
|
-
ysize
|
|
111
|
+
y,
|
|
112
|
+
xsize,
|
|
113
|
+
ysize,
|
|
100
114
|
channels: int,
|
|
101
115
|
slot: int,
|
|
102
116
|
format: str,
|
|
103
|
-
data:
|
|
104
|
-
) ->
|
|
117
|
+
data: Buffer = None,
|
|
118
|
+
) -> Buffer:
|
|
105
119
|
"""Read a block of pixels from the frame buffer.
|
|
106
120
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
:rtype: 'Buffer'
|
|
124
|
-
:return: The Buffer with the read pixels.
|
|
121
|
+
:param x: Lower left corner of a rectangular block of pixels.
|
|
122
|
+
:type x: int
|
|
123
|
+
:param y:
|
|
124
|
+
:param xsize: Dimensions of the pixel rectangle.
|
|
125
|
+
:param ysize:
|
|
126
|
+
:param channels: Number of components to read.
|
|
127
|
+
:type channels: int
|
|
128
|
+
:param slot: The framebuffer slot to read data from.
|
|
129
|
+
:type slot: int
|
|
130
|
+
:param format: The format that describes the content of a single channel.
|
|
131
|
+
Possible values are FLOAT, INT, UINT, UBYTE, UINT_24_8 and 10_11_11_REV.
|
|
132
|
+
:type format: str
|
|
133
|
+
:param data: Optional Buffer object to fill with the pixels values.
|
|
134
|
+
:type data: Buffer
|
|
135
|
+
:return: The Buffer with the read pixels.
|
|
136
|
+
:rtype: Buffer
|
|
125
137
|
"""
|
|
126
138
|
...
|
|
127
139
|
|
|
128
|
-
|
|
129
|
-
def read_depth(
|
|
130
|
-
x: int, y: int, xsize: int, ysize: int, data: "Buffer" = "data"
|
|
131
|
-
) -> "Buffer":
|
|
140
|
+
def read_depth(self, x: int, y, xsize: int, ysize, data: Buffer = None) -> Buffer:
|
|
132
141
|
"""Read a pixel depth block from the frame buffer.
|
|
133
142
|
|
|
134
143
|
:param x: Lower left corner of a rectangular block of pixels.
|
|
135
144
|
:type x: int
|
|
136
|
-
:param y:
|
|
137
|
-
:type y: int
|
|
145
|
+
:param y:
|
|
138
146
|
:param xsize: Dimensions of the pixel rectangle.
|
|
139
147
|
:type xsize: int
|
|
140
|
-
:param ysize:
|
|
141
|
-
:type ysize: int
|
|
148
|
+
:param ysize:
|
|
142
149
|
:param data: Optional Buffer object to fill with the pixels values.
|
|
143
|
-
:type data:
|
|
144
|
-
:rtype: 'Buffer'
|
|
150
|
+
:type data: Buffer
|
|
145
151
|
:return: The Buffer with the read pixels.
|
|
152
|
+
:rtype: Buffer
|
|
146
153
|
"""
|
|
147
154
|
...
|
|
148
155
|
|
|
149
|
-
|
|
150
|
-
def viewport_get():
|
|
156
|
+
def viewport_get(self):
|
|
151
157
|
"""Returns position and dimension to current viewport."""
|
|
152
158
|
...
|
|
153
159
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
160
|
+
def viewport_set(self, x: int, y, xsize: int, ysize):
|
|
161
|
+
"""Set the viewport for this framebuffer object.
|
|
162
|
+
Note: The viewport state is not saved upon framebuffer rebind.
|
|
157
163
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
:param ysize: width and height of the viewport_set.
|
|
165
|
-
:type ysize: int
|
|
164
|
+
:param x: lower left corner of the viewport_set rectangle, in pixels.
|
|
165
|
+
:type x: int
|
|
166
|
+
:param y:
|
|
167
|
+
:param xsize: width and height of the viewport_set.
|
|
168
|
+
:type xsize: int
|
|
169
|
+
:param ysize:
|
|
166
170
|
"""
|
|
167
171
|
...
|
|
168
172
|
|
|
169
173
|
class GPUIndexBuf:
|
|
170
|
-
"""Contains an index buffer.
|
|
174
|
+
"""Contains an index buffer."""
|
|
171
175
|
|
|
172
176
|
...
|
|
173
177
|
|
|
174
178
|
class GPUOffScreen:
|
|
175
|
-
"""This object gives access to off screen buffers.
|
|
179
|
+
"""This object gives access to off screen buffers."""
|
|
176
180
|
|
|
177
181
|
color_texture: int
|
|
178
182
|
""" OpenGL bindcode for the color texture.
|
|
@@ -186,10 +190,10 @@ class GPUOffScreen:
|
|
|
186
190
|
:type: int
|
|
187
191
|
"""
|
|
188
192
|
|
|
189
|
-
texture_color:
|
|
193
|
+
texture_color: GPUTexture
|
|
190
194
|
""" The color texture attached.
|
|
191
195
|
|
|
192
|
-
:type:
|
|
196
|
+
:type: GPUTexture
|
|
193
197
|
"""
|
|
194
198
|
|
|
195
199
|
width: int
|
|
@@ -198,36 +202,35 @@ class GPUOffScreen:
|
|
|
198
202
|
:type: int
|
|
199
203
|
"""
|
|
200
204
|
|
|
201
|
-
|
|
202
|
-
def bind():
|
|
205
|
+
def bind(self):
|
|
203
206
|
"""Context manager to ensure balanced bind calls, even in the case of an error."""
|
|
204
207
|
...
|
|
205
208
|
|
|
206
209
|
def draw_view3d(
|
|
207
210
|
self,
|
|
208
|
-
scene:
|
|
209
|
-
view_layer:
|
|
210
|
-
view3d:
|
|
211
|
-
region:
|
|
212
|
-
view_matrix: typing.Union[typing.Sequence[float],
|
|
213
|
-
projection_matrix: typing.Union[typing.Sequence[float],
|
|
211
|
+
scene: bpy.types.Scene,
|
|
212
|
+
view_layer: bpy.types.ViewLayer,
|
|
213
|
+
view3d: bpy.types.SpaceView3D,
|
|
214
|
+
region: bpy.types.Region,
|
|
215
|
+
view_matrix: typing.Union[typing.Sequence[float], mathutils.Matrix],
|
|
216
|
+
projection_matrix: typing.Union[typing.Sequence[float], mathutils.Matrix],
|
|
214
217
|
do_color_management: bool = False,
|
|
215
218
|
draw_background: bool = True,
|
|
216
219
|
):
|
|
217
220
|
"""Draw the 3d viewport in the offscreen object.
|
|
218
221
|
|
|
219
222
|
:param scene: Scene to draw.
|
|
220
|
-
:type scene:
|
|
223
|
+
:type scene: bpy.types.Scene
|
|
221
224
|
:param view_layer: View layer to draw.
|
|
222
|
-
:type view_layer:
|
|
225
|
+
:type view_layer: bpy.types.ViewLayer
|
|
223
226
|
:param view3d: 3D View to get the drawing settings from.
|
|
224
|
-
:type view3d:
|
|
227
|
+
:type view3d: bpy.types.SpaceView3D
|
|
225
228
|
:param region: Region of the 3D View (required as temporary draw target).
|
|
226
|
-
:type region:
|
|
227
|
-
:param view_matrix: View Matrix (e.g.
|
|
228
|
-
:type view_matrix: typing.Union[typing.Sequence[float],
|
|
229
|
-
:param projection_matrix: Projection Matrix (e.g.
|
|
230
|
-
:type projection_matrix: typing.Union[typing.Sequence[float],
|
|
229
|
+
:type region: bpy.types.Region
|
|
230
|
+
:param view_matrix: View Matrix (e.g. camera.matrix_world.inverted()).
|
|
231
|
+
:type view_matrix: typing.Union[typing.Sequence[float], mathutils.Matrix]
|
|
232
|
+
:param projection_matrix: Projection Matrix (e.g. camera.calc_matrix_camera(...)).
|
|
233
|
+
:type projection_matrix: typing.Union[typing.Sequence[float], mathutils.Matrix]
|
|
231
234
|
:param do_color_management: Color manage the output.
|
|
232
235
|
:type do_color_management: bool
|
|
233
236
|
:param draw_background: Draw background.
|
|
@@ -236,7 +239,10 @@ class GPUOffScreen:
|
|
|
236
239
|
...
|
|
237
240
|
|
|
238
241
|
def free(self):
|
|
239
|
-
"""Free the offscreen object.
|
|
242
|
+
"""Free the offscreen object.
|
|
243
|
+
The framebuffer, texture and render objects will no longer be accessible.
|
|
244
|
+
|
|
245
|
+
"""
|
|
240
246
|
...
|
|
241
247
|
|
|
242
248
|
def unbind(self, restore: bool = True):
|
|
@@ -248,7 +254,15 @@ class GPUOffScreen:
|
|
|
248
254
|
...
|
|
249
255
|
|
|
250
256
|
class GPUShader:
|
|
251
|
-
"""GPUShader combines multiple GLSL shaders into a program used for drawing.
|
|
257
|
+
"""GPUShader combines multiple GLSL shaders into a program used for drawing.
|
|
258
|
+
It must contain at least a vertex and fragment shaders.The GLSL #version directive is automatically included at the top of shaders,
|
|
259
|
+
and set to 330. Some preprocessor directives are automatically added according to
|
|
260
|
+
the Operating System or availability: GPU_ATI, GPU_NVIDIA and GPU_INTEL.The following extensions are enabled by default if supported by the GPU:
|
|
261
|
+
GL_ARB_texture_gather, GL_ARB_texture_cube_map_array
|
|
262
|
+
and GL_ARB_shader_draw_parameters.For drawing user interface elements and gizmos, use
|
|
263
|
+
fragOutput = blender_srgb_to_framebuffer_space(fragOutput)
|
|
264
|
+
to transform the output sRGB colors to the frame-buffer color-space.
|
|
265
|
+
"""
|
|
252
266
|
|
|
253
267
|
name: str
|
|
254
268
|
""" The name of the shader object for debugging purposes (read-only).
|
|
@@ -262,21 +276,21 @@ class GPUShader:
|
|
|
262
276
|
:type: int
|
|
263
277
|
"""
|
|
264
278
|
|
|
265
|
-
def attr_from_name(self, name: str) ->
|
|
279
|
+
def attr_from_name(self, name: str) -> str:
|
|
266
280
|
"""Get attribute location by name.
|
|
267
281
|
|
|
268
282
|
:param name: The name of the attribute variable whose location is to be queried.
|
|
269
283
|
:type name: str
|
|
270
|
-
:rtype: int
|
|
271
284
|
:return: The location of an attribute variable.
|
|
285
|
+
:rtype: int
|
|
272
286
|
"""
|
|
273
287
|
...
|
|
274
288
|
|
|
275
|
-
def attrs_info_get(self) ->
|
|
289
|
+
def attrs_info_get(self) -> int:
|
|
276
290
|
"""Information about the attributes used in the Shader.
|
|
277
291
|
|
|
278
|
-
:rtype: typing.Tuple
|
|
279
292
|
:return: tuples containing information about the attributes in order (name, type)
|
|
293
|
+
:rtype: typing.Tuple
|
|
280
294
|
"""
|
|
281
295
|
...
|
|
282
296
|
|
|
@@ -284,43 +298,40 @@ class GPUShader:
|
|
|
284
298
|
"""Bind the shader object. Required to be able to change uniforms of this shader."""
|
|
285
299
|
...
|
|
286
300
|
|
|
287
|
-
def format_calc(self) ->
|
|
301
|
+
def format_calc(self) -> typing.Tuple:
|
|
288
302
|
"""Build a new format based on the attributes of the shader.
|
|
289
303
|
|
|
290
|
-
:rtype: 'GPUVertFormat'
|
|
291
304
|
:return: vertex attribute format for the shader
|
|
305
|
+
:rtype: GPUVertFormat
|
|
292
306
|
"""
|
|
293
307
|
...
|
|
294
308
|
|
|
295
|
-
def image(self, name: str, texture:
|
|
309
|
+
def image(self, name: str, texture: GPUTexture):
|
|
296
310
|
"""Specify the value of an image variable for the current GPUShader.
|
|
297
311
|
|
|
298
312
|
:param name: Name of the image variable to which the texture is to be bound.
|
|
299
313
|
:type name: str
|
|
300
314
|
:param texture: Texture to attach.
|
|
301
|
-
:type texture:
|
|
315
|
+
:type texture: GPUTexture
|
|
302
316
|
"""
|
|
303
317
|
...
|
|
304
318
|
|
|
305
|
-
def uniform_block(self, name: str, ubo
|
|
319
|
+
def uniform_block(self, name: str, ubo):
|
|
306
320
|
"""Specify the value of an uniform buffer object variable for the current GPUShader.
|
|
307
321
|
|
|
308
322
|
:param name: name of the uniform variable whose UBO is to be specified.
|
|
309
323
|
:type name: str
|
|
310
|
-
:param
|
|
311
|
-
:type texture: 'GPUUniformBuf'
|
|
312
|
-
:param ubo: Uniform Buffer to attach.
|
|
313
|
-
:type ubo: typing.Any
|
|
324
|
+
:param ubo: Uniform Buffer to attach.
|
|
314
325
|
"""
|
|
315
326
|
...
|
|
316
327
|
|
|
317
|
-
def uniform_block_from_name(self, name: str) ->
|
|
328
|
+
def uniform_block_from_name(self, name: str) -> str:
|
|
318
329
|
"""Get uniform block location by name.
|
|
319
330
|
|
|
320
331
|
:param name: Name of the uniform block variable whose location is to be queried.
|
|
321
332
|
:type name: str
|
|
322
|
-
:rtype: int
|
|
323
333
|
:return: The location of the uniform block variable.
|
|
334
|
+
:rtype: int
|
|
324
335
|
"""
|
|
325
336
|
...
|
|
326
337
|
|
|
@@ -334,43 +345,41 @@ class GPUShader:
|
|
|
334
345
|
"""
|
|
335
346
|
...
|
|
336
347
|
|
|
337
|
-
def uniform_float(self, name: str, value
|
|
348
|
+
def uniform_float(self, name: str, value):
|
|
338
349
|
"""Specify the value of a uniform variable for the current program object.
|
|
339
350
|
|
|
340
351
|
:param name: Name of the uniform variable whose value is to be changed.
|
|
341
352
|
:type name: str
|
|
342
353
|
:param value: Value that will be used to update the specified uniform variable.
|
|
343
|
-
:type value: typing.List
|
|
344
354
|
"""
|
|
345
355
|
...
|
|
346
356
|
|
|
347
|
-
def uniform_from_name(self, name: str) ->
|
|
357
|
+
def uniform_from_name(self, name: str) -> str:
|
|
348
358
|
"""Get uniform location by name.
|
|
349
359
|
|
|
350
360
|
:param name: Name of the uniform variable whose location is to be queried.
|
|
351
361
|
:type name: str
|
|
352
|
-
:rtype: int
|
|
353
362
|
:return: Location of the uniform variable.
|
|
363
|
+
:rtype: int
|
|
354
364
|
"""
|
|
355
365
|
...
|
|
356
366
|
|
|
357
|
-
def uniform_int(self, name: str, seq
|
|
367
|
+
def uniform_int(self, name: str, seq):
|
|
358
368
|
"""Specify the value of a uniform variable for the current program object.
|
|
359
369
|
|
|
360
370
|
:param name: name of the uniform variable whose value is to be changed.
|
|
361
371
|
:type name: str
|
|
362
372
|
:param seq: Value that will be used to update the specified uniform variable.
|
|
363
|
-
:type seq: typing.List
|
|
364
373
|
"""
|
|
365
374
|
...
|
|
366
375
|
|
|
367
|
-
def uniform_sampler(self, name: str, texture:
|
|
376
|
+
def uniform_sampler(self, name: str, texture: GPUTexture):
|
|
368
377
|
"""Specify the value of a texture uniform variable for the current GPUShader.
|
|
369
378
|
|
|
370
379
|
:param name: name of the uniform variable whose texture is to be specified.
|
|
371
380
|
:type name: str
|
|
372
381
|
:param texture: Texture to attach.
|
|
373
|
-
:type texture:
|
|
382
|
+
:type texture: GPUTexture
|
|
374
383
|
"""
|
|
375
384
|
...
|
|
376
385
|
|
|
@@ -379,26 +388,44 @@ class GPUShader:
|
|
|
379
388
|
):
|
|
380
389
|
"""Set the buffer to fill the uniform.
|
|
381
390
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
:
|
|
389
|
-
|
|
391
|
+
:param location: Location of the uniform variable to be modified.
|
|
392
|
+
:type location: int
|
|
393
|
+
:param buffer: The data that should be set. Can support the buffer protocol.
|
|
394
|
+
:type buffer: typing.List[float]
|
|
395
|
+
:param length: Size of the uniform data type:
|
|
396
|
+
|
|
397
|
+
1: float
|
|
398
|
+
|
|
399
|
+
2: vec2 or float[2]
|
|
400
|
+
|
|
401
|
+
3: vec3 or float[3]
|
|
402
|
+
|
|
403
|
+
4: vec4 or float[4]
|
|
404
|
+
|
|
405
|
+
9: mat3
|
|
406
|
+
|
|
407
|
+
16: mat4
|
|
408
|
+
:type length: int
|
|
409
|
+
:param count: Specifies the number of elements, vector or matrices that are to be modified.
|
|
410
|
+
:type count: int
|
|
390
411
|
"""
|
|
391
412
|
...
|
|
392
413
|
|
|
393
414
|
def uniform_vector_int(self, location, buffer, length, count):
|
|
394
|
-
"""See GPUShader.uniform_vector_float(...) description.
|
|
415
|
+
"""See GPUShader.uniform_vector_float(...) description.
|
|
416
|
+
|
|
417
|
+
:param location:
|
|
418
|
+
:param buffer:
|
|
419
|
+
:param length:
|
|
420
|
+
:param count:
|
|
421
|
+
"""
|
|
395
422
|
...
|
|
396
423
|
|
|
397
424
|
class GPUShaderCreateInfo:
|
|
398
425
|
"""Stores and describes types and variables that are used in shader sources."""
|
|
399
426
|
|
|
400
427
|
def compute_source(self, source: str):
|
|
401
|
-
"""compute shader source code written in GLSL.
|
|
428
|
+
"""compute shader source code written in GLSL.Example:`GLSL Cross Compilation <https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__
|
|
402
429
|
|
|
403
430
|
:param source: The compute shader source code.
|
|
404
431
|
:type source: str
|
|
@@ -406,25 +433,59 @@ class GPUShaderCreateInfo:
|
|
|
406
433
|
...
|
|
407
434
|
|
|
408
435
|
def define(self, name, value):
|
|
409
|
-
"""Add a preprocessing define directive. In GLSL it would be something like:
|
|
436
|
+
"""Add a preprocessing define directive. In GLSL it would be something like:
|
|
437
|
+
|
|
438
|
+
:param name:
|
|
439
|
+
:param value:
|
|
440
|
+
"""
|
|
410
441
|
...
|
|
411
442
|
|
|
412
443
|
def fragment_out(self, slot: int, type: str, name: str, blend: str = "NONE"):
|
|
413
444
|
"""Specify a fragment output corresponding to a framebuffer target slot.
|
|
414
445
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
446
|
+
:param slot: The attribute index.
|
|
447
|
+
:type slot: int
|
|
448
|
+
:param type: One of these types:
|
|
449
|
+
|
|
450
|
+
FLOAT
|
|
451
|
+
|
|
452
|
+
VEC2
|
|
453
|
+
|
|
454
|
+
VEC3
|
|
455
|
+
|
|
456
|
+
VEC4
|
|
457
|
+
|
|
458
|
+
MAT3
|
|
459
|
+
|
|
460
|
+
MAT4
|
|
461
|
+
|
|
462
|
+
UINT
|
|
463
|
+
|
|
464
|
+
UVEC2
|
|
465
|
+
|
|
466
|
+
UVEC3
|
|
467
|
+
|
|
468
|
+
UVEC4
|
|
469
|
+
|
|
470
|
+
INT
|
|
471
|
+
|
|
472
|
+
IVEC2
|
|
473
|
+
|
|
474
|
+
IVEC3
|
|
475
|
+
|
|
476
|
+
IVEC4
|
|
477
|
+
|
|
478
|
+
BOOL
|
|
479
|
+
:type type: str
|
|
480
|
+
:param name: Name of the attribute.
|
|
481
|
+
:type name: str
|
|
482
|
+
:param blend: Dual Source Blending Index. It can be 'NONE', 'SRC_0' or 'SRC_1'.
|
|
483
|
+
:type blend: str
|
|
423
484
|
"""
|
|
424
485
|
...
|
|
425
486
|
|
|
426
487
|
def fragment_source(self, source: str):
|
|
427
|
-
"""Fragment shader source code written in GLSL.
|
|
488
|
+
"""Fragment shader source code written in GLSL.Example:`GLSL Cross Compilation <https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__
|
|
428
489
|
|
|
429
490
|
:param source: The fragment shader source code.
|
|
430
491
|
:type source: str
|
|
@@ -437,20 +498,175 @@ class GPUShaderCreateInfo:
|
|
|
437
498
|
format: str,
|
|
438
499
|
type: str,
|
|
439
500
|
name: str,
|
|
440
|
-
qualifiers:
|
|
501
|
+
qualifiers: set = {'"NO_RESTRICT"'},
|
|
441
502
|
):
|
|
442
503
|
"""Specify an image resource used for arbitrary load and store operations.
|
|
443
504
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
505
|
+
:param slot: The image resource index.
|
|
506
|
+
:type slot: int
|
|
507
|
+
:param format: The GPUTexture format that is passed to the shader. Possible values are:
|
|
508
|
+
|
|
509
|
+
RGBA8UI
|
|
510
|
+
|
|
511
|
+
RGBA8I
|
|
512
|
+
|
|
513
|
+
RGBA8
|
|
514
|
+
|
|
515
|
+
RGBA32UI
|
|
516
|
+
|
|
517
|
+
RGBA32I
|
|
518
|
+
|
|
519
|
+
RGBA32F
|
|
520
|
+
|
|
521
|
+
RGBA16UI
|
|
522
|
+
|
|
523
|
+
RGBA16I
|
|
524
|
+
|
|
525
|
+
RGBA16F
|
|
526
|
+
|
|
527
|
+
RGBA16
|
|
528
|
+
|
|
529
|
+
RG8UI
|
|
530
|
+
|
|
531
|
+
RG8I
|
|
532
|
+
|
|
533
|
+
RG8
|
|
534
|
+
|
|
535
|
+
RG32UI
|
|
536
|
+
|
|
537
|
+
RG32I
|
|
538
|
+
|
|
539
|
+
RG32F
|
|
540
|
+
|
|
541
|
+
RG16UI
|
|
542
|
+
|
|
543
|
+
RG16I
|
|
544
|
+
|
|
545
|
+
RG16F
|
|
546
|
+
|
|
547
|
+
RG16
|
|
548
|
+
|
|
549
|
+
R8UI
|
|
550
|
+
|
|
551
|
+
R8I
|
|
552
|
+
|
|
553
|
+
R8
|
|
554
|
+
|
|
555
|
+
R32UI
|
|
556
|
+
|
|
557
|
+
R32I
|
|
558
|
+
|
|
559
|
+
R32F
|
|
560
|
+
|
|
561
|
+
R16UI
|
|
562
|
+
|
|
563
|
+
R16I
|
|
564
|
+
|
|
565
|
+
R16F
|
|
566
|
+
|
|
567
|
+
R16
|
|
568
|
+
|
|
569
|
+
R11F_G11F_B10F
|
|
570
|
+
|
|
571
|
+
DEPTH32F_STENCIL8
|
|
572
|
+
|
|
573
|
+
DEPTH24_STENCIL8
|
|
574
|
+
|
|
575
|
+
SRGB8_A8
|
|
576
|
+
|
|
577
|
+
RGB16F
|
|
578
|
+
|
|
579
|
+
SRGB8_A8_DXT1
|
|
580
|
+
|
|
581
|
+
SRGB8_A8_DXT3
|
|
582
|
+
|
|
583
|
+
SRGB8_A8_DXT5
|
|
584
|
+
|
|
585
|
+
RGBA8_DXT1
|
|
586
|
+
|
|
587
|
+
RGBA8_DXT3
|
|
588
|
+
|
|
589
|
+
RGBA8_DXT5
|
|
590
|
+
|
|
591
|
+
DEPTH_COMPONENT32F
|
|
592
|
+
|
|
593
|
+
DEPTH_COMPONENT24
|
|
594
|
+
|
|
595
|
+
DEPTH_COMPONENT16
|
|
596
|
+
:type format: str
|
|
597
|
+
:param type: The data type describing how the image is to be read in the shader. Possible values are:
|
|
598
|
+
|
|
599
|
+
FLOAT_BUFFER
|
|
600
|
+
|
|
601
|
+
FLOAT_1D
|
|
602
|
+
|
|
603
|
+
FLOAT_1D_ARRAY
|
|
604
|
+
|
|
605
|
+
FLOAT_2D
|
|
606
|
+
|
|
607
|
+
FLOAT_2D_ARRAY
|
|
608
|
+
|
|
609
|
+
FLOAT_3D
|
|
610
|
+
|
|
611
|
+
FLOAT_CUBE
|
|
612
|
+
|
|
613
|
+
FLOAT_CUBE_ARRAY
|
|
614
|
+
|
|
615
|
+
INT_BUFFER
|
|
616
|
+
|
|
617
|
+
INT_1D
|
|
618
|
+
|
|
619
|
+
INT_1D_ARRAY
|
|
620
|
+
|
|
621
|
+
INT_2D
|
|
622
|
+
|
|
623
|
+
INT_2D_ARRAY
|
|
624
|
+
|
|
625
|
+
INT_3D
|
|
626
|
+
|
|
627
|
+
INT_CUBE
|
|
628
|
+
|
|
629
|
+
INT_CUBE_ARRAY
|
|
630
|
+
|
|
631
|
+
UINT_BUFFER
|
|
632
|
+
|
|
633
|
+
UINT_1D
|
|
634
|
+
|
|
635
|
+
UINT_1D_ARRAY
|
|
636
|
+
|
|
637
|
+
UINT_2D
|
|
638
|
+
|
|
639
|
+
UINT_2D_ARRAY
|
|
640
|
+
|
|
641
|
+
UINT_3D
|
|
642
|
+
|
|
643
|
+
UINT_CUBE
|
|
644
|
+
|
|
645
|
+
UINT_CUBE_ARRAY
|
|
646
|
+
|
|
647
|
+
SHADOW_2D
|
|
648
|
+
|
|
649
|
+
SHADOW_2D_ARRAY
|
|
650
|
+
|
|
651
|
+
SHADOW_CUBE
|
|
652
|
+
|
|
653
|
+
SHADOW_CUBE_ARRAY
|
|
654
|
+
|
|
655
|
+
DEPTH_2D
|
|
656
|
+
|
|
657
|
+
DEPTH_2D_ARRAY
|
|
658
|
+
|
|
659
|
+
DEPTH_CUBE
|
|
660
|
+
|
|
661
|
+
DEPTH_CUBE_ARRAY
|
|
662
|
+
:type type: str
|
|
663
|
+
:param name: The image resource name.
|
|
664
|
+
:type name: str
|
|
665
|
+
:param qualifiers: Set containing values that describe how the image resource is to be read or written. Possible values are:
|
|
666
|
+
- NO_RESTRICT
|
|
667
|
+
- READ
|
|
668
|
+
- WRITE
|
|
669
|
+
:type qualifiers: set
|
|
454
670
|
"""
|
|
455
671
|
...
|
|
456
672
|
|
|
@@ -466,40 +682,136 @@ class GPUShaderCreateInfo:
|
|
|
466
682
|
"""
|
|
467
683
|
...
|
|
468
684
|
|
|
469
|
-
def push_constant(self, type: str, name: str, size
|
|
685
|
+
def push_constant(self, type: str, name: str, size=0):
|
|
470
686
|
"""Specify a global access constant.
|
|
471
687
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
688
|
+
:param type: One of these types:
|
|
689
|
+
|
|
690
|
+
FLOAT
|
|
691
|
+
|
|
692
|
+
VEC2
|
|
693
|
+
|
|
694
|
+
VEC3
|
|
695
|
+
|
|
696
|
+
VEC4
|
|
697
|
+
|
|
698
|
+
MAT3
|
|
699
|
+
|
|
700
|
+
MAT4
|
|
701
|
+
|
|
702
|
+
UINT
|
|
703
|
+
|
|
704
|
+
UVEC2
|
|
705
|
+
|
|
706
|
+
UVEC3
|
|
707
|
+
|
|
708
|
+
UVEC4
|
|
709
|
+
|
|
710
|
+
INT
|
|
711
|
+
|
|
712
|
+
IVEC2
|
|
713
|
+
|
|
714
|
+
IVEC3
|
|
715
|
+
|
|
716
|
+
IVEC4
|
|
717
|
+
|
|
718
|
+
BOOL
|
|
719
|
+
:type type: str
|
|
720
|
+
:param name: Name of the constant.
|
|
721
|
+
:type name: str
|
|
722
|
+
:param size: If not zero, indicates that the constant is an array with the specified size.
|
|
478
723
|
"""
|
|
479
724
|
...
|
|
480
725
|
|
|
481
726
|
def sampler(self, slot: int, type: str, name: str):
|
|
482
727
|
"""Specify an image texture sampler.
|
|
483
728
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
729
|
+
:param slot: The image texture sampler index.
|
|
730
|
+
:type slot: int
|
|
731
|
+
:param type: The data type describing the format of each sampler unit. Possible values are:
|
|
732
|
+
|
|
733
|
+
FLOAT_BUFFER
|
|
734
|
+
|
|
735
|
+
FLOAT_1D
|
|
736
|
+
|
|
737
|
+
FLOAT_1D_ARRAY
|
|
738
|
+
|
|
739
|
+
FLOAT_2D
|
|
740
|
+
|
|
741
|
+
FLOAT_2D_ARRAY
|
|
742
|
+
|
|
743
|
+
FLOAT_3D
|
|
744
|
+
|
|
745
|
+
FLOAT_CUBE
|
|
746
|
+
|
|
747
|
+
FLOAT_CUBE_ARRAY
|
|
748
|
+
|
|
749
|
+
INT_BUFFER
|
|
750
|
+
|
|
751
|
+
INT_1D
|
|
752
|
+
|
|
753
|
+
INT_1D_ARRAY
|
|
754
|
+
|
|
755
|
+
INT_2D
|
|
756
|
+
|
|
757
|
+
INT_2D_ARRAY
|
|
758
|
+
|
|
759
|
+
INT_3D
|
|
760
|
+
|
|
761
|
+
INT_CUBE
|
|
762
|
+
|
|
763
|
+
INT_CUBE_ARRAY
|
|
764
|
+
|
|
765
|
+
UINT_BUFFER
|
|
766
|
+
|
|
767
|
+
UINT_1D
|
|
768
|
+
|
|
769
|
+
UINT_1D_ARRAY
|
|
770
|
+
|
|
771
|
+
UINT_2D
|
|
772
|
+
|
|
773
|
+
UINT_2D_ARRAY
|
|
774
|
+
|
|
775
|
+
UINT_3D
|
|
776
|
+
|
|
777
|
+
UINT_CUBE
|
|
778
|
+
|
|
779
|
+
UINT_CUBE_ARRAY
|
|
780
|
+
|
|
781
|
+
SHADOW_2D
|
|
782
|
+
|
|
783
|
+
SHADOW_2D_ARRAY
|
|
784
|
+
|
|
785
|
+
SHADOW_CUBE
|
|
786
|
+
|
|
787
|
+
SHADOW_CUBE_ARRAY
|
|
788
|
+
|
|
789
|
+
DEPTH_2D
|
|
790
|
+
|
|
791
|
+
DEPTH_2D_ARRAY
|
|
792
|
+
|
|
793
|
+
DEPTH_CUBE
|
|
794
|
+
|
|
795
|
+
DEPTH_CUBE_ARRAY
|
|
796
|
+
:type type: str
|
|
797
|
+
:param name: The image texture sampler name.
|
|
798
|
+
:type name: str
|
|
490
799
|
"""
|
|
491
800
|
...
|
|
492
801
|
|
|
493
802
|
def typedef_source(self, source):
|
|
494
|
-
"""Source code included before resource declaration. Useful for defining structs used by Uniform Buffers.
|
|
803
|
+
"""Source code included before resource declaration. Useful for defining structs used by Uniform Buffers.Example:
|
|
804
|
+
|
|
805
|
+
:param source:
|
|
806
|
+
"""
|
|
495
807
|
...
|
|
496
808
|
|
|
497
809
|
def uniform_buf(self, slot: int, type_name: str, name: str):
|
|
498
|
-
"""Specify a uniform variable whose type can be one of those declared in
|
|
810
|
+
"""Specify a uniform variable whose type can be one of those declared in typedef_source.
|
|
499
811
|
|
|
500
812
|
:param slot: The uniform variable index.
|
|
501
813
|
:type slot: int
|
|
502
|
-
:param type_name: `gpu.types.GPUShaderCreateInfo.typedef_source`.
|
|
814
|
+
:param type_name: Name of the data type. It can be a struct type defined in the source passed through the `gpu.types.GPUShaderCreateInfo.typedef_source`.
|
|
503
815
|
:type type_name: str
|
|
504
816
|
:param name: The uniform variable name.
|
|
505
817
|
:type name: str
|
|
@@ -509,25 +821,55 @@ class GPUShaderCreateInfo:
|
|
|
509
821
|
def vertex_in(self, slot: int, type: str, name: str):
|
|
510
822
|
"""Add a vertex shader input attribute.
|
|
511
823
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
824
|
+
:param slot: The attribute index.
|
|
825
|
+
:type slot: int
|
|
826
|
+
:param type: One of these types:
|
|
827
|
+
|
|
828
|
+
FLOAT
|
|
829
|
+
|
|
830
|
+
VEC2
|
|
831
|
+
|
|
832
|
+
VEC3
|
|
833
|
+
|
|
834
|
+
VEC4
|
|
835
|
+
|
|
836
|
+
MAT3
|
|
837
|
+
|
|
838
|
+
MAT4
|
|
839
|
+
|
|
840
|
+
UINT
|
|
841
|
+
|
|
842
|
+
UVEC2
|
|
843
|
+
|
|
844
|
+
UVEC3
|
|
845
|
+
|
|
846
|
+
UVEC4
|
|
847
|
+
|
|
848
|
+
INT
|
|
849
|
+
|
|
850
|
+
IVEC2
|
|
851
|
+
|
|
852
|
+
IVEC3
|
|
853
|
+
|
|
854
|
+
IVEC4
|
|
855
|
+
|
|
856
|
+
BOOL
|
|
857
|
+
:type type: str
|
|
858
|
+
:param name: name of the attribute.
|
|
859
|
+
:type name: str
|
|
518
860
|
"""
|
|
519
861
|
...
|
|
520
862
|
|
|
521
|
-
def vertex_out(self, interface:
|
|
863
|
+
def vertex_out(self, interface: GPUStageInterfaceInfo):
|
|
522
864
|
"""Add a vertex shader output interface block.
|
|
523
865
|
|
|
524
866
|
:param interface: Object describing the block.
|
|
525
|
-
:type interface:
|
|
867
|
+
:type interface: GPUStageInterfaceInfo
|
|
526
868
|
"""
|
|
527
869
|
...
|
|
528
870
|
|
|
529
871
|
def vertex_source(self, source: str):
|
|
530
|
-
"""Vertex shader source code written in GLSL.
|
|
872
|
+
"""Vertex shader source code written in GLSL.Example:`GLSL Cross Compilation <https://developer.blender.org/docs/features/gpu/glsl_cross_compilation/>`__
|
|
531
873
|
|
|
532
874
|
:param source: The vertex shader source code.
|
|
533
875
|
:type source: str
|
|
@@ -535,7 +877,7 @@ class GPUShaderCreateInfo:
|
|
|
535
877
|
...
|
|
536
878
|
|
|
537
879
|
class GPUStageInterfaceInfo:
|
|
538
|
-
"""List of varyings between shader stages.
|
|
880
|
+
"""List of varyings between shader stages."""
|
|
539
881
|
|
|
540
882
|
name: str
|
|
541
883
|
""" Name of the interface block.
|
|
@@ -544,37 +886,127 @@ class GPUStageInterfaceInfo:
|
|
|
544
886
|
"""
|
|
545
887
|
|
|
546
888
|
def flat(self, type: str, name: str):
|
|
547
|
-
"""Add an attribute with qualifier of type
|
|
889
|
+
"""Add an attribute with qualifier of type flat to the interface block.
|
|
548
890
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
891
|
+
:param type: One of these types:
|
|
892
|
+
|
|
893
|
+
FLOAT
|
|
894
|
+
|
|
895
|
+
VEC2
|
|
896
|
+
|
|
897
|
+
VEC3
|
|
898
|
+
|
|
899
|
+
VEC4
|
|
900
|
+
|
|
901
|
+
MAT3
|
|
902
|
+
|
|
903
|
+
MAT4
|
|
904
|
+
|
|
905
|
+
UINT
|
|
906
|
+
|
|
907
|
+
UVEC2
|
|
908
|
+
|
|
909
|
+
UVEC3
|
|
910
|
+
|
|
911
|
+
UVEC4
|
|
912
|
+
|
|
913
|
+
INT
|
|
914
|
+
|
|
915
|
+
IVEC2
|
|
916
|
+
|
|
917
|
+
IVEC3
|
|
918
|
+
|
|
919
|
+
IVEC4
|
|
920
|
+
|
|
921
|
+
BOOL
|
|
922
|
+
:type type: str
|
|
923
|
+
:param name: name of the attribute.
|
|
924
|
+
:type name: str
|
|
553
925
|
"""
|
|
554
926
|
...
|
|
555
927
|
|
|
556
928
|
def no_perspective(self, type: str, name: str):
|
|
557
|
-
"""Add an attribute with qualifier of type
|
|
929
|
+
"""Add an attribute with qualifier of type no_perspective to the interface block.
|
|
558
930
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
931
|
+
:param type: One of these types:
|
|
932
|
+
|
|
933
|
+
FLOAT
|
|
934
|
+
|
|
935
|
+
VEC2
|
|
936
|
+
|
|
937
|
+
VEC3
|
|
938
|
+
|
|
939
|
+
VEC4
|
|
940
|
+
|
|
941
|
+
MAT3
|
|
942
|
+
|
|
943
|
+
MAT4
|
|
944
|
+
|
|
945
|
+
UINT
|
|
946
|
+
|
|
947
|
+
UVEC2
|
|
948
|
+
|
|
949
|
+
UVEC3
|
|
950
|
+
|
|
951
|
+
UVEC4
|
|
952
|
+
|
|
953
|
+
INT
|
|
954
|
+
|
|
955
|
+
IVEC2
|
|
956
|
+
|
|
957
|
+
IVEC3
|
|
958
|
+
|
|
959
|
+
IVEC4
|
|
960
|
+
|
|
961
|
+
BOOL
|
|
962
|
+
:type type: str
|
|
963
|
+
:param name: name of the attribute.
|
|
964
|
+
:type name: str
|
|
563
965
|
"""
|
|
564
966
|
...
|
|
565
967
|
|
|
566
968
|
def smooth(self, type: str, name: str):
|
|
567
|
-
"""Add an attribute with qualifier of type
|
|
969
|
+
"""Add an attribute with qualifier of type smooth to the interface block.
|
|
568
970
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
971
|
+
:param type: One of these types:
|
|
972
|
+
|
|
973
|
+
FLOAT
|
|
974
|
+
|
|
975
|
+
VEC2
|
|
976
|
+
|
|
977
|
+
VEC3
|
|
978
|
+
|
|
979
|
+
VEC4
|
|
980
|
+
|
|
981
|
+
MAT3
|
|
982
|
+
|
|
983
|
+
MAT4
|
|
984
|
+
|
|
985
|
+
UINT
|
|
986
|
+
|
|
987
|
+
UVEC2
|
|
988
|
+
|
|
989
|
+
UVEC3
|
|
990
|
+
|
|
991
|
+
UVEC4
|
|
992
|
+
|
|
993
|
+
INT
|
|
994
|
+
|
|
995
|
+
IVEC2
|
|
996
|
+
|
|
997
|
+
IVEC3
|
|
998
|
+
|
|
999
|
+
IVEC4
|
|
1000
|
+
|
|
1001
|
+
BOOL
|
|
1002
|
+
:type type: str
|
|
1003
|
+
:param name: name of the attribute.
|
|
1004
|
+
:type name: str
|
|
573
1005
|
"""
|
|
574
1006
|
...
|
|
575
1007
|
|
|
576
1008
|
class GPUTexture:
|
|
577
|
-
"""This object gives access to off GPU textures.
|
|
1009
|
+
"""This object gives access to off GPU textures."""
|
|
578
1010
|
|
|
579
1011
|
format: str
|
|
580
1012
|
""" Format of the texture.
|
|
@@ -594,13 +1026,13 @@ class GPUTexture:
|
|
|
594
1026
|
:type: int
|
|
595
1027
|
"""
|
|
596
1028
|
|
|
597
|
-
def clear(self, format: str = "FLOAT", value
|
|
1029
|
+
def clear(self, format: str = "FLOAT", value=(0.0, 0.0, 0.0, 1.0)):
|
|
598
1030
|
"""Fill texture with specific value.
|
|
599
1031
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
1032
|
+
:param format: The format that describes the content of a single item.
|
|
1033
|
+
Possible values are FLOAT, INT, UINT, UBYTE, UINT_24_8 and 10_11_11_REV.
|
|
1034
|
+
:type format: str
|
|
1035
|
+
:param value: sequence each representing the value to fill.
|
|
604
1036
|
"""
|
|
605
1037
|
...
|
|
606
1038
|
|
|
@@ -609,14 +1041,17 @@ class GPUTexture:
|
|
|
609
1041
|
...
|
|
610
1042
|
|
|
611
1043
|
class GPUUniformBuf:
|
|
612
|
-
"""This object gives access to off uniform buffers.
|
|
1044
|
+
"""This object gives access to off uniform buffers."""
|
|
613
1045
|
|
|
614
1046
|
def update(self, data):
|
|
615
|
-
"""Update the data of the uniform buffer object.
|
|
1047
|
+
"""Update the data of the uniform buffer object.
|
|
1048
|
+
|
|
1049
|
+
:param data:
|
|
1050
|
+
"""
|
|
616
1051
|
...
|
|
617
1052
|
|
|
618
1053
|
class GPUVertBuf:
|
|
619
|
-
"""Contains a VBO.
|
|
1054
|
+
"""Contains a VBO."""
|
|
620
1055
|
|
|
621
1056
|
def attr_fill(self, id: typing.Union[int, str], data: typing.List[float]):
|
|
622
1057
|
"""Insert data into the buffer for a single attribute.
|
|
@@ -634,13 +1069,19 @@ class GPUVertFormat:
|
|
|
634
1069
|
def attr_add(self, id: str, comp_type: str, len: int, fetch_mode: str):
|
|
635
1070
|
"""Add a new attribute to the format.
|
|
636
1071
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
1072
|
+
:param id: Name the attribute. Often position, normal, ...
|
|
1073
|
+
:type id: str
|
|
1074
|
+
:param comp_type: The data type that will be used store the value in memory.
|
|
1075
|
+
Possible values are I8, U8, I16, U16, I32, U32, F32 and I10.
|
|
1076
|
+
:type comp_type: str
|
|
1077
|
+
:param len: How many individual values the attribute consists of
|
|
1078
|
+
(e.g. 2 for uv coordinates).
|
|
1079
|
+
:type len: int
|
|
1080
|
+
:param fetch_mode: How values from memory will be converted when used in the shader.
|
|
1081
|
+
This is mainly useful for memory optimizations when you want to store values with
|
|
1082
|
+
reduced precision. E.g. you can store a float in only 1 byte but it will be
|
|
1083
|
+
converted to a normal 4 byte float when used.
|
|
1084
|
+
Possible values are FLOAT, INT, INT_TO_FLOAT_UNIT and INT_TO_FLOAT.
|
|
1085
|
+
:type fetch_mode: str
|
|
645
1086
|
"""
|
|
646
1087
|
...
|