Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/basic/basic_engine.c
| Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
| static struct { | static struct { | ||||
| BASIC_Shaders sh_data[GPU_SHADER_CFG_LEN]; | BASIC_Shaders sh_data[GPU_SHADER_CFG_LEN]; | ||||
| } e_data = {{{NULL}}}; /* Engine data */ | } e_data = {{{NULL}}}; /* Engine data */ | ||||
| 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]; | |||||
| } BASIC_PrivateData; /* Transient data */ | } BASIC_PrivateData; /* Transient data */ | ||||
| /* Functions */ | /* Functions */ | ||||
| static void basic_engine_init(void *UNUSED(vedata)) | static void basic_engine_init(void *UNUSED(vedata)) | ||||
| { | { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | for (int i = 0; i < 2; i++) { | ||||
| GPUShader *sh = DRW_state_is_select() ? sh_data->depth_conservative : sh_data->depth; | GPUShader *sh = DRW_state_is_select() ? sh_data->depth_conservative : sh_data->depth; | ||||
| DRW_PASS_CREATE(psl->depth_pass[i], state | clip_state | infront_state); | DRW_PASS_CREATE(psl->depth_pass[i], state | clip_state | infront_state); | ||||
| stl->g_data->depth_shgrp[i] = grp = DRW_shgroup_create(sh, psl->depth_pass[i]); | stl->g_data->depth_shgrp[i] = grp = DRW_shgroup_create(sh, psl->depth_pass[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(sh_data->depth, | |||||
| psl->depth_pass[i]); | |||||
fclem: You don't need these uniforms. | |||||
| 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 All 14 Lines | if (ob != draw_ctx->object_edit) { | ||||
| for (ParticleSystem *psys = ob->particlesystem.first; psys != NULL; psys = psys->next) { | for (ParticleSystem *psys = ob->particlesystem.first; psys != NULL; psys = psys->next) { | ||||
| if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { | if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ParticleSettings *part = psys->part; | ParticleSettings *part = psys->part; | ||||
| const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as; | const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as; | ||||
| if (draw_as == PART_DRAW_PATH) { | if (draw_as == PART_DRAW_PATH) { | ||||
| struct GPUBatch *hairs = DRW_cache_particles_get_hair(ob, psys, NULL); | struct GPUBatch *hairs = DRW_cache_particles_get_hair(ob, psys, NULL); | ||||
| DRW_shgroup_call(stl->g_data->depth_shgrp[do_in_front], hairs, NULL); | DRW_shgroup_call(stl->g_data->depth_hair_shgrp[do_in_front], hairs, NULL); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Make flat object selectable in ortho view if wireframe is enabled. */ | /* 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; | ||||
| ▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines | |||||
You don't need these uniforms.