浏览代码
Add a way to enumerate and select a camera configuration to the CameraImage sample scene. This affects the resolution of the image returned by XRCameraSubsystem.TryGetLatestImage.
Add a way to enumerate and select a camera configuration to the CameraImage sample scene. This affects the resolution of the image returned by XRCameraSubsystem.TryGetLatestImage.
This sample will not currently work; this demonstrates new functionality not yet publicly released./1.5-preview
Tim Mowrer
6 年前
当前提交
a7323acc
共有 6 个文件被更改,包括 894 次插入 和 62 次删除
-
811Assets/Scenes/CameraImage.unity
-
30Assets/Scripts/TestCameraImage.cs
-
48Packages/manifest.json
-
2ProjectSettings/ProjectVersion.txt
-
54Assets/Scripts/CameraConfigController.cs
-
11Assets/Scripts/CameraConfigController.cs.meta
811
Assets/Scenes/CameraImage.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
{ |
|||
"dependencies": { |
|||
"com.unity.xr.arcore": "1.0.0-preview.23", |
|||
"com.unity.xr.arfoundation": "1.0.0-preview.20", |
|||
"com.unity.xr.arkit": "1.0.0-preview.17" |
|||
} |
|||
} |
|||
"dependencies": { |
|||
"com.unity.ads": "2.0.8", |
|||
"com.unity.analytics": "3.0.9", |
|||
"com.unity.collab-proxy": "1.2.11", |
|||
"com.unity.package-manager-ui": "2.0.3", |
|||
"com.unity.purchasing": "2.0.1", |
|||
"com.unity.textmeshpro": "1.3.0", |
|||
"com.unity.xr.arcore": "1.0.0-preview.23", |
|||
"com.unity.xr.arfoundation": "1.0.0-preview.20", |
|||
"com.unity.xr.arkit": "1.0.0-preview.17", |
|||
"com.unity.modules.ai": "1.0.0", |
|||
"com.unity.modules.animation": "1.0.0", |
|||
"com.unity.modules.assetbundle": "1.0.0", |
|||
"com.unity.modules.audio": "1.0.0", |
|||
"com.unity.modules.cloth": "1.0.0", |
|||
"com.unity.modules.director": "1.0.0", |
|||
"com.unity.modules.imageconversion": "1.0.0", |
|||
"com.unity.modules.imgui": "1.0.0", |
|||
"com.unity.modules.jsonserialize": "1.0.0", |
|||
"com.unity.modules.particlesystem": "1.0.0", |
|||
"com.unity.modules.physics": "1.0.0", |
|||
"com.unity.modules.physics2d": "1.0.0", |
|||
"com.unity.modules.screencapture": "1.0.0", |
|||
"com.unity.modules.terrain": "1.0.0", |
|||
"com.unity.modules.terrainphysics": "1.0.0", |
|||
"com.unity.modules.tilemap": "1.0.0", |
|||
"com.unity.modules.ui": "1.0.0", |
|||
"com.unity.modules.uielements": "1.0.0", |
|||
"com.unity.modules.umbra": "1.0.0", |
|||
"com.unity.modules.unityanalytics": "1.0.0", |
|||
"com.unity.modules.unitywebrequest": "1.0.0", |
|||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0", |
|||
"com.unity.modules.unitywebrequestaudio": "1.0.0", |
|||
"com.unity.modules.unitywebrequesttexture": "1.0.0", |
|||
"com.unity.modules.unitywebrequestwww": "1.0.0", |
|||
"com.unity.modules.vehicles": "1.0.0", |
|||
"com.unity.modules.video": "1.0.0", |
|||
"com.unity.modules.vr": "1.0.0", |
|||
"com.unity.modules.wind": "1.0.0", |
|||
"com.unity.modules.xr": "1.0.0" |
|||
} |
|||
} |
|
|||
m_EditorVersion: 2018.1.1f1 |
|||
m_EditorVersion: 2018.3.0b9 |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
using UnityEngine.XR.ARExtensions; |
|||
using UnityEngine.XR.ARFoundation; |
|||
|
|||
[RequireComponent(typeof(Dropdown))] |
|||
public class CameraConfigController : MonoBehaviour |
|||
{ |
|||
List<string> m_ConfigurationNames; |
|||
|
|||
Dropdown m_Dropdown; |
|||
|
|||
public void OnValueChanged(Dropdown dropdown) |
|||
{ |
|||
var cameraSubsystem = ARSubsystemManager.cameraSubsystem; |
|||
if (cameraSubsystem == null) |
|||
return; |
|||
|
|||
var configurationIndex = dropdown.value; |
|||
|
|||
// Check that the value makes sense
|
|||
if (configurationIndex >= cameraSubsystem.GetConfigurationCount()) |
|||
return; |
|||
|
|||
// Get that configuration by index
|
|||
var configuration = cameraSubsystem.GetConfiguration(configurationIndex); |
|||
|
|||
// Make it the active one
|
|||
cameraSubsystem.SetConfiguration(configuration); |
|||
} |
|||
|
|||
void Awake() |
|||
{ |
|||
m_Dropdown = GetComponent<Dropdown>(); |
|||
m_ConfigurationNames = new List<string>(); |
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
m_Dropdown.ClearOptions(); |
|||
|
|||
var cameraSubsystem = ARSubsystemManager.cameraSubsystem; |
|||
if (cameraSubsystem == null) |
|||
return; |
|||
|
|||
// Typically, you would only need to do this once.
|
|||
m_ConfigurationNames.Clear(); |
|||
foreach (var config in cameraSubsystem.Configurations()) |
|||
m_ConfigurationNames.Add(config.ToString()); |
|||
|
|||
m_Dropdown.AddOptions(m_ConfigurationNames); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 94b653a1faa6f4749ad83e77bcddfab4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue