Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_cache.c
| Show First 20 Lines • Show All 830 Lines • ▼ Show 20 Lines | case OB_MBALL: | ||||
| return DRW_cache_mball_surface_get(ob); | return DRW_cache_mball_surface_get(ob); | ||||
| default: | default: | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } | } | ||||
| int DRW_cache_object_material_count_get(struct Object *ob) | int DRW_cache_object_material_count_get(struct Object *ob) | ||||
| { | { | ||||
| Mesh *me = (ob->runtime.mesh_eval != NULL) ? ob->runtime.mesh_eval : (Mesh *)ob->data; | Mesh *me = BKE_object_get_evaluated_mesh(ob); | ||||
| short type = (ob->runtime.mesh_eval != NULL) ? OB_MESH : ob->type; | short type = (me != NULL) ? OB_MESH : ob->type; | ||||
| switch (type) { | switch (type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| return DRW_mesh_material_count_get(me); | return DRW_mesh_material_count_get((me != NULL) ? me : ob->data); | ||||
| case OB_CURVE: | case OB_CURVE: | ||||
| case OB_SURF: | case OB_SURF: | ||||
| case OB_FONT: | case OB_FONT: | ||||
| return DRW_curve_material_count_get(ob->data); | return DRW_curve_material_count_get(ob->data); | ||||
| case OB_MBALL: | case OB_MBALL: | ||||
| return DRW_metaball_material_count_get(ob->data); | return DRW_metaball_material_count_get(ob->data); | ||||
| default: | default: | ||||
| BLI_assert(0); | BLI_assert(0); | ||||
| ▲ Show 20 Lines • Show All 1,949 Lines • ▼ Show 20 Lines | |||||
| /** \name Curve | /** \name Curve | ||||
| * \{ */ | * \{ */ | ||||
| GPUBatch *DRW_cache_curve_edge_wire_get(Object *ob) | GPUBatch *DRW_cache_curve_edge_wire_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_CURVE); | BLI_assert(ob->type == OB_CURVE); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_wire_edge(cu); | return DRW_curve_batch_cache_get_wire_edge(cu); | ||||
| } | } | ||||
| } | } | ||||
| Show All 21 Lines | GPUBatch *DRW_cache_curve_vert_overlay_get(Object *ob, bool handles) | ||||
| return DRW_curve_batch_cache_get_edit_verts(cu, handles); | return DRW_curve_batch_cache_get_edit_verts(cu, handles); | ||||
| } | } | ||||
| GPUBatch *DRW_cache_curve_surface_get(Object *ob) | GPUBatch *DRW_cache_curve_surface_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_CURVE); | BLI_assert(ob->type == OB_CURVE); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_surface(mesh_eval); | return DRW_mesh_batch_cache_get_surface(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_triangles_with_normals(cu); | return DRW_curve_batch_cache_get_triangles_with_normals(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_curve_loose_edges_get(Object *ob) | GPUBatch *DRW_cache_curve_loose_edges_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_CURVE); | BLI_assert(ob->type == OB_CURVE); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| /* TODO */ | /* TODO */ | ||||
| UNUSED_VARS(cu); | UNUSED_VARS(cu); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob) | GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_CURVE); | BLI_assert(ob->type == OB_CURVE); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); | return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_wireframes_face(cu); | return DRW_curve_batch_cache_get_wireframes_face(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_curve_edge_detection_get(Object *ob, bool *r_is_manifold) | GPUBatch *DRW_cache_curve_edge_detection_get(Object *ob, bool *r_is_manifold) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_CURVE); | BLI_assert(ob->type == OB_CURVE); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); | return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold); | return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold); | ||||
| } | } | ||||
| } | } | ||||
| /* Return list of batches */ | /* Return list of batches */ | ||||
| GPUBatch **DRW_cache_curve_surface_shaded_get(Object *ob, | GPUBatch **DRW_cache_curve_surface_shaded_get(Object *ob, | ||||
| struct GPUMaterial **gpumat_array, | struct GPUMaterial **gpumat_array, | ||||
| uint gpumat_array_len) | uint gpumat_array_len) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_CURVE); | BLI_assert(ob->type == OB_CURVE); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); | return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); | return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); | ||||
| } | } | ||||
| } | } | ||||
| Show All 35 Lines | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Font | /** \name Font | ||||
| * \{ */ | * \{ */ | ||||
| GPUBatch *DRW_cache_text_edge_wire_get(Object *ob) | GPUBatch *DRW_cache_text_edge_wire_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_FONT); | BLI_assert(ob->type == OB_FONT); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| const bool has_surface = (cu->flag & (CU_FRONT | CU_BACK)) || cu->ext1 != 0.0f || | const bool has_surface = (cu->flag & (CU_FRONT | CU_BACK)) || cu->ext1 != 0.0f || | ||||
| cu->ext2 != 0.0f; | cu->ext2 != 0.0f; | ||||
| if (!has_surface) { | if (!has_surface) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| else if (mesh_eval != NULL) { | else if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_wire_edge(cu); | return DRW_curve_batch_cache_get_wire_edge(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_text_surface_get(Object *ob) | GPUBatch *DRW_cache_text_surface_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_FONT); | BLI_assert(ob->type == OB_FONT); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (cu->editfont && (cu->flag & CU_FAST)) { | if (cu->editfont && (cu->flag & CU_FAST)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_surface(mesh_eval); | return DRW_mesh_batch_cache_get_surface(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_triangles_with_normals(cu); | return DRW_curve_batch_cache_get_triangles_with_normals(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool *r_is_manifold) | GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool *r_is_manifold) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_FONT); | BLI_assert(ob->type == OB_FONT); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (cu->editfont && (cu->flag & CU_FAST)) { | if (cu->editfont && (cu->flag & CU_FAST)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); | return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold); | return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_text_loose_edges_get(Object *ob) | GPUBatch *DRW_cache_text_loose_edges_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_FONT); | BLI_assert(ob->type == OB_FONT); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (cu->editfont && (cu->flag & CU_FAST)) { | if (cu->editfont && (cu->flag & CU_FAST)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| /* TODO */ | /* TODO */ | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob) | GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_FONT); | BLI_assert(ob->type == OB_FONT); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (cu->editfont && (cu->flag & CU_FAST)) { | if (cu->editfont && (cu->flag & CU_FAST)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); | return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_wireframes_face(cu); | return DRW_curve_batch_cache_get_wireframes_face(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch **DRW_cache_text_surface_shaded_get(Object *ob, | GPUBatch **DRW_cache_text_surface_shaded_get(Object *ob, | ||||
| struct GPUMaterial **gpumat_array, | struct GPUMaterial **gpumat_array, | ||||
| uint gpumat_array_len) | uint gpumat_array_len) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_FONT); | BLI_assert(ob->type == OB_FONT); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (cu->editfont && (cu->flag & CU_FAST)) { | if (cu->editfont && (cu->flag & CU_FAST)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); | return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); | return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); | ||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Surface | /** \name Surface | ||||
| * \{ */ | * \{ */ | ||||
| GPUBatch *DRW_cache_surf_surface_get(Object *ob) | GPUBatch *DRW_cache_surf_surface_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_SURF); | BLI_assert(ob->type == OB_SURF); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_surface(mesh_eval); | return DRW_mesh_batch_cache_get_surface(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_triangles_with_normals(cu); | return DRW_curve_batch_cache_get_triangles_with_normals(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_surf_edge_wire_get(Object *ob) | GPUBatch *DRW_cache_surf_edge_wire_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_SURF); | BLI_assert(ob->type == OB_SURF); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_wire_edge(cu); | return DRW_curve_batch_cache_get_wire_edge(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob) | GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_SURF); | BLI_assert(ob->type == OB_SURF); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); | return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_wireframes_face(cu); | return DRW_curve_batch_cache_get_wireframes_face(cu); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_surf_edge_detection_get(Object *ob, bool *r_is_manifold) | GPUBatch *DRW_cache_surf_edge_detection_get(Object *ob, bool *r_is_manifold) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_SURF); | BLI_assert(ob->type == OB_SURF); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); | return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold); | return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold); | ||||
| } | } | ||||
| } | } | ||||
| GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob) | GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_SURF); | BLI_assert(ob->type == OB_SURF); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); | ||||
| } | } | ||||
| else { | else { | ||||
| /* TODO */ | /* TODO */ | ||||
| UNUSED_VARS(cu); | UNUSED_VARS(cu); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } | } | ||||
| /* Return list of batches */ | /* Return list of batches */ | ||||
| GPUBatch **DRW_cache_surf_surface_shaded_get(Object *ob, | GPUBatch **DRW_cache_surf_surface_shaded_get(Object *ob, | ||||
| struct GPUMaterial **gpumat_array, | struct GPUMaterial **gpumat_array, | ||||
| uint gpumat_array_len) | uint gpumat_array_len) | ||||
| { | { | ||||
| BLI_assert(ob->type == OB_SURF); | BLI_assert(ob->type == OB_SURF); | ||||
| struct Curve *cu = ob->data; | struct Curve *cu = ob->data; | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); | return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); | ||||
| } | } | ||||
| else { | else { | ||||
| return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); | return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Batch Cache Implementation (common) | /** \name Batch Cache Implementation (common) | ||||
| * \{ */ | * \{ */ | ||||
| void drw_batch_cache_validate(Object *ob) | void drw_batch_cache_validate(Object *ob) | ||||
| { | { | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| DRW_mesh_batch_cache_validate((Mesh *)ob->data); | DRW_mesh_batch_cache_validate((Mesh *)ob->data); | ||||
| break; | break; | ||||
| case OB_CURVE: | case OB_CURVE: | ||||
| case OB_FONT: | case OB_FONT: | ||||
| case OB_SURF: | case OB_SURF: | ||||
| if (mesh_eval != NULL) { | if (mesh_eval != NULL) { | ||||
| Show All 21 Lines | void drw_batch_cache_generate_requested(Object *ob) | ||||
| const bool is_paint_mode = ELEM( | const bool is_paint_mode = ELEM( | ||||
| mode, CTX_MODE_SCULPT, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT); | mode, CTX_MODE_SCULPT, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT); | ||||
| const bool use_hide = ((ob->type == OB_MESH) && | const bool use_hide = ((ob->type == OB_MESH) && | ||||
| ((is_paint_mode && (ob == draw_ctx->obact) && | ((is_paint_mode && (ob == draw_ctx->obact) && | ||||
| DRW_object_use_hide_faces(ob)) || | DRW_object_use_hide_faces(ob)) || | ||||
| ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob)))); | ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob)))); | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| DRW_mesh_batch_cache_create_requested(ob, (Mesh *)ob->data, scene, is_paint_mode, use_hide); | DRW_mesh_batch_cache_create_requested(ob, (Mesh *)ob->data, scene, is_paint_mode, use_hide); | ||||
| break; | break; | ||||
| case OB_CURVE: | case OB_CURVE: | ||||
| case OB_FONT: | case OB_FONT: | ||||
| case OB_SURF: | case OB_SURF: | ||||
| if (mesh_eval) { | if (mesh_eval) { | ||||
| DRW_mesh_batch_cache_create_requested(ob, mesh_eval, scene, is_paint_mode, use_hide); | DRW_mesh_batch_cache_create_requested(ob, mesh_eval, scene, is_paint_mode, use_hide); | ||||
| } | } | ||||
| DRW_curve_batch_cache_create_requested(ob); | DRW_curve_batch_cache_create_requested(ob); | ||||
| break; | break; | ||||
| /* TODO all cases */ | /* TODO all cases */ | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| void DRW_batch_cache_free_old(Object *ob, int ctime) | void DRW_batch_cache_free_old(Object *ob, int ctime) | ||||
| { | { | ||||
| struct Mesh *mesh_eval = ob->runtime.mesh_eval; | struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| DRW_mesh_batch_cache_free_old((Mesh *)ob->data, ctime); | DRW_mesh_batch_cache_free_old((Mesh *)ob->data, ctime); | ||||
| break; | break; | ||||
| case OB_CURVE: | case OB_CURVE: | ||||
| case OB_FONT: | case OB_FONT: | ||||
| case OB_SURF: | case OB_SURF: | ||||
| Show All 11 Lines | |||||