浏览代码

4.2.0-pre.8

/4.2
Tim Mowrer 3 年前
当前提交
f4f5ea02
共有 4 个文件被更改,包括 305 次插入51 次删除
  1. 299
      Assets/Scenes/CpuImages.unity
  2. 2
      Assets/Scenes/Depth/DepthImages.unity
  3. 47
      Assets/Scripts/CpuImageSample.cs
  4. 8
      Packages/manifest.json

299
Assets/Scenes/CpuImages.unity


m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &485666365
Canvas:
m_ObjectHideFlags: 0

- {fileID: 613839499}
- {fileID: 371491551}
- {fileID: 901906344}
- {fileID: 1268340790}
- {fileID: 642201223}
- {fileID: 1756864493}
m_Father: {fileID: 0}

- {fileID: 1791068495}
- {fileID: 773643825}
m_Father: {fileID: 485666366}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}

m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}

m_Modifications:
- target: {fileID: 2304810881573073946, guid: 4ee22c1f54b174122b6a766fe09e0de8,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
propertyPath: m_Pivot.x
value: 0.5
propertyPath: m_LocalPosition.y
value: 0
propertyPath: m_Pivot.y
value: 0.5
propertyPath: m_LocalPosition.z
value: 0
propertyPath: m_RootOrder
value: 8
propertyPath: m_LocalRotation.x
value: -0
propertyPath: m_AnchorMax.x
value: 1
propertyPath: m_LocalRotation.y
value: -0
propertyPath: m_AnchorMax.y
value: 1
propertyPath: m_LocalRotation.z
value: -0
propertyPath: m_AnchorMin.x
value: 1
propertyPath: m_LocalRotation.w
propertyPath: m_AnchorMin.y
propertyPath: m_RootOrder
value: 7
propertyPath: m_SizeDelta.x
value: 100
propertyPath: m_LocalEulerAnglesHint.x
value: 0
propertyPath: m_SizeDelta.y
value: 100
propertyPath: m_LocalEulerAnglesHint.y
propertyPath: m_LocalPosition.x
propertyPath: m_LocalEulerAnglesHint.z
propertyPath: m_LocalPosition.y
propertyPath: m_AnchoredPosition.x
propertyPath: m_LocalPosition.z
propertyPath: m_AnchoredPosition.y
value: 0
propertyPath: m_LocalRotation.w
value: 1
propertyPath: m_SizeDelta.x
value: 100
propertyPath: m_LocalRotation.x
value: -0
propertyPath: m_SizeDelta.y
value: 100
propertyPath: m_LocalRotation.y
value: -0
propertyPath: m_AnchorMin.x
value: 1
propertyPath: m_LocalRotation.z
value: -0
propertyPath: m_AnchorMin.y
value: 1
propertyPath: m_AnchoredPosition.x
value: 0
propertyPath: m_AnchorMax.x
value: 1
propertyPath: m_AnchoredPosition.y
value: 0
propertyPath: m_AnchorMax.y
value: 1
propertyPath: m_LocalEulerAnglesHint.x
value: 0
propertyPath: m_Pivot.x
value: 0.5
propertyPath: m_LocalEulerAnglesHint.y
value: 0
propertyPath: m_Pivot.y
value: 0.5
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3225625820226493293, guid: 4ee22c1f54b174122b6a766fe09e0de8,
type: 3}

m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1015722067

m_RawEnvironmentDepthImage: {fileID: 613839500}
m_RawEnvironmentDepthConfidenceImage: {fileID: 371491552}
m_ImageInfo: {fileID: 901906345}
m_TransformationButton: {fileID: 1268340791}
--- !u!4 &1141330383
Transform:
m_ObjectHideFlags: 0

m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1261476238}
m_CullTransparentMesh: 0
--- !u!1 &1268340789
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1268340790}
- component: {fileID: 1268340793}
- component: {fileID: 1268340792}
- component: {fileID: 1268340791}
m_Layer: 5
m_Name: TransformationButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1268340790
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1268340789}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1303645217}
m_Father: {fileID: 485666366}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 500, y: 120}
m_Pivot: {x: 1, y: 0}
--- !u!114 &1268340791
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1268340789}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1268340792}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1141330382}
m_TargetAssemblyTypeName: UnityEngine.XR.ARFoundation.Samples.CpuImageSample,
Assembly-CSharp
m_MethodName: CycleTransformation
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1268340792
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1268340789}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1268340793
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1268340789}
m_CullTransparentMesh: 1
--- !u!1 &1303645216
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1303645217}
- component: {fileID: 1303645219}
- component: {fileID: 1303645218}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1303645217
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1303645216}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1268340790}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1303645218
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1303645216}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 40
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 4
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: MirrorY
--- !u!222 &1303645219
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1303645216}
m_CullTransparentMesh: 1
--- !u!1 &1323077986
GameObject:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}

m_HumanSegmentationStencilMode: 1
m_HumanSegmentationDepthMode: 1
m_EnvironmentDepthMode: 1
m_EnvironmentDepthTemporalSmoothing: 1
m_OcclusionPreferenceMode: 0
--- !u!1 &1449726330
GameObject:

m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}

2
Assets/Scenes/Depth/DepthImages.unity


m_HumanSegmentationStencilMode: 1
m_HumanSegmentationDepthMode: 1
m_EnvironmentDepthMode: 1
m_EnvironmentDepthTemporalSmoothing: 0
m_EnvironmentDepthTemporalSmoothing: 1
m_OcclusionPreferenceMode: 0
--- !u!1 &1449726330
GameObject:

47
Assets/Scripts/CpuImageSample.cs


set => m_ImageInfo = value;
}
[SerializeField]
Button m_TransformationButton;
/// <summary>
/// The button that controls transformation selection.
/// </summary>
public Button transformationButton
{
get => m_TransformationButton;
set => m_TransformationButton = value;
}
XRCpuImage.Transformation m_Transformation = XRCpuImage.Transformation.MirrorY;
/// <summary>
/// Cycles the image transformation to the next case.
/// </summary>
public void CycleTransformation()
{
m_Transformation = m_Transformation switch
{
XRCpuImage.Transformation.None => XRCpuImage.Transformation.MirrorX,
XRCpuImage.Transformation.MirrorX => XRCpuImage.Transformation.MirrorY,
XRCpuImage.Transformation.MirrorY => XRCpuImage.Transformation.MirrorX | XRCpuImage.Transformation.MirrorY,
_ => XRCpuImage.Transformation.None
};
if (m_TransformationButton)
{
m_TransformationButton.GetComponentInChildren<Text>().text = m_Transformation.ToString();
}
}
void OnEnable()
{
if (m_CameraManager != null)

// Convert the image to format, flipping the image across the Y axis.
// We can also get a sub rectangle, but we'll get the full image here.
var conversionParams = new XRCpuImage.ConversionParams(image, format, XRCpuImage.Transformation.MirrorY);
var conversionParams = new XRCpuImage.ConversionParams(image, format, m_Transformation);
// Texture2D allows us write directly to the raw texture data
// This allows us to do the conversion in-place without making any copies.

{
using (image)
{
UpdateRawImage(m_RawHumanDepthImage, image);
UpdateRawImage(m_RawHumanDepthImage, image, m_Transformation);
}
}
else

{
using (image)
{
UpdateRawImage(m_RawHumanStencilImage, image);
UpdateRawImage(m_RawHumanStencilImage, image, m_Transformation);
}
}
else

{
using (image)
{
UpdateRawImage(m_RawEnvironmentDepthImage, image);
UpdateRawImage(m_RawEnvironmentDepthImage, image, m_Transformation);
}
}
else

{
using (image)
{
UpdateRawImage(m_RawEnvironmentDepthConfidenceImage, image);
UpdateRawImage(m_RawEnvironmentDepthConfidenceImage, image, m_Transformation);
}
}
else

}
static void UpdateRawImage(RawImage rawImage, XRCpuImage cpuImage)
static void UpdateRawImage(RawImage rawImage, XRCpuImage cpuImage, XRCpuImage.Transformation transformation)
{
// Get the texture associated with the UI.RawImage that we wish to display on screen.
var texture = rawImage.texture as Texture2D;

}
// For display, we need to mirror about the vertical access.
var conversionParams = new XRCpuImage.ConversionParams(cpuImage, cpuImage.format.AsTextureFormat(), XRCpuImage.Transformation.MirrorY);
var conversionParams = new XRCpuImage.ConversionParams(cpuImage, cpuImage.format.AsTextureFormat(), transformation);
// Get the Texture2D's underlying pixel buffer.
var rawTextureData = texture.GetRawTextureData<byte>();

8
Packages/manifest.json


"com.unity.ide.vscode": "1.2.3",
"com.unity.inputsystem": "1.0.2",
"com.unity.ugui": "1.0.0",
"com.unity.xr.arcore": "4.2.0-pre.7",
"com.unity.xr.arfoundation": "4.2.0-pre.7",
"com.unity.xr.arkit": "4.2.0-pre.7",
"com.unity.xr.arkit-face-tracking": "4.2.0-pre.7",
"com.unity.xr.arcore": "4.2.0-pre.8",
"com.unity.xr.arfoundation": "4.2.0-pre.8",
"com.unity.xr.arkit": "4.2.0-pre.8",
"com.unity.xr.arkit-face-tracking": "4.2.0-pre.8",
"com.unity.xr.interaction.toolkit": "1.0.0-pre.3",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",

正在加载...
取消
保存