Skip to content

Commit bf30e43

Browse files
authored
Merge pull request #317 from De-Panther/fix_xri_related_bugs
Fix MRC, Webcam and HandMenu after XRI PR
2 parents 55b99b1 + c2df0a3 commit bf30e43

File tree

5 files changed

+77
-77
lines changed

5 files changed

+77
-77
lines changed

DebugProjects/Unity2020.3/ProjectSettings/ProjectSettings.asset

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--- !u!129 &1
44
PlayerSettings:
55
m_ObjectHideFlags: 0
6-
serializedVersion: 20
6+
serializedVersion: 22
77
productGUID: b27fd1ea3d9378f41813bacaf2f1736d
88
AndroidProfiler: 0
99
AndroidFilterTouchesWhenObscured: 0
@@ -13,7 +13,7 @@ PlayerSettings:
1313
useOnDemandResources: 0
1414
accelerometerFrequency: 60
1515
companyName: De-Panther
16-
productName: Unity2020.3 WebXR Export
16+
productName: Unity WebXR Export
1717
defaultCursor: {fileID: 0}
1818
cursorHotspot: {x: 0, y: 0}
1919
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
@@ -119,6 +119,7 @@ PlayerSettings:
119119
stadiaTargetFramerate: 0
120120
vulkanNumSwapchainBuffers: 3
121121
vulkanEnableSetSRGBWrite: 0
122+
vulkanEnablePreTransform: 0
122123
vulkanEnableLateAcquireNextImage: 0
123124
m_SupportedAspectRatios:
124125
4:3: 1
@@ -134,31 +135,6 @@ PlayerSettings:
134135
xboxOneDisableKinectGpuReservation: 1
135136
xboxOneEnable7thCore: 1
136137
vrSettings:
137-
cardboard:
138-
depthFormat: 0
139-
enableTransitionView: 0
140-
daydream:
141-
depthFormat: 0
142-
useSustainedPerformanceMode: 0
143-
enableVideoLayer: 0
144-
useProtectedVideoMemory: 0
145-
minimumSupportedHeadTracking: 0
146-
maximumSupportedHeadTracking: 1
147-
hololens:
148-
depthFormat: 1
149-
depthBufferSharingEnabled: 1
150-
lumin:
151-
depthFormat: 0
152-
frameTiming: 2
153-
enableGLCache: 0
154-
glCacheMaxBlobSize: 524288
155-
glCacheMaxFileSize: 8388608
156-
oculus:
157-
sharedDepthBuffer: 1
158-
dashSupport: 1
159-
lowOverheadMode: 0
160-
protectedContext: 0
161-
v2Signing: 1
162138
enable360StereoCapture: 0
163139
isWsaHolographicRemotingEnabled: 0
164140
enableFrameTimingStats: 0
@@ -170,7 +146,11 @@ PlayerSettings:
170146
androidSupportedAspectRatio: 1
171147
androidMaxAspectRatio: 2.1
172148
applicationIdentifier: {}
173-
buildNumber: {}
149+
buildNumber:
150+
Standalone: 0
151+
iPhone: 0
152+
tvOS: 0
153+
overrideDefaultApplicationIdentifier: 0
174154
AndroidBundleVersionCode: 1
175155
AndroidMinSdkVersion: 19
176156
AndroidTargetSdkVersion: 0
@@ -224,8 +204,8 @@ PlayerSettings:
224204
iOSLaunchScreeniPadFillPct: 100
225205
iOSLaunchScreeniPadSize: 100
226206
iOSLaunchScreeniPadCustomXibPath:
227-
iOSUseLaunchScreenStoryboard: 0
228207
iOSLaunchScreenCustomStoryboardPath:
208+
iOSLaunchScreeniPadCustomStoryboardPath:
229209
iOSDeviceRequirements: []
230210
iOSURLSchemes: []
231211
iOSBackgroundModes: 0
@@ -243,9 +223,17 @@ PlayerSettings:
243223
iOSRequireARKit: 0
244224
iOSAutomaticallyDetectAndAddCapabilities: 1
245225
appleEnableProMotion: 0
226+
shaderPrecisionModel: 0
246227
clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
247228
templatePackageId: [email protected]
248229
templateDefaultScene: Assets/Scenes/SampleScene.unity
230+
useCustomMainManifest: 0
231+
useCustomLauncherManifest: 0
232+
useCustomMainGradleTemplate: 0
233+
useCustomLauncherGradleManifest: 0
234+
useCustomBaseGradleTemplate: 0
235+
useCustomGradlePropertiesTemplate: 0
236+
useCustomProguardFile: 0
249237
AndroidTargetArchitectures: 1
250238
AndroidSplashScreenScale: 0
251239
androidSplashScreen: {fileID: 0}
@@ -327,7 +315,7 @@ PlayerSettings:
327315
m_Automatic: 1
328316
- m_BuildTarget: AppleTVSupport
329317
m_APIs: 10000000
330-
m_Automatic: 0
318+
m_Automatic: 1
331319
- m_BuildTarget: WebGLSupport
332320
m_APIs: 0b000000
333321
m_Automatic: 1
@@ -341,13 +329,16 @@ PlayerSettings:
341329
openGLRequireES31AEP: 0
342330
openGLRequireES32: 0
343331
m_TemplateCustomTags:
344-
DESCRIPTION: Unity 2020.3 WebXR demo
332+
DESCRIPTION: Complete interactive 3D scene demo made in Unity and exported to
333+
WebXR with the WebXR template of the Unity WebXR Export
334+
WEBXR_POLYFILL_CONFIG:
345335
mobileMTRendering:
346336
Android: 1
347337
iPhone: 1
348338
tvOS: 1
349339
m_BuildTargetGroupLightmapEncodingQuality: []
350340
m_BuildTargetGroupLightmapSettings: []
341+
m_BuildTargetNormalMapEncoding: []
351342
playModeTestRunnerEnabled: 0
352343
runPlayModeTestAsEditModeTest: 0
353344
actionOnDotNetUnhandledException: 1
@@ -382,6 +373,7 @@ PlayerSettings:
382373
switchTitleNames_12:
383374
switchTitleNames_13:
384375
switchTitleNames_14:
376+
switchTitleNames_15:
385377
switchPublisherNames_0:
386378
switchPublisherNames_1:
387379
switchPublisherNames_2:
@@ -397,6 +389,7 @@ PlayerSettings:
397389
switchPublisherNames_12:
398390
switchPublisherNames_13:
399391
switchPublisherNames_14:
392+
switchPublisherNames_15:
400393
switchIcons_0: {fileID: 0}
401394
switchIcons_1: {fileID: 0}
402395
switchIcons_2: {fileID: 0}
@@ -412,6 +405,7 @@ PlayerSettings:
412405
switchIcons_12: {fileID: 0}
413406
switchIcons_13: {fileID: 0}
414407
switchIcons_14: {fileID: 0}
408+
switchIcons_15: {fileID: 0}
415409
switchSmallIcons_0: {fileID: 0}
416410
switchSmallIcons_1: {fileID: 0}
417411
switchSmallIcons_2: {fileID: 0}
@@ -427,6 +421,7 @@ PlayerSettings:
427421
switchSmallIcons_12: {fileID: 0}
428422
switchSmallIcons_13: {fileID: 0}
429423
switchSmallIcons_14: {fileID: 0}
424+
switchSmallIcons_15: {fileID: 0}
430425
switchManualHTML:
431426
switchAccessibleURLs:
432427
switchLegalInformation:
@@ -489,6 +484,9 @@ PlayerSettings:
489484
switchSocketInitializeEnabled: 1
490485
switchNetworkInterfaceManagerInitializeEnabled: 1
491486
switchPlayerConnectionEnabled: 1
487+
switchUseNewStyleFilepaths: 0
488+
switchUseMicroSleepForYield: 1
489+
switchMicroSleepForYieldTime: 25
492490
ps4NPAgeRating: 12
493491
ps4NPTitleSecret:
494492
ps4NPTrophyPackPath:
@@ -584,6 +582,7 @@ PlayerSettings:
584582
webGLThreadsSupport: 0
585583
webGLDecompressionFallback: 0
586584
scriptingDefineSymbols: {}
585+
additionalCompilerArguments: {}
587586
platformArchitecture: {}
588587
scriptingBackend: {}
589588
il2cppCompilerConfiguration: {}
@@ -592,9 +591,12 @@ PlayerSettings:
592591
suppressCommonWarnings: 1
593592
allowUnsafeCode: 0
594593
useDeterministicCompilation: 1
594+
useReferenceAssemblies: 1
595+
enableRoslynAnalyzers: 1
595596
additionalIl2CppArgs:
596597
scriptingRuntimeVersion: 1
597598
gcIncremental: 1
599+
assemblyVersionValidation: 1
598600
gcWBarrierValidation: 0
599601
apiCompatibilityLevelPerPlatform: {}
600602
m_RenderingPath: 1
@@ -643,6 +645,7 @@ PlayerSettings:
643645
XboxOneCapability: []
644646
XboxOneGameRating: {}
645647
XboxOneIsContentPackage: 0
648+
XboxOneEnhancedXboxCompatibilityMode: 0
646649
XboxOneEnableGPUVariability: 1
647650
XboxOneSockets: {}
648651
XboxOneSplashScreen: {fileID: 0}
@@ -651,10 +654,7 @@ PlayerSettings:
651654
XboxOneXTitleMemory: 8
652655
XboxOneOverrideIdentityName:
653656
XboxOneOverrideIdentityPublisher:
654-
vrEditorSettings:
655-
daydream:
656-
daydreamIconForeground: {fileID: 0}
657-
daydreamIconBackground: {fileID: 0}
657+
vrEditorSettings: {}
658658
cloudServicesEnabled:
659659
UNet: 1
660660
luminIcon:
@@ -669,12 +669,12 @@ PlayerSettings:
669669
m_VersionCode: 1
670670
m_VersionName:
671671
apiCompatibilityLevel: 6
672+
activeInputHandler: 0
672673
cloudProjectId:
673674
framebufferDepthMemorylessMode: 0
675+
qualitySettingsNames: []
674676
projectName:
675677
organizationId:
676678
cloudEnabled: 0
677-
enableNativePlatformBackendsForNewInputSystem: 0
678-
disableOldInputManagerSupport: 0
679679
legacyClampBlendShapeWeights: 0
680680
virtualTexturingSupportEnabled: 0

