Fix AR background alignment issues
This commit is contained in:
@@ -39,11 +39,11 @@ void main() {
|
||||
vec4 position = PLANE[gl_VertexIndex];
|
||||
|
||||
// Calculate the scaling factors for width and height
|
||||
float width = realCam.width;
|
||||
float realScale = realCam.intrinsic[0][0] / width;
|
||||
float realAspect = width / realCam.height;
|
||||
float scaleX = realScale / cam.scaleFactor;
|
||||
float scaleY = cam.aspect / realAspect * scaleX;
|
||||
float height = realCam.height;
|
||||
float realScale = realCam.intrinsic[1][1] / height;
|
||||
float realAspect = height / realCam.width;
|
||||
float scaleY = realScale / cam.scaleFactor;
|
||||
float scaleX = scaleY / (cam.aspect * realAspect);
|
||||
|
||||
// Scale the quad's position
|
||||
position.xy *= vec2(scaleX, scaleY);
|
||||
@@ -51,7 +51,7 @@ void main() {
|
||||
// Handle center
|
||||
vec2 centerOffset = realCam.intrinsic[2].xy / vec2(realCam.width, realCam.height);
|
||||
centerOffset -= 0.5;
|
||||
position.xy += centerOffset;
|
||||
position.xy -= centerOffset;
|
||||
|
||||
gl_Position = position;
|
||||
textureCoordinates = TEX_COORDS[gl_VertexIndex];
|
||||
|
||||
Reference in New Issue
Block a user