Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/image/image_space_node.hh
| Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | bool use_tile_drawing() const override | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * The backdrop of the node editor isn't drawn in screen space UV space. But is locked with the | * The backdrop of the node editor isn't drawn in screen space UV space. But is locked with the | ||||
| * screen. | * screen. | ||||
| */ | */ | ||||
| void init_ss_to_texture_matrix(const ARegion *region, | void init_ss_to_texture_matrix(const ARegion *region, | ||||
| const float image_display_offset[2], | |||||
| const float image_resolution[2], | const float image_resolution[2], | ||||
| float r_uv_to_texture[4][4]) const override | float r_uv_to_texture[4][4]) const override | ||||
| { | { | ||||
| unit_m4(r_uv_to_texture); | unit_m4(r_uv_to_texture); | ||||
| float display_resolution[2]; | float display_resolution[2]; | ||||
| mul_v2_v2fl(display_resolution, image_resolution, snode->zoom); | mul_v2_v2fl(display_resolution, image_resolution, snode->zoom); | ||||
| const float scale_x = display_resolution[0] / region->winx; | const float scale_x = display_resolution[0] / region->winx; | ||||
| const float scale_y = display_resolution[1] / region->winy; | const float scale_y = display_resolution[1] / region->winy; | ||||
| const float translate_x = ((region->winx - display_resolution[0]) * 0.5f + snode->xof) / | const float translate_x = ((region->winx - display_resolution[0]) * 0.5f + snode->xof + image_display_offset[0]) / | ||||
| region->winx; | region->winx ; | ||||
| const float translate_y = ((region->winy - display_resolution[1]) * 0.5f + snode->yof) / | const float translate_y = ((region->winy - display_resolution[1]) * 0.5f + snode->yof + image_display_offset[1]) / | ||||
| region->winy; | region->winy; | ||||
| r_uv_to_texture[0][0] = scale_x; | r_uv_to_texture[0][0] = scale_x; | ||||
| r_uv_to_texture[1][1] = scale_y; | r_uv_to_texture[1][1] = scale_y; | ||||
| r_uv_to_texture[3][0] = translate_x; | r_uv_to_texture[3][0] = translate_x; | ||||
| r_uv_to_texture[3][1] = translate_y; | r_uv_to_texture[3][1] = translate_y; | ||||
| } | } | ||||
| }; | }; | ||||
| } // namespace blender::draw::image_engine | } // namespace blender::draw::image_engine | ||||