Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/intern/gpu_batch_presets.c')
-rw-r--r--source/blender/gpu/intern/gpu_batch_presets.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c
index 8adb1ba1ed3..6a1645a71d8 100644
--- a/source/blender/gpu/intern/gpu_batch_presets.c
+++ b/source/blender/gpu/intern/gpu_batch_presets.c
@@ -62,6 +62,7 @@ static struct {
static struct {
struct {
GPUBatch *panel_drag_widget;
+ GPUBatch *quad;
} batch;
float panel_drag_widget_pixelsize;
@@ -330,6 +331,24 @@ GPUBatch *GPU_batch_preset_panel_drag_widget(const float pixelsize,
return g_presets_2d.batch.panel_drag_widget;
}
+/* To be used with procedural placement inside shader. */
+GPUBatch *GPU_batch_preset_quad(void)
+{
+ if (!g_presets_2d.batch.quad) {
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(preset_2d_format());
+ GPU_vertbuf_data_alloc(vbo, 4);
+
+ float pos_data[4][2] = {{0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f}};
+ GPU_vertbuf_attr_fill(vbo, g_presets_2d.attr_id.pos, pos_data);
+ /* Don't fill the color. */
+
+ g_presets_2d.batch.quad = GPU_batch_create_ex(GPU_PRIM_TRI_FAN, vbo, NULL, GPU_BATCH_OWNS_VBO);
+
+ gpu_batch_presets_register(g_presets_2d.batch.quad);
+ }
+ return g_presets_2d.batch.quad;
+}
+
/** \} */
/* -------------------------------------------------------------------- */