Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/image/image_drawing_mode.hh
| Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | private: | ||||
| * The depth is used to identify if the tile exist or transparent. | * The depth is used to identify if the tile exist or transparent. | ||||
| */ | */ | ||||
| void add_depth_shgroups(IMAGE_InstanceData &instance_data, | void add_depth_shgroups(IMAGE_InstanceData &instance_data, | ||||
| Image *image, | Image *image, | ||||
| ImageUser *image_user) const | ImageUser *image_user) const | ||||
| { | { | ||||
| GPUShader *shader = IMAGE_shader_depth_get(); | GPUShader *shader = IMAGE_shader_depth_get(); | ||||
| DRWShadingGroup *shgrp = DRW_shgroup_create(shader, instance_data.passes.depth_pass); | DRWShadingGroup *shgrp = DRW_shgroup_create(shader, instance_data.passes.depth_pass); | ||||
| float image_mat[4][4]; | float image_mat[4][4]; | ||||
| unit_m4(image_mat); | unit_m4(image_mat); | ||||
| ImageUser tile_user = {0}; | ImageUser tile_user = {0}; | ||||
| if (image_user) { | if (image_user) { | ||||
| tile_user = *image_user; | tile_user = *image_user; | ||||
| } | } | ||||
| Show All 16 Lines | for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) { | ||||
| if (tile_buffer == nullptr) { | if (tile_buffer == nullptr) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| instance_data.float_buffers.mark_used(tile_buffer); | instance_data.float_buffers.mark_used(tile_buffer); | ||||
| BKE_image_release_ibuf(image, tile_buffer, lock); | BKE_image_release_ibuf(image, tile_buffer, lock); | ||||
| DRWShadingGroup *shsub = DRW_shgroup_create_sub(shgrp); | DRWShadingGroup *shsub = DRW_shgroup_create_sub(shgrp); | ||||
| float4 min_max_uv(tile_x, tile_y, tile_x + 1, tile_y + 1); | float4 min_max_uv(tile_x, tile_y, tile_x + 1, tile_y + 1); | ||||
| DRW_shgroup_uniform_vec4_copy(shsub, "min_max_uv", min_max_uv); | DRW_shgroup_uniform_vec4_copy(shsub, "min_max_uv", min_max_uv); | ||||
jbakker: Although this works, it breaks the idea of being screen spaced textures and can lead to other… | |||||
| DRW_shgroup_call_obmat(shsub, info.batch, image_mat); | DRW_shgroup_call_obmat(shsub, info.batch, image_mat); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * \brief Update GPUTextures for drawing the image. | * \brief Update GPUTextures for drawing the image. | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 353 Lines • Show Last 20 Lines | |||||
Although this works, it breaks the idea of being screen spaced textures and can lead to other artifacts when we want to optimize panning in the image editor/node editor.
The idea is to update the clipping_uv_bounds of the texture info so that the viewer result is copied into the right part of the screen space texture. This could be done by altering the init_ss_to_texture_matrix so that update_screen_uv_bounds would set the correct offset.