DebugProjects/Unity2020.3/ProjectSettings/UnityConnectSettings.asset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ UnityConnectSettings:
99
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
1010
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
1111
m_ConfigUrl: https://config.uca.cloud.unity3d.com
12+
m_DashboardUrl: https://dashboard.unity3d.com
1213
m_TestInitMode: 0
1314
CrashReportingSettings:
1415
m_EventUrl: https://perf-events.cloud.unity3d.com

Packages/webxr-interactions/Runtime/InputSystem/HandMenu.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
#if UNITY_INPUT_SYSTEM_1_4_4_OR_NEWER
12
using Unity.XR.CoreUtils.Bindings;
23
using Unity.XR.CoreUtils.Bindings.Variables;
3-
using UnityEngine;
44
using UnityEngine.Assertions;
55
using UnityEngine.XR.Interaction.Toolkit.Inputs;
66
using UnityEngine.XR.Interaction.Toolkit.Utilities;
77
using UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables.Primitives;
88
using UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables.SmartTweenableVariables;
99
using UnityEngine.XR.Interaction.Toolkit.UI.BodyUI;
10+
#endif
11+
using UnityEngine;
12+
1013

1114
namespace WebXR.InputSystem
1215
{
@@ -25,6 +28,7 @@ namespace WebXR.InputSystem
2528
/// </remarks>
2629
public class HandMenu : MonoBehaviour
2730
{
31+
#if UNITY_INPUT_SYSTEM_1_4_4_OR_NEWER
2832
/// <summary>
2933
/// Enum dictating the up direction used in hand menu calculations.
3034
/// </summary>
@@ -717,5 +721,6 @@ static float AngleToDot(float angleDeg)
717721
{
718722
return Mathf.Cos(Mathf.Deg2Rad * angleDeg);
719723
}
724+
#endif
720725
}
721726
}

