Skip to content

Commit 7cf7f6b

Browse files
Olli Etuahophemavax
authored andcommitted
Aquarium VR: Disable lightrays in VR mode
The effect is not compatible with headset rotation.
1 parent 4e96c69 commit 7cf7f6b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

aquarium-vr/aquarium-vr.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,8 @@ function initialize() {
11171117
gl.clearColor(0,0.8,1,0);
11181118
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
11191119

1120+
var presentingVR = g_vrDisplay && g_vrDisplay.isPresenting && pose.position;
1121+
11201122
var near = 1;
11211123
var far = 25000;
11221124
var aspect = canvas.clientWidth / canvas.clientHeight;
@@ -1129,7 +1131,7 @@ function initialize() {
11291131
var xOff = width * g.net.offset[0] * g.net.offsetMult;
11301132
var yOff = height * g.net.offset[1] * g.net.offsetMult;
11311133
var uiMatrix = new Float32Array(16);
1132-
if (g_vrDisplay && g_vrDisplay.isPresenting && pose.position) {
1134+
if (presentingVR) {
11331135
// Using head-neck model in VR mode because of unclear distance measurement(vr return position using meters),
11341136
// user could see around but couldn't move around.
11351137
eyePosition[0] = g.globals.eyeRadius;
@@ -1416,7 +1418,8 @@ function initialize() {
14161418

14171419
gl.enable(gl.BLEND);
14181420
gl.disable(gl.CULL_FACE);
1419-
if (g.options.lightRays.enabled) {
1421+
// Light rays are not supported in VR mode - they are rendered in a way that they can't handle headset rotation.
1422+
if (g.options.lightRays.enabled && !presentingVR) {
14201423
gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
14211424
gl.depthMask(false);
14221425
lightRay.drawPrep(lightRayConst);

0 commit comments

Comments
 (0)