Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_data.c
| Show First 20 Lines • Show All 1,545 Lines • ▼ Show 20 Lines | static void draw_view_matrix_state_update(DRWViewUboStorage *storage, | ||||
| const float viewmat[4][4], | const float viewmat[4][4], | ||||
| const float winmat[4][4]) | const float winmat[4][4]) | ||||
| { | { | ||||
| /* If only one the matrices is negative, then the | /* If only one the matrices is negative, then the | ||||
| * polygon winding changes and we don't want that. | * polygon winding changes and we don't want that. | ||||
| * By convention, the winmat is negative because | * By convention, the winmat is negative because | ||||
| * looking through the -Z axis. So this inverse the | * looking through the -Z axis. So this inverse the | ||||
| * changes the test for the winmat. */ | * changes the test for the winmat. */ | ||||
| BLI_assert(is_negative_m4(viewmat) == !is_negative_m4(winmat)); | /* TODO: this needs to be correct for v2d as well | ||||
| * BLI_assert(is_negative_m4(viewmat) == * !is_negative_m4(winmat)); */ | |||||
| copy_m4_m4(storage->viewmat, viewmat); | copy_m4_m4(storage->viewmat, viewmat); | ||||
| invert_m4_m4(storage->viewinv, storage->viewmat); | invert_m4_m4(storage->viewinv, storage->viewmat); | ||||
| copy_m4_m4(storage->winmat, winmat); | copy_m4_m4(storage->winmat, winmat); | ||||
| invert_m4_m4(storage->wininv, storage->winmat); | invert_m4_m4(storage->wininv, storage->winmat); | ||||
| mul_m4_m4m4(storage->persmat, winmat, viewmat); | mul_m4_m4m4(storage->persmat, winmat, viewmat); | ||||
| ▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | |||||
| DRWPass *DRW_pass_create(const char *name, DRWState state) | DRWPass *DRW_pass_create(const char *name, DRWState state) | ||||
| { | { | ||||
| DRWPass *pass = BLI_memblock_alloc(DST.vmempool->passes); | DRWPass *pass = BLI_memblock_alloc(DST.vmempool->passes); | ||||
| pass->state = state | DRW_STATE_PROGRAM_POINT_SIZE; | pass->state = state | DRW_STATE_PROGRAM_POINT_SIZE; | ||||
| if (((G.debug_value > 20) && (G.debug_value < 30)) || (G.debug & G_DEBUG)) { | if (((G.debug_value > 20) && (G.debug_value < 30)) || (G.debug & G_DEBUG)) { | ||||
| BLI_strncpy(pass->name, name, MAX_PASS_NAME); | BLI_strncpy(pass->name, name, MAX_PASS_NAME); | ||||
| } | } | ||||
| pass->line_width = (state & DRW_STATE_WIRE_SMOOTH) ? 2.0 : 1.0; | |||||
| pass->shgroups.first = NULL; | pass->shgroups.first = NULL; | ||||
| pass->shgroups.last = NULL; | pass->shgroups.last = NULL; | ||||
| pass->handle = DST.pass_handle; | pass->handle = DST.pass_handle; | ||||
| DRW_handle_increment(&DST.pass_handle); | DRW_handle_increment(&DST.pass_handle); | ||||
| return pass; | return pass; | ||||
| } | } | ||||
| Show All 18 Lines | void DRW_pass_state_add(DRWPass *pass, DRWState state) | ||||
| pass->state |= state; | pass->state |= state; | ||||
| } | } | ||||
| void DRW_pass_state_remove(DRWPass *pass, DRWState state) | void DRW_pass_state_remove(DRWPass *pass, DRWState state) | ||||
| { | { | ||||
| pass->state &= ~state; | pass->state &= ~state; | ||||
| } | } | ||||
| void DRW_pass_line_width_set(DRWPass *pass, float line_width) | |||||
| { | |||||
| pass->line_width = line_width; | |||||
| } | |||||
| void DRW_pass_foreach_shgroup(DRWPass *pass, | void DRW_pass_foreach_shgroup(DRWPass *pass, | ||||
| void (*callback)(void *userData, DRWShadingGroup *shgrp), | void (*callback)(void *userData, DRWShadingGroup *shgrp), | ||||
| void *userData) | void *userData) | ||||
| { | { | ||||
| for (DRWShadingGroup *shgroup = pass->shgroups.first; shgroup; shgroup = shgroup->next) { | for (DRWShadingGroup *shgroup = pass->shgroups.first; shgroup; shgroup = shgroup->next) { | ||||
| callback(userData, shgroup); | callback(userData, shgroup); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines | |||||