Skip to content

Commit 8c90ebf

Browse files
AlexThivfacebook-github-bot
authored andcommitted
Release for updated SDK 72.0.0
Summary: Updated: * PassthroughLayerResumed with new user experience Fix: * Missing texture in EnableDisablePassthrough scene * AndroidVideo Utils checks latest sdk before setting it Add: * Add mp4 for Stereo180Video for default behavior Reviewed By: lorenzoGoldoni, markusscmeta Differential Revision: D68535619 fbshipit-source-id: 77f90de4cf681bbb53cd9e0c9ceccb3f35313859
1 parent 87ee04f commit 8c90ebf

15 files changed

Lines changed: 11795 additions & 1152 deletions

Assets/Resources/ImmersiveDebuggerSettings.asset.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/StarterSamples/Core/Video/Editor/AndroidVideoEditorUtil.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using System.Collections.Generic;
2222
using UnityEditor;
2323
using System.IO;
24+
using UnityEditor.Android;
2425
using UnityEngine;
2526

2627
public class AndroidVideoEditorUtil
@@ -72,9 +73,37 @@ public static void EnableNativeVideoPlayer()
7273
properties.Save();
7374

7475
// Set the target sdk version to the required minimum for the NativeVideoPlayer plugin
75-
if (PlayerSettings.Android.targetSdkVersion < MinimumTargetAndroidSdkVersion)
76+
var currentTargetSDK = PlayerSettings.Android.targetSdkVersion;
77+
if (currentTargetSDK == 0)
78+
{
79+
var platformPath = Path.Combine(AndroidExternalToolsSettings.sdkRootPath, "platforms");
80+
if (Directory.Exists(platformPath))
81+
{
82+
var allSubDir = Directory.GetDirectories(platformPath);
83+
foreach (var dir in allSubDir)
84+
{
85+
// in this case the filename is the directory name
86+
var dirName = Path.GetFileName(dir);
87+
// directory format is android-29, android-30, etc.
88+
if (int.TryParse(dirName.Replace("android-", ""), out var sdkValue))
89+
{
90+
var sdkVersion = (AndroidSdkVersions)sdkValue;
91+
if (sdkVersion > currentTargetSDK)
92+
{
93+
currentTargetSDK = sdkVersion;
94+
}
95+
}
96+
}
97+
}
98+
else
99+
{
100+
Debug.LogError($"{platformPath} doesn't exists, the android build might not work as expected.");
101+
}
102+
}
103+
if (currentTargetSDK < MinimumTargetAndroidSdkVersion)
76104
{
77105
PlayerSettings.Android.targetSdkVersion = MinimumTargetAndroidSdkVersion;
106+
Debug.Log($"Update settings to match minimum android target API level to {MinimumTargetAndroidSdkVersion}");
78107
}
79108
}
80109

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 8
6+
m_ObjectHideFlags: 0
7+
m_CorrespondingSourceObject: {fileID: 0}
8+
m_PrefabInstance: {fileID: 0}
9+
m_PrefabAsset: {fileID: 0}
10+
m_Name: PassthroughFader
11+
m_Shader: {fileID: 4800000, guid: 3ffafe8e77a7463409d247d43487ee7b, type: 3}
12+
m_ValidKeywords: []
13+
m_InvalidKeywords: []
14+
m_LightmapFlags: 4
15+
m_EnableInstancingVariants: 0
16+
m_DoubleSidedGI: 0
17+
m_CustomRenderQueue: -1
18+
stringTagMap: {}
19+
disabledShaderPasses: []
20+
m_SavedProperties:
21+
serializedVersion: 3
22+
m_TexEnvs:
23+
- _MainTex:
24+
m_Texture: {fileID: 0}
25+
m_Scale: {x: 1, y: 1}
26+
m_Offset: {x: 0, y: 0}
27+
m_Ints: []
28+
m_Floats:
29+
- _BlendOpAlpha: 3
30+
- _BlendOpColor: 2
31+
- _FadeDirection: 2
32+
- _InvertedAlpha: 1
33+
- _ZTest: 4
34+
m_Colors: []
35+
m_BuildTextureStacks: []

