Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/drawobject.c
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
| #include "GPU_matrix.h" | #include "GPU_matrix.h" | ||||
| #include "GPU_state.h" | #include "GPU_state.h" | ||||
| #include "GPU_framebuffer.h" | #include "GPU_framebuffer.h" | ||||
| #include "ED_mesh.h" | #include "ED_mesh.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "DRW_engine.h" | |||||
| #include "view3d_intern.h" /* bad level include */ | #include "view3d_intern.h" /* bad level include */ | ||||
| #include "../../draw/intern/draw_cache_impl.h" /* bad level include (temporary) */ | #include "../../draw/intern/draw_cache_impl.h" /* bad level include (temporary) */ | ||||
| int view3d_effective_drawtype(const struct View3D *v3d) | int view3d_effective_drawtype(const struct View3D *v3d) | ||||
| { | { | ||||
| if (v3d->shading.type == OB_RENDER) { | if (v3d->shading.type == OB_RENDER) { | ||||
| return v3d->shading.prev_type; | return v3d->shading.prev_type; | ||||
| ▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob, const float world_clip_planes[6][4]) | ||||
| const bool use_hide = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL); | const bool use_hide = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL); | ||||
| GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); | GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); | ||||
| DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, use_hide); | DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, use_hide); | ||||
| bbs_mesh_face(geom_faces, true, world_clip_planes); | bbs_mesh_face(geom_faces, true, world_clip_planes); | ||||
| } | } | ||||
| void draw_object_backbufsel( | void draw_object_select_id( | ||||
| Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, | Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, | ||||
| short select_mode) | short select_mode) | ||||
| { | { | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| if (select_mode == -1) { | if (select_mode == -1) { | ||||
| select_mode = ts->selectmode; | select_mode = ts->selectmode; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | switch (ob->type) { | ||||
| case OB_CURVE: | case OB_CURVE: | ||||
| case OB_SURF: | case OB_SURF: | ||||
| break; | break; | ||||
| } | } | ||||
| GPU_matrix_set(rv3d->viewmat); | GPU_matrix_set(rv3d->viewmat); | ||||
| } | } | ||||
| void draw_object_depth(RegionView3D *rv3d, Object *ob) | |||||
| { | |||||
| GPU_matrix_mul(ob->obmat); | |||||
| GPU_depth_test(true); | |||||
| const float (*world_clip_planes)[4] = NULL; | |||||
| if (rv3d->rflag & RV3D_CLIPPING) { | |||||
| ED_view3d_clipping_local(rv3d, ob->obmat); | |||||
| world_clip_planes = rv3d->clip_local; | |||||
| } | |||||
| switch (ob->type) { | |||||
| case OB_MESH: | |||||
| { | |||||
| GPUBatch *batch; | |||||
| Mesh *me = ob->data; | |||||
| if (ob->mode & OB_MODE_EDIT) { | |||||
| batch = DRW_mesh_batch_cache_get_edit_triangles(me); | |||||
| } | |||||
| else { | |||||
| batch = DRW_mesh_batch_cache_get_surface(me); | |||||
| } | |||||
| DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true); | |||||
| DRW_opengl_context_enable(); | |||||
| const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; | |||||
| GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_DEPTH_ONLY, sh_cfg); | |||||
| if (world_clip_planes != NULL) { | |||||
| bbs_world_clip_planes_from_rv3d(batch, world_clip_planes); | |||||
| } | |||||
| GPU_batch_draw(batch); | |||||
| DRW_opengl_context_disable(); | |||||
| } | |||||
| break; | |||||
| case OB_CURVE: | |||||
| case OB_SURF: | |||||
| break; | |||||
| } | |||||
| GPU_matrix_set(rv3d->viewmat); | |||||
| } | |||||
| void ED_draw_object_facemap( | void ED_draw_object_facemap( | ||||
| Depsgraph *depsgraph, Object *ob, const float col[4], const int facemap) | Depsgraph *depsgraph, Object *ob, const float col[4], const int facemap) | ||||
| { | { | ||||
| /* happens on undo */ | /* happens on undo */ | ||||
| if (ob->type != OB_MESH || !ob->data) { | if (ob->type != OB_MESH || !ob->data) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines | |||||