Skip to content

Commit c33714f

Browse files
authored
Merge pull request #319 from De-Panther/optimize_ar_mode
Fix performance issues in AR
2 parents 366bbda + bd2b5a5 commit c33714f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Packages/webxr/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- OnControllerUpdate is not dependent on OnHandUpdate in WebXRSubsystem.
1515
- WebXRControllerData gripPosition and gripRotation return world space value instead of relative to pointer pose.
1616

17+
### Fixed
18+
- Performance issues in AR mode.
19+
1720
## [0.18.0] - 2023-08-29
1821
### Added
1922
- Option to update active camera tag in WebXRCamera.
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
// Modified version of https://forum.unity.com/threads/webgl-transparent-background.284699/#post-1880667
22
// More details at https://support.unity.com/hc/en-us/articles/208892946-How-can-I-make-the-canvas-transparent-on-WebGL-
33
var LibraryGLClear = {
4+
$colorMaskValue: [true, true, true, true],
45
glClear: function (mask) {
56
if (mask == 0x00004000 && GLctx.dontClearAlphaOnly) {
6-
var v = GLctx.getParameter(GLctx.COLOR_WRITEMASK);
7-
if (!v[0] && !v[1] && !v[2] && v[3])
7+
if (!colorMaskValue[0] && !colorMaskValue[1] && !colorMaskValue[2] && colorMaskValue[3])
88
// We are trying to clear alpha only -- skip.
99
return;
1010
}
1111
GLctx.clear(mask);
12+
},
13+
glColorMask: function (red, green, blue, alpha) {
14+
colorMaskValue[0] = !!red;
15+
colorMaskValue[1] = !!green;
16+
colorMaskValue[2] = !!blue;
17+
colorMaskValue[3] = !!alpha;
18+
GLctx.colorMask(colorMaskValue[0], colorMaskValue[1], colorMaskValue[2], colorMaskValue[3]);
1219
}
1320
};
21+
autoAddDeps(LibraryGLClear, '$colorMaskValue');
1422
mergeInto(LibraryManager.library, LibraryGLClear);

0 commit comments

Comments
 (0)