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/editors/gizmo_library/gizmo_draw_utils.c')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_draw_utils.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
index 999e211a492..f1d8c1ac6b0 100644
--- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
@@ -49,63 +49,63 @@
/**
* Main draw call for GizmoGeomInfo data
*/
-void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(select), const float color[4])
+void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info,
+ const bool UNUSED(select),
+ const float color[4])
{
- /* TODO store the Batches inside the GizmoGeomInfo and updated it when geom changes
- * So we don't need to re-created and discard it every time */
+ /* TODO store the Batches inside the GizmoGeomInfo and updated it when geom changes
+ * So we don't need to re-created and discard it every time */
- GPUVertBuf *vbo;
- GPUIndexBuf *el;
- GPUBatch *batch;
- GPUIndexBufBuilder elb = {0};
+ GPUVertBuf *vbo;
+ GPUIndexBuf *el;
+ GPUBatch *batch;
+ GPUIndexBufBuilder elb = {0};
- GPUVertFormat format = {0};
- uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+ GPUVertFormat format = {0};
+ uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- /* Elements */
- GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, info->ntris, info->nverts);
- for (int i = 0; i < info->ntris; ++i) {
- const unsigned short *idx = &info->indices[i * 3];
- GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
- }
- el = GPU_indexbuf_build(&elb);
+ /* Elements */
+ GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, info->ntris, info->nverts);
+ for (int i = 0; i < info->ntris; ++i) {
+ const unsigned short *idx = &info->indices[i * 3];
+ GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
+ }
+ el = GPU_indexbuf_build(&elb);
- vbo = GPU_vertbuf_create_with_format(&format);
- GPU_vertbuf_data_alloc(vbo, info->nverts);
+ vbo = GPU_vertbuf_create_with_format(&format);
+ GPU_vertbuf_data_alloc(vbo, info->nverts);
- GPU_vertbuf_attr_fill(vbo, pos_id, info->verts);
+ GPU_vertbuf_attr_fill(vbo, pos_id, info->verts);
- batch = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, el, GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR);
+ batch = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, el, GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX);
+ GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR);
- GPU_batch_uniform_4fv(batch, "color", color);
+ GPU_batch_uniform_4fv(batch, "color", color);
- /* We may want to re-visit this, for now disable
- * since it causes issues leaving the GL state modified. */
+ /* We may want to re-visit this, for now disable
+ * since it causes issues leaving the GL state modified. */
#if 0
- glEnable(GL_CULL_FACE);
- GPU_depth_test(true);
+ glEnable(GL_CULL_FACE);
+ GPU_depth_test(true);
#endif
- GPU_batch_draw(batch);
+ GPU_batch_draw(batch);
#if 0
- GPU_depth_test(false);
- glDisable(GL_CULL_FACE);
+ GPU_depth_test(false);
+ glDisable(GL_CULL_FACE);
#endif
-
- GPU_batch_discard(batch);
+ GPU_batch_discard(batch);
}
void wm_gizmo_vec_draw(
- const float color[4], const float (*verts)[3], uint vert_count,
- uint pos, uint primitive_type)
+ const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type)
{
- immUniformColor4fv(color);
- immBegin(primitive_type, vert_count);
- for (int i = 0; i < vert_count; i++) {
- immVertex3fv(pos, verts[i]);
- }
- immEnd();
+ immUniformColor4fv(color);
+ immBegin(primitive_type, vert_count);
+ for (int i = 0; i < vert_count; i++) {
+ immVertex3fv(pos, verts[i]);
+ }
+ immEnd();
}