Packages/webxr-interactions/Runtime/Plugins/WebGL/FixWebCamWebGL.jslib

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
var LibraryFixWebCamWebGL = {
22
$webcamBufferToTextureTable: {},
33
$webcamLatestTextureId: 0,
4-
$disableNextSubImage: false,
5-
6-
glTexSubImage2D: function(target, level, xoffset, yoffset, width, height, format, type, pixels) {
7-
if (disableNextSubImage) {
8-
disableNextSubImage = false;
9-
return;
10-
}
11-
if (GL.currentContext.supportsWebGL2EntryPoints) {
12-
if (GLctx.currentPixelUnpackBufferBinding) {
13-
GLctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels)
14-
} else if (pixels != 0) {
15-
GLctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, emscriptenWebGLGetHeapForType(type), pixels >> emscriptenWebGLGetShiftForType(type))
16-
} else {
17-
GLctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, null)
18-
}
19-
return
20-
}
21-
var pixelData = null;
22-
if (pixels)
23-
pixelData = emscriptenWebGLGetTexPixelData(type, format, width, height, pixels, 0);
24-
GLctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixelData)
25-
},
264

275
JS_WebCamVideo_SetLatestTextureId: function(textureId) {
6+
if (typeof _JS_WebCamVideo_Update !== "undefined") {
7+
return;
8+
}
289
webcamLatestTextureId = textureId;
2910
// Webcam texture is created with texStorage2D so we have to recreate it
3011
GLctx.deleteTexture(GL.textures[textureId]);
@@ -37,6 +18,9 @@ var LibraryFixWebCamWebGL = {
3718
},
3819

3920
JS_WebCamVideo_RemoveWhereTextureId: function(textureId) {
21+
if (typeof _JS_WebCamVideo_Update !== "undefined") {
22+
return;
23+
}
4024
Object.entries(webcamBufferToTextureTable).forEach(function (pair) {
4125
if (pair[1] == textureId) {
4226
delete webcamBufferToTextureTable[pair[0]];
@@ -77,12 +61,21 @@ var LibraryFixWebCamWebGL = {
7761
GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL, true);
7862
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, GLctx.RGBA, GLctx.RGBA, GLctx.UNSIGNED_BYTE, videoElement);
7963
GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL, false);
80-
disableNextSubImage = true;
64+
GLctx.disableNextSubImage = true;
65+
if (!GLctx.webcamtexSubImage2D) {
66+
GLctx.webcamtexSubImage2D = GLctx.texSubImage2D;
67+
GLctx.texSubImage2D = function() {
68+
if (this.disableNextSubImage) {
69+
this.disableNextSubImage = false;
70+
return;
71+
}
72+
this.webcamtexSubImage2D.apply(this, arguments);
73+
}
74+
}
8175
return 1;
8276
}
8377
};
8478

8579
autoAddDeps(LibraryFixWebCamWebGL, '$webcamBufferToTextureTable');
8680
autoAddDeps(LibraryFixWebCamWebGL, '$webcamLatestTextureId');
87-
autoAddDeps(LibraryFixWebCamWebGL, '$disableNextSubImage');
8881
mergeInto(LibraryManager.library, LibraryFixWebCamWebGL);

Packages/webxr-interactions/Runtime/Scripts/MixedRealityCaptureController.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ 18 Spectator
2828
using UnityEngine;
2929
#if UNITY_INPUT_SYSTEM_1_4_4_OR_NEWER
3030
using UnityEngine.InputSystem;
31+
using UnityEngine.InputSystem.Controls;
3132
#endif
3233

3334
namespace WebXR.Interactions
@@ -321,21 +322,21 @@ private void Ended()
321322

322323
private void SetPoint(Transform point, GameObject hint, ControllerState nextState, GameObject nextHint, Transform nextPoint)
323324
{
324-
if (useInputSystem)
325-
{
326-
point.position = rightPosition.action.ReadValue<Vector3>();
327-
}
328-
else
329-
{
330-
point.position = rightController.transform.position;
331-
}
332-
if (GetControllersButtonDown())
325+
#if UNITY_INPUT_SYSTEM_1_4_4_OR_NEWER
326+
point.position = useInputSystem ?
327+
rightPosition.action.ReadValue<Vector3>()
328+
: rightController.transform.position;
329+
#else
330+
point.position = rightController.transform.position;
331+
#endif
332+
if (!GetControllersButtonDown())
333333
{
334-
hint.SetActive(false);
335-
nextHint.SetActive(true);
336-
nextPoint.gameObject.SetActive(true);
337-
state = nextState;
334+
return;
338335
}
336+
hint.SetActive(false);
337+
nextHint.SetActive(true);
338+
nextPoint.gameObject.SetActive(true);
339+
state = nextState;
339340
}
340341

341342
private void SetBottomPoint()
@@ -416,8 +417,8 @@ private bool GetControllersButtonDown()
416417
#if UNITY_INPUT_SYSTEM_1_4_4_OR_NEWER
417418
if (useInputSystem)
418419
{
419-
return leftTrigger.action.phase == InputActionPhase.Performed
420-
|| rightTrigger.action.phase == InputActionPhase.Performed;
420+
return ((ButtonControl)leftTrigger.action.activeControl).wasPressedThisFrame
421+
|| ((ButtonControl)rightTrigger.action.activeControl).wasPressedThisFrame;
421422
}
422423
#endif
423424
bool leftDown = (leftController.isHandActive || leftController.isControllerActive)

0 commit comments

Comments
 (0)