diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-08-16 13:31:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-08-16 13:32:42 +0300 |
commit | 90aa02290ac87a08cef948efb3ee67335276468a (patch) | |
tree | c5d28fa1ebc8cb984980ae344128c15635e61360 /source/blender/editors/space_view3d/drawobject.c | |
parent | 6bca0dcf7bd6c071f0b03234ac448d5e8e15fdc5 (diff) |
Cleanup: rename GPU gawain functions
Were using Batch_ prefix still
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8bddcd43d16..2acc7241f86 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1762,29 +1762,29 @@ static void draw_viewport_object_reconstruction( /* selection outline */ if (selected) { - batch = Batch_get_sphere_wire(1); + batch = GPU_batch_preset_sphere_wire(1); if ((dflag & DRAW_CONSTCOLOR) == 0) { - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(batch, "color", ob_wire_col[0] / 255.f, ob_wire_col[1] / 255.f, ob_wire_col[2] / 255.f, 1.0f); } else { - Batch_set_builtin_program(batch, GPU_SHADER_3D_DEPTH_ONLY); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_DEPTH_ONLY); } glLineWidth(2.0f); GWN_batch_draw(batch); } - batch = Batch_get_sphere(0); + batch = GPU_batch_preset_sphere(0); if ((dflag & DRAW_CONSTCOLOR) == 0) { const float light[3] = {0.0f, 0.0f, 1.0f}; float col[3]; - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3fv(batch, "light", light); if (track->flag & TRACK_CUSTOMCOLOR) copy_v3_v3(col, track->color); @@ -1792,7 +1792,7 @@ static void draw_viewport_object_reconstruction( GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); } else { - Batch_set_builtin_program(batch, GPU_SHADER_3D_DEPTH_ONLY); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_DEPTH_ONLY); } GWN_batch_draw(batch); @@ -4155,7 +4155,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D /* disable depth writes for transparent surface, so it doesn't interfere with itself */ glDepthMask(GL_FALSE); - Batch_set_builtin_program(surface, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(surface, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(surface, "color", 1.0f, 0.5f, 0.0f, 0.5f); GWN_batch_draw(surface); @@ -4163,7 +4163,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D if (finalDM != cageDM) { puts("finalDM != cageDM"); Gwn_Batch *finalSurface = MBC_get_all_triangles(finalDM); - Batch_set_builtin_program(finalSurface, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(finalSurface, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(finalSurface, "color", 0.0f, 0.0f, 0.0f, 0.05f); GWN_batch_draw(finalSurface); } @@ -4175,19 +4175,19 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D * NOTE: does not help as much as desired * TODO: draw edit object last to avoid this mess */ - Batch_set_builtin_program(surface, GPU_SHADER_3D_DEPTH_ONLY); + GWN_batch_program_set_builtin(surface, GPU_SHADER_3D_DEPTH_ONLY); GWN_batch_draw(surface); if (GLEW_VERSION_3_2) { #if 0 Gwn_Batch *overlay = DRW_mesh_batch_cache_get_overlay_edges(me); - Batch_set_builtin_program(overlay, GPU_SHADER_EDGES_OVERLAY); + GWN_batch_program_set_builtin(overlay, GPU_SHADER_EDGES_OVERLAY); GWN_batch_uniform_2f(overlay, "viewportSize", ar->winx, ar->winy); GWN_batch_draw(overlay); #endif #if 0 /* TODO: use this SIMPLE variant for pure triangle meshes */ - Batch_set_builtin_program(surface, GPU_SHADER_EDGES_OVERLAY_SIMPLE); + GWN_batch_program_set_builtin(surface, GPU_SHADER_EDGES_OVERLAY_SIMPLE); /* use these defaults: * const float edgeColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; * GWN_batch_uniform_4f(surface, "fillColor", edgeColor[0], edgeColor[1], edgeColor[2], 0.0f); @@ -4200,7 +4200,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D } else { Gwn_Batch *edges = DRW_mesh_batch_cache_get_all_edges(me); - Batch_set_builtin_program(edges, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(edges, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f); glEnable(GL_LINE_SMOOTH); glLineWidth(1.5f); @@ -4212,7 +4212,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D Gwn_Batch *verts = MBC_get_all_verts(me); glEnable(GL_BLEND); - Batch_set_builtin_program(verts, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); + GWN_batch_program_set_builtin(verts, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); GWN_batch_uniform_4f(verts, "color", 0.0f, 0.0f, 0.0f, 1.0f); GWN_batch_uniform_1f(verts, "size", UI_GetThemeValuef(TH_VERTEX_SIZE) * 1.5f); GWN_batch_draw(verts); @@ -4264,14 +4264,14 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object Gwn_Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me); if (rv3d->persp == RV3D_ORTHO) { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); /* set eye vector, transformed to object coords */ float eye[3] = { 0.0f, 0.0f, 1.0f }; /* looking into the screen */ mul_m3_v3(gpuGetNormalMatrixInverse(NULL), eye); GWN_batch_uniform_3fv(fancy_edges, "eye", eye); } else { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); } GWN_batch_uniform_1b(fancy_edges, "drawFront", false); @@ -4282,7 +4282,7 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object GWN_batch_draw(fancy_edges); #else /* alternate version that matches look of old viewport (but more efficient) */ Gwn_Batch *batch = MBC_get_all_edges(dm); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4fv(batch, "color", outline_color); GWN_batch_draw(batch); #endif @@ -4790,14 +4790,14 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene Gwn_Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me); if (rv3d->persp == RV3D_ORTHO) { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); /* set eye vector, transformed to object coords */ float eye[3] = { 0.0f, 0.0f, 1.0f }; /* looking into the screen */ mul_m3_v3(gpuGetNormalMatrixInverse(NULL), eye); GWN_batch_uniform_3fv(fancy_edges, "eye", eye); } else { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); } float frontColor[4]; @@ -4826,7 +4826,7 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene #else /* simple wireframes */ Gwn_Batch *batch = MBC_get_all_edges(dm); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); float color[4]; rgba_uchar_to_float(color, ob_wire_col); @@ -5141,7 +5141,7 @@ static void drawDispListVerts(Gwn_PrimType prim_type, const void *data, unsigned GWN_vertbuf_attr_fill(vbo, pos_id, data); Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); if (wire_col) { GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f); } @@ -5204,7 +5204,7 @@ static void drawDispListElem( Gwn_Batch *batch = GWN_batch_create_ex( GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb), GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING); if (wire_col) { GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f); } @@ -5656,19 +5656,19 @@ static void draw_vertex_array(Gwn_PrimType prim_type, const float *vert, const f Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO); if (nor && color) { - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR); GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f); } else if (nor) { - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f); if (col) GWN_batch_uniform_4fv(batch, "color", col); } else if (color) { - Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR); } else { - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); if (col) GWN_batch_uniform_4fv(batch, "color", col); } GWN_batch_draw(batch); @@ -6679,7 +6679,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) } Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_LINE_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR); GWN_batch_draw(batch); GWN_batch_discard(batch); } @@ -6750,7 +6750,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) GWN_vertbuf_attr_fill(vbo, col_id, cd); Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR); GWN_batch_draw(batch); GWN_batch_discard(batch); @@ -8085,8 +8085,8 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos) static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsigned char ob_wire_col[4]) { float size[3], cent[3]; - Gwn_Batch *sphere = Batch_get_sphere_wire(0); - Batch_set_builtin_program(sphere, GPU_SHADER_3D_UNIFORM_COLOR); + Gwn_Batch *sphere = GPU_batch_preset_sphere_wire(0); + GWN_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) GWN_batch_uniform_4f(sphere, "color", ob_wire_col[0] / 255.0f, ob_wire_col[1] / 255.0f, ob_wire_col[2] / 255.0f, 1.0f); BKE_boundbox_calc_size_aabb(bb, size); @@ -9646,7 +9646,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob) else { batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false); } - Batch_set_builtin_program(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); GWN_batch_draw(batch); } |