Files
test2/source/blender/draw/engines/overlay/shaders/overlay_image_vert.glsl
Clément Foucault fe213f80a4 GPU: Shader: Make info files generated
This is the first step of moving the create infos
back inside shader sources.

All info files are now treated as source files.
However, they are not considered in the include tree
yet. This will come in another following PR.

Each shader source file now generate a `.info` file
containing only the create info declarations.

This renames all info files so that they do not
conflict with their previous versions that were
copied (non-generated).

Pull Request: https://projects.blender.org/blender/blender/pulls/146676
2025-09-25 10:57:02 +02:00

49 lines
1.4 KiB
GLSL

/* SPDX-FileCopyrightText: 2019-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/overlay_extra_infos.hh"
VERTEX_SHADER_CREATE_INFO(overlay_image_base)
VERTEX_SHADER_CREATE_INFO(draw_modelmat)
#include "draw_model_lib.glsl"
#include "draw_view_clipping_lib.glsl"
#include "draw_view_lib.glsl"
#include "select_lib.glsl"
void main()
{
select_id_set(drw_custom_id());
float3 world_pos = drw_point_object_to_world(pos);
if (is_camera_background) {
/* Model matrix converts to view position to avoid jittering (see #91398). */
#ifdef DEPTH_BIAS
gl_Position = depth_bias_winmat * float4(world_pos, 1.0f);
#else
gl_Position = drw_point_view_to_homogenous(world_pos);
#endif
/* Camera background images are not really part of the 3D space.
* It makes no sense to apply clipping on them. */
view_clipping_distances_bypass();
}
else {
#ifdef DEPTH_BIAS
gl_Position = depth_bias_winmat * (drw_view().viewmat * float4(world_pos, 1.0f));
#else
gl_Position = drw_point_world_to_homogenous(world_pos);
#endif
view_clipping_distances(world_pos);
}
if (depth_set) {
/* Result in a position at 1.0 (far plane). Small epsilon to avoid precision issue.
* This mimics the effect of infinite projection matrix
* (see http://www.terathon.com/gdc07_lengyel.pdf). */
gl_Position.z = gl_Position.w - 2.4e-7f;
view_clipping_distances_bypass();
}
uvs = pos.xy * 0.5f + 0.5f;
}