Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl
| uniform mat4 ModelViewProjectionMatrix; | uniform mat4 ModelViewProjectionMatrix; | ||||
| in vec3 pos; | in vec3 pos; | ||||
| #ifndef UNIFORM_ID | #ifndef UNIFORM_ID | ||||
| uniform uint offset; | uniform uint offset; | ||||
| in uint color; | in uint color; | ||||
| flat out vec4 id; | flat out uint id; | ||||
| #endif | #endif | ||||
| void main() | void main() | ||||
| { | { | ||||
| #ifndef UNIFORM_ID | #ifndef UNIFORM_ID | ||||
| id = vec4( | id = offset + color; | ||||
| (((color + offset) ) & 0xFFu) * (1.0f / 255.0f), | |||||
| (((color + offset) >> 8u) & 0xFFu) * (1.0f / 255.0f), | |||||
| (((color + offset) >> 16u) & 0xFFu) * (1.0f / 255.0f), | |||||
| (((color + offset) >> 24u) ) * (1.0f / 255.0f)); | |||||
| #endif | #endif | ||||
| vec4 pos_4d = vec4(pos, 1.0); | vec4 pos_4d = vec4(pos, 1.0); | ||||
| gl_Position = ModelViewProjectionMatrix * pos_4d; | gl_Position = ModelViewProjectionMatrix * pos_4d; | ||||
| #ifdef USE_WORLD_CLIP_PLANES | #ifdef USE_WORLD_CLIP_PLANES | ||||
| /* Warning: ModelMatrix is typically used but select drawing is different. */ | /* Warning: ModelMatrix is typically used but select drawing is different. */ | ||||
| world_clip_planes_calc_clip_distance(pos); | world_clip_planes_calc_clip_distance(pos); | ||||
| #endif | #endif | ||||
| } | } | ||||