Skip to content

Commit 3ad1642

Browse files
committed
Merge pull request godotengine#110410 from BastiaanOlij/fix_stereo_label3d_fixed_size
Fix fixed size flag on StandardMaterial3D when rendering in stereo
2 parents aad046e + 748f35c commit 3ad1642

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scene/resources/material.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ void vertex() {)";
13571357
if (flags[FLAG_FIXED_SIZE]) {
13581358
code += R"(
13591359
// Fixed Size: Enabled
1360-
if (PROJECTION_MATRIX[3][3] != 0.0) {
1360+
if (PROJECTION_MATRIX[2][3] == 0.0) {
13611361
// Orthogonal matrix; try to do about the same with viewport size.
13621362
float h = abs(1.0 / (2.0 * PROJECTION_MATRIX[1][1]));
13631363
// Consistent with vertical FOV (Keep Height).
@@ -1367,7 +1367,7 @@ void vertex() {)";
13671367
MODELVIEW_MATRIX[2] *= sc;
13681368
} else {
13691369
// Scale by depth.
1370-
float sc = -(MODELVIEW_MATRIX)[3].z;
1370+
float sc = length((MODELVIEW_MATRIX)[3].xyz);
13711371
MODELVIEW_MATRIX[0] *= sc;
13721372
MODELVIEW_MATRIX[1] *= sc;
13731373
MODELVIEW_MATRIX[2] *= sc;

0 commit comments

Comments
 (0)