Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/modes/edit_lattice_mode.c
| Show First 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
| * Assume that all Passes are NULL */ | * Assume that all Passes are NULL */ | ||||
| static void EDIT_LATTICE_cache_init(void *vedata) | static void EDIT_LATTICE_cache_init(void *vedata) | ||||
| { | { | ||||
| EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl; | EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl; | ||||
| EDIT_LATTICE_StorageList *stl = ((EDIT_LATTICE_Data *)vedata)->stl; | EDIT_LATTICE_StorageList *stl = ((EDIT_LATTICE_Data *)vedata)->stl; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| RegionView3D *rv3d = draw_ctx->rv3d; | RegionView3D *rv3d = draw_ctx->rv3d; | ||||
| View3D *v3d = draw_ctx->v3d; | |||||
| EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | ||||
| if (!stl->g_data) { | if (!stl->g_data) { | ||||
| /* Alloc transient pointers */ | /* Alloc transient pointers */ | ||||
| stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__); | stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__); | ||||
| } | } | ||||
| { | { | ||||
| DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL; | DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL; | ||||
| psl->wire_pass = DRW_pass_create("Lattice Wire", state); | psl->wire_pass = DRW_pass_create("Lattice Wire", state); | ||||
| stl->g_data->wire_shgrp = DRW_shgroup_create(sh_data->wire, psl->wire_pass); | stl->g_data->wire_shgrp = DRW_shgroup_create(sh_data->wire, psl->wire_pass); | ||||
| if (rv3d->rflag & RV3D_CLIPPING) { | if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
| DRW_shgroup_state_enable(stl->g_data->wire_shgrp, DRW_STATE_CLIP_PLANES); | DRW_shgroup_state_enable(stl->g_data->wire_shgrp, DRW_STATE_CLIP_PLANES); | ||||
| } | } | ||||
| state = DRW_STATE_WRITE_COLOR; | state = DRW_STATE_WRITE_COLOR; | ||||
| psl->vert_pass = DRW_pass_create("Lattice Verts", state); | psl->vert_pass = DRW_pass_create("Lattice Verts", state); | ||||
| stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, psl->vert_pass); | stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, psl->vert_pass); | ||||
| DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo); | DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo); | ||||
| if (rv3d->rflag & RV3D_CLIPPING) { | if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
| DRW_shgroup_state_enable(stl->g_data->vert_shgrp, DRW_STATE_CLIP_PLANES); | DRW_shgroup_state_enable(stl->g_data->vert_shgrp, DRW_STATE_CLIP_PLANES); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Add geometry to shadingGroups. Execute for each objects */ | /* Add geometry to shadingGroups. Execute for each objects */ | ||||
| static void EDIT_LATTICE_cache_populate(void *vedata, Object *ob) | static void EDIT_LATTICE_cache_populate(void *vedata, Object *ob) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines | |||||