Assets/StarterSamples/Usage/Passthrough/Materials/PassthroughFader.mat.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/************************************************************************************
2+
Copyright (c) Meta Platforms, Inc. and affiliates.
3+
All rights reserved.
4+
5+
Licensed under the Oculus SDK License Agreement (the "License");
6+
you may not use the Oculus SDK except in compliance with the License,
7+
which is provided at the time of installation or download, or which
8+
otherwise accompanies this software in either electronic or hard copy form.
9+
10+
You may obtain a copy of the License at
11+
12+
https://developer.oculus.com/licenses/oculussdk/
13+
14+
Unless required by applicable law or agreed to in writing, the Oculus SDK
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
************************************************************************************/
20+
21+
Shader "Meta/PassthroughFader"
22+
{
23+
Properties
24+
{
25+
[HideInInspector] _MainTex("Texture", 2D) = "white" {}
26+
_InvertedAlpha("Inverted Alpha", float) = 1
27+
_FadeDirection("Fade Direction", Int) = 4
28+
29+
[HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 4
30+
[HideInInspector] [Enum(UnityEngine.Rendering.BlendOp)] _BlendOpColor("Blend Color", Float) = 2
31+
[HideInInspector] [Enum(UnityEngine.Rendering.BlendOp)] _BlendOpAlpha("Blend Alpha", Float) = 3
32+
}
33+
SubShader
34+
{
35+
Tags
36+
{
37+
"RenderType"="Transparent" "Queue"="Transparent-1"
38+
}
39+
LOD 100
40+
Pass
41+
{
42+
Cull Off
43+
ZTest[_ZTest]
44+
BlendOp[_BlendOpColor], [_BlendOpAlpha]
45+
Blend Zero One, One One
46+
CGPROGRAM
47+
#pragma vertex vert
48+
#pragma fragment frag
49+
#include "UnityCG.cginc"
50+
51+
struct appdata {
52+
float4 vertex : POSITION;
53+
float2 uv : TEXCOORD0;
54+
float3 normal : NORMAL;
55+
UNITY_VERTEX_INPUT_INSTANCE_ID
56+
};
57+
58+
struct v2f {
59+
float2 uv : TEXCOORD0;
60+
float4 vertex : SV_POSITION;
61+
UNITY_VERTEX_OUTPUT_STEREO
62+
};
63+
64+
sampler2D _MainTex;
65+
float4 _MainTex_ST;
66+
float _InvertedAlpha;
67+
int _FadeDirection;
68+
69+
v2f vert(appdata v) {
70+
v2f o;
71+
UNITY_SETUP_INSTANCE_ID(v);
72+
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
73+
o.vertex = UnityObjectToClipPos(v.vertex);
74+
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
75+
return o;
76+
}
77+
78+
fixed4 frag(v2f i) : SV_Target {
79+
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
80+
fixed4 col = tex2D(_MainTex, i.uv);
81+
82+
float fadeFactor = 1.0f;
83+
float dissolveThreshold = _InvertedAlpha;
84+
float edgeWidth = 0.1;
85+
float2 center = float2(.75, .5);
86+
87+
const float distance_from_center = length(i.uv - center);
88+
89+
if (_FadeDirection == 0) {
90+
const float alpha = lerp(col.r, 1 - col.r, _InvertedAlpha);
91+
col.a *= alpha;
92+
} else if (_FadeDirection == 1) {
93+
fadeFactor = 1.0f - i.uv.x;
94+
} else if (_FadeDirection == 2) {
95+
fadeFactor = 1.0f - i.uv.y;
96+
} else if (_FadeDirection == 3) {
97+
fadeFactor = 1.0f - distance_from_center;
98+
}
99+
100+
col.a *= smoothstep(dissolveThreshold - edgeWidth,
101+
dissolveThreshold + edgeWidth, fadeFactor);
102+
103+
return col;
104+
}
105+
ENDCG
106+
}
107+
}
108+
}

Assets/StarterSamples/Usage/Passthrough/Materials/PassthroughFader.shader.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)