mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
gpu/shaders: introduce toClipSpace to map to GPU native clip space
OpenGL use the [-1; 1] range for clip depths, Direct3D [0; 1]. Use toClipSpace to encapsulate the difference. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -12,6 +12,12 @@ vec3[2] fboTextureTransform() {
|
||||
return t;
|
||||
}
|
||||
|
||||
// toClipSpace converts an OpenGL gl_Position value to a
|
||||
// native GPU position.
|
||||
vec4 toClipSpace(vec4 pos) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
vec3 transform3x2(vec3[2] t, vec3 v) {
|
||||
return vec3(dot(t[0], v), dot(t[1], v), dot(vec3(0.0, 0.0, 1.0), v));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user