Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/basic/basic_engine.c
| Show All 21 Lines | |||||
| * Simple engine for drawing color and/or depth. | * Simple engine for drawing color and/or depth. | ||||
| * When we only need simple flat shaders. | * When we only need simple flat shaders. | ||||
| */ | */ | ||||
| #include "DRW_render.h" | #include "DRW_render.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_pbvh.h" | |||||
| #include "DNA_mesh_types.h" | |||||
| #include "DNA_particle_types.h" | #include "DNA_particle_types.h" | ||||
| #include "GPU_shader.h" | #include "GPU_shader.h" | ||||
| #include "basic_engine.h" | #include "basic_engine.h" | ||||
| /* Shaders */ | /* Shaders */ | ||||
| #define BASIC_ENGINE "BLENDER_BASIC" | #define BASIC_ENGINE "BLENDER_BASIC" | ||||
| ▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | if (is_flat_object_viewed_from_side) { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && | const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && | ||||
| !DRW_state_is_image_render(); | !DRW_state_is_image_render(); | ||||
| const bool do_cull = (draw_ctx->v3d && | const bool do_cull = (draw_ctx->v3d && | ||||
| (draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING)); | (draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING)); | ||||
| const bool do_update_sculpt_normals = ob->sculpt && ob->sculpt->pbvh; | |||||
| DRWShadingGroup *shgrp = (do_cull) ? stl->g_data->depth_shgrp_cull[do_in_front] : | DRWShadingGroup *shgrp = (do_cull) ? stl->g_data->depth_shgrp_cull[do_in_front] : | ||||
| stl->g_data->depth_shgrp[do_in_front]; | stl->g_data->depth_shgrp[do_in_front]; | ||||
| if (do_update_sculpt_normals) { | |||||
| Mesh *mesh = ob->data; | |||||
| BKE_pbvh_update_normals(ob->sculpt->pbvh, mesh->runtime.subdiv_ccg); | |||||
| } | |||||
| if (use_sculpt_pbvh) { | if (use_sculpt_pbvh) { | ||||
| DRW_shgroup_call_sculpt(shgrp, ob, false, false); | DRW_shgroup_call_sculpt(shgrp, ob, false, false); | ||||
| } | } | ||||
| else { | else { | ||||
| struct GPUBatch *geom = DRW_cache_object_surface_get(ob); | struct GPUBatch *geom = DRW_cache_object_surface_get(ob); | ||||
| if (geom) { | if (geom) { | ||||
| DRW_shgroup_call(shgrp, geom, ob); | DRW_shgroup_call(shgrp, geom, ob); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines | |||||