Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/basic/basic_engine.c
| Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
| } BASIC_Data; | } BASIC_Data; | ||||
| /* *********** STATIC *********** */ | /* *********** STATIC *********** */ | ||||
| typedef struct BASIC_PrivateData { | typedef struct BASIC_PrivateData { | ||||
| DRWShadingGroup *depth_shgrp[2]; | DRWShadingGroup *depth_shgrp[2]; | ||||
| DRWShadingGroup *depth_shgrp_cull[2]; | DRWShadingGroup *depth_shgrp_cull[2]; | ||||
| DRWShadingGroup *depth_hair_shgrp[2]; | DRWShadingGroup *depth_hair_shgrp[2]; | ||||
| DRWShadingGroup *depth_curves_shgrp[2]; | |||||
| DRWShadingGroup *depth_pointcloud_shgrp[2]; | DRWShadingGroup *depth_pointcloud_shgrp[2]; | ||||
| bool use_material_slot_selection; | bool use_material_slot_selection; | ||||
| } BASIC_PrivateData; /* Transient data */ | } BASIC_PrivateData; /* Transient data */ | ||||
| static void basic_cache_init(void *vedata) | static void basic_cache_init(void *vedata) | ||||
| { | { | ||||
| BASIC_PassList *psl = ((BASIC_Data *)vedata)->psl; | BASIC_PassList *psl = ((BASIC_Data *)vedata)->psl; | ||||
| BASIC_StorageList *stl = ((BASIC_Data *)vedata)->stl; | BASIC_StorageList *stl = ((BASIC_Data *)vedata)->stl; | ||||
| Show All 30 Lines | for (int i = 0; i < 2; i++) { | ||||
| stl->g_data->depth_pointcloud_shgrp[i] = grp = DRW_shgroup_create( | stl->g_data->depth_pointcloud_shgrp[i] = grp = DRW_shgroup_create( | ||||
| sh, psl->depth_pass_pointcloud[i]); | sh, psl->depth_pass_pointcloud[i]); | ||||
| DRW_shgroup_uniform_vec2(grp, "sizeViewport", DRW_viewport_size_get(), 1); | DRW_shgroup_uniform_vec2(grp, "sizeViewport", DRW_viewport_size_get(), 1); | ||||
| DRW_shgroup_uniform_vec2(grp, "sizeViewportInv", DRW_viewport_invert_size_get(), 1); | DRW_shgroup_uniform_vec2(grp, "sizeViewportInv", DRW_viewport_invert_size_get(), 1); | ||||
| stl->g_data->depth_hair_shgrp[i] = grp = DRW_shgroup_create( | stl->g_data->depth_hair_shgrp[i] = grp = DRW_shgroup_create( | ||||
| BASIC_shaders_depth_sh_get(draw_ctx->sh_cfg), psl->depth_pass[i]); | BASIC_shaders_depth_sh_get(draw_ctx->sh_cfg), psl->depth_pass[i]); | ||||
| stl->g_data->depth_curves_shgrp[i] = grp = DRW_shgroup_create( | |||||
| BASIC_shaders_curves_depth_sh_get(draw_ctx->sh_cfg), psl->depth_pass[i]); | |||||
| sh = DRW_state_is_select() ? BASIC_shaders_depth_conservative_sh_get(draw_ctx->sh_cfg) : | sh = DRW_state_is_select() ? BASIC_shaders_depth_conservative_sh_get(draw_ctx->sh_cfg) : | ||||
| BASIC_shaders_depth_sh_get(draw_ctx->sh_cfg); | BASIC_shaders_depth_sh_get(draw_ctx->sh_cfg); | ||||
| state |= DRW_STATE_CULL_BACK; | state |= DRW_STATE_CULL_BACK; | ||||
| DRW_PASS_CREATE(psl->depth_pass_cull[i], state | clip_state | infront_state); | DRW_PASS_CREATE(psl->depth_pass_cull[i], state | clip_state | infront_state); | ||||
| stl->g_data->depth_shgrp_cull[i] = grp = DRW_shgroup_create(sh, psl->depth_pass_cull[i]); | stl->g_data->depth_shgrp_cull[i] = grp = DRW_shgroup_create(sh, psl->depth_pass_cull[i]); | ||||
| DRW_shgroup_uniform_vec2(grp, "sizeViewport", DRW_viewport_size_get(), 1); | DRW_shgroup_uniform_vec2(grp, "sizeViewport", DRW_viewport_size_get(), 1); | ||||
| DRW_shgroup_uniform_vec2(grp, "sizeViewportInv", DRW_viewport_invert_size_get(), 1); | DRW_shgroup_uniform_vec2(grp, "sizeViewportInv", DRW_viewport_invert_size_get(), 1); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | if (!DRW_object_is_renderable(ob) || (ob->dt < OB_SOLID)) { | ||||
| return; | return; | ||||
| } | } | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| if (ob != draw_ctx->object_edit) { | if (ob != draw_ctx->object_edit) { | ||||
| basic_cache_populate_particles(vedata, ob); | basic_cache_populate_particles(vedata, ob); | ||||
| } | } | ||||
| /* Make flat object selectable in ortho view if wireframe is enabled. */ | |||||
| const bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0; | const bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0; | ||||
| if (ob->type == OB_CURVES) { | |||||
| DRW_shgroup_curves_create_sub(ob, stl->g_data->depth_curves_shgrp[do_in_front], NULL); | |||||
| } | |||||
| /* Make flat object selectable in ortho view if wireframe is enabled. */ | |||||
| if ((draw_ctx->v3d->overlay.flag & V3D_OVERLAY_WIREFRAMES) || | if ((draw_ctx->v3d->overlay.flag & V3D_OVERLAY_WIREFRAMES) || | ||||
| (draw_ctx->v3d->shading.type == OB_WIRE) || (ob->dtx & OB_DRAWWIRE) || (ob->dt == OB_WIRE)) { | (draw_ctx->v3d->shading.type == OB_WIRE) || (ob->dtx & OB_DRAWWIRE) || (ob->dt == OB_WIRE)) { | ||||
| int flat_axis = 0; | int flat_axis = 0; | ||||
| bool is_flat_object_viewed_from_side = ((draw_ctx->rv3d->persp == RV3D_ORTHO) && | bool is_flat_object_viewed_from_side = ((draw_ctx->rv3d->persp == RV3D_ORTHO) && | ||||
| DRW_object_is_flat(ob, &flat_axis) && | DRW_object_is_flat(ob, &flat_axis) && | ||||
| DRW_object_axis_orthogonal_to_view(ob, flat_axis)); | DRW_object_axis_orthogonal_to_view(ob, flat_axis)); | ||||
| if (is_flat_object_viewed_from_side) { | if (is_flat_object_viewed_from_side) { | ||||
| ▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines | |||||