Init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcf376cf596c0544e9458455d36a8046
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,419 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &5801233412899400197
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5801233412899400196}
|
||||
- component: {fileID: 5801233412899400201}
|
||||
- component: {fileID: 5801233412899400202}
|
||||
- component: {fileID: 5801233412899400203}
|
||||
m_Layer: 0
|
||||
m_Name: Z
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5801233412899400196
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233412899400197}
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 1}
|
||||
m_LocalScale: {x: 0.1, y: 1, z: 0.10000001}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5801233414872731675}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &5801233412899400201
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233412899400197}
|
||||
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &5801233412899400202
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233412899400197}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: faf9d48f6205bfa45a98ff473c3f7efa, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!136 &5801233412899400203
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233412899400197}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5801233413528250447
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5801233413528250446}
|
||||
- component: {fileID: 5801233413528250451}
|
||||
- component: {fileID: 5801233413528250444}
|
||||
- component: {fileID: 5801233413528250445}
|
||||
m_Layer: 0
|
||||
m_Name: Y
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5801233413528250446
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413528250447}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: 0}
|
||||
m_LocalScale: {x: 0.1, y: 1, z: 0.1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5801233414872731675}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5801233413528250451
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413528250447}
|
||||
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &5801233413528250444
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413528250447}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 78c12598dec6eeb4cba86a42b82bd8a9, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!136 &5801233413528250445
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413528250447}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5801233413549260807
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5801233413549260806}
|
||||
- component: {fileID: 5801233413549260811}
|
||||
- component: {fileID: 5801233413549260804}
|
||||
- component: {fileID: 5801233413549260805}
|
||||
m_Layer: 0
|
||||
m_Name: X
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5801233413549260806
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413549260807}
|
||||
m_LocalRotation: {x: -0, y: -0, z: 0.7071068, w: 0.7071068}
|
||||
m_LocalPosition: {x: 1, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.10000001, y: 1, z: 0.1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5801233414872731675}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
|
||||
--- !u!33 &5801233413549260811
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413549260807}
|
||||
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &5801233413549260804
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413549260807}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 1d3262428c068ee45b76f6d3de12a55f, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!136 &5801233413549260805
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413549260807}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5801233413884351097
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5801233413884351096}
|
||||
- component: {fileID: 5801233413884351101}
|
||||
- component: {fileID: 5801233413884351102}
|
||||
- component: {fileID: 5801233413884351103}
|
||||
m_Layer: 0
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5801233413884351096
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413884351097}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5801233414872731675}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5801233413884351101
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413884351097}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &5801233413884351102
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413884351097}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 1d3262428c068ee45b76f6d3de12a55f, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &5801233413884351103
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233413884351097}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5801233414872731668
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5801233414872731675}
|
||||
m_Layer: 0
|
||||
m_Name: AnchorObject
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5801233414872731675
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5801233414872731668}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -7.3, y: 1.2, z: 2.65}
|
||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||
m_Children:
|
||||
- {fileID: 5801233413884351096}
|
||||
- {fileID: 5801233413549260806}
|
||||
- {fileID: 5801233413528250446}
|
||||
- {fileID: 5801233412899400196}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04a9c969c46f56240a28811e3207db51
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ffe22b91e472494ba5839b89e0076fe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 491cc602739859c45a1c57ecacee1c75
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc18359004abe7c4e87aae3065f3c2d4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 685f95f93c2d03c46afbc63a27fdb64c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 112000000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,130 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8529bcf1fa2b8f740af2243539e6288d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 1
|
||||
seamlessCubemap: 1
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: 0
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 2
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 100
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,242 @@
|
||||
#if PICO_OPENXR_SDK
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Unity.XR.OpenXR.Features.PICOSupport;
|
||||
using Unity.XR.PICO.TOBSupport;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
using Unity.XR.CompositionLayers;
|
||||
using Unity.XR.OpenXR.Features.PICOSupport;
|
||||
using UnityEngine.XR.OpenXR.CompositionLayers;
|
||||
#endif
|
||||
public class EnterpriseAPI_OpenXR : MonoBehaviour
|
||||
{
|
||||
private string tag = "CaptureLib ----";
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
private CompositionLayer _overlay = null;
|
||||
#endif
|
||||
private PXRCaptureRenderMode Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_LEFT;
|
||||
byte[] imgByte ;
|
||||
private int width=2048;
|
||||
private int height=1536;
|
||||
public Material videoMaterial;
|
||||
public Transform FrameTarget;
|
||||
public Transform RenderTarget;
|
||||
public Text CanshuText;
|
||||
public Toggle showtime;
|
||||
public Text showtimeText;
|
||||
private bool isRuning=false;
|
||||
// 将视频帧转换为 Unity 纹理
|
||||
Texture2D texture;
|
||||
public Text fpsText;
|
||||
bool camera_raw_data=true;
|
||||
private void Awake()
|
||||
{
|
||||
Debug.Log($"{tag} Awake ");
|
||||
PassthroughFeature.EnableVideoSeeThrough=true;
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
_overlay = GetComponent<CompositionLayer>();
|
||||
if (_overlay == null)
|
||||
{
|
||||
_overlay = gameObject.AddComponent<CompositionLayer>();
|
||||
}
|
||||
#endif
|
||||
imgByte = new byte[width*height*4];
|
||||
texture = new Texture2D((int)width, (int)height, TextureFormat.RGBA32, false);
|
||||
videoMaterial.SetTexture("_MainTex", texture);
|
||||
|
||||
|
||||
Dictionary<string, string> cameraParams1 = new Dictionary<string, string>();
|
||||
cameraParams1.Add(PXRCapture.KEY_ENABLE_MVHEVC, PXRCapture.VALUE_FALSE);
|
||||
cameraParams1.Add(PXRCapture.KEY_VIDEO_FPS, "30");
|
||||
cameraParams1.Add(PXRCapture.KEY_OUTPUT_CAMERA_RAW_DATA, camera_raw_data?PXRCapture.VALUE_TRUE:PXRCapture.VALUE_FALSE);
|
||||
|
||||
PXR_Enterprise.Configurefor4U(cameraParams1);
|
||||
|
||||
Dictionary<string, string> cameraParams = new Dictionary<string, string>();
|
||||
cameraParams.Add(PXRCapture.KEY_MCTF, PXRCapture.VALUE_TRUE);
|
||||
cameraParams.Add(PXRCapture.KEY_EIS, PXRCapture.VALUE_FALSE);
|
||||
cameraParams.Add(PXRCapture.KEY_MFNR, PXRCapture.VALUE_TRUE);
|
||||
|
||||
PXR_Enterprise.OpenCameraAsyncfor4U(ret =>
|
||||
{
|
||||
Debug.Log($"{tag} OpenCameraAsync ret= {ret}");
|
||||
},cameraParams);
|
||||
|
||||
Invoke(nameof(getCameraParameters), 1f);
|
||||
|
||||
}
|
||||
public void SetTrackingMode(int listChoice)
|
||||
{
|
||||
Debug.Log($"{tag} SetMode ret= {listChoice}");
|
||||
// if (listChoice > 0)
|
||||
{
|
||||
switch (listChoice)
|
||||
{
|
||||
case 0:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_LEFT;
|
||||
break;
|
||||
case 1:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_RIGHT;
|
||||
break;
|
||||
case 2:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_3D;
|
||||
break;
|
||||
case 3:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_Interlace;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
float outputFovHorizontal=76.35f;
|
||||
float outputFovVertical=61.05f;
|
||||
public void getCameraParameters()
|
||||
{
|
||||
Debug.Log($"{tag} getCamera ");
|
||||
double[] CameraIntrinsics=PXR_Enterprise.GetCameraIntrinsicsfor4U(width, height, outputFovHorizontal, outputFovVertical);
|
||||
PXR_Enterprise.GetCameraExtrinsicsfor4U(out Matrix4x4 leftExtrinsics, out Matrix4x4 rightExtrinsics);
|
||||
Debug.Log($"getCamera-- GetCameraIntrinsics:[{CameraIntrinsics[0]},{CameraIntrinsics[1]},{CameraIntrinsics[2]},{CameraIntrinsics[3]}]");
|
||||
Debug.Log(tag+"getCamera-- GetCameraExtrinsics leftExtrinsics :\n"+leftExtrinsics);
|
||||
Debug.Log(tag+"getCamera-- GetCameraExtrinsics rightExtrinsics :\n"+rightExtrinsics);
|
||||
|
||||
RGBCameraParamsNew param = PXR_Enterprise.GetCameraParametersNewfor4U(width, height);
|
||||
// Debug.Log($"getCamera GetCameraIntrinsics:[{param.cx},{param.cy},{param.fx},{param.fy}]");
|
||||
// Debug.Log($"getCamera GetCameraExtrinsics leftExtrinsics::[{param.l_pos} ------ {param.l_rot}]");
|
||||
// Debug.Log($"getCamera GetCameraExtrinsics rightExtrinsics::[{param.r_pos} ------ {param.r_rot}]");
|
||||
CanshuText.text =$"内参::[fx,fy,cx,cy]=[{param.fx},{param.fy},{param.cx},{param.cy}]\n"+ $"外参::L=[{param.l_pos},{param.l_rot}]\n"+$" R=[{param.r_pos},{param.r_rot}]";
|
||||
}
|
||||
public void StartPreview()
|
||||
{
|
||||
Debug.Log($"{tag} StartPreview ");
|
||||
FrameTarget.position = new Vector3(0,0,0);
|
||||
FrameTarget.rotation = Quaternion.Euler(0,0,0);
|
||||
RenderTarget.position = new Vector3(0,0,0);
|
||||
RenderTarget.rotation = Quaternion.Euler(0,0,0);
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
_overlay.enabled = true;
|
||||
StartCoroutine(_StartPreview());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
private IEnumerator _StartPreview()
|
||||
{
|
||||
IntPtr surface = IntPtr.Zero;
|
||||
yield return new WaitUntil(() =>
|
||||
{
|
||||
surface = OpenXRLayerUtility.GetLayerAndroidSurfaceObject(_overlay.GetInstanceID());
|
||||
PXR_Enterprise.StartPreviewfor4U(surface,Mode);
|
||||
return (surface != IntPtr.Zero);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
public float showTime = 1f;
|
||||
|
||||
private int count = 0;
|
||||
private float deltaTime = 0f;
|
||||
public void StartGetImageData()
|
||||
{
|
||||
Debug.Log($"{tag} StartGetImageData ");
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
_overlay.enabled = false;
|
||||
#endif
|
||||
IntPtr data=Marshal.UnsafeAddrOfPinnedArrayElement(imgByte,0);
|
||||
PXR_Enterprise.SetCameraFrameBufferfor4U(width,height,ref data, (Frame frame) =>
|
||||
{
|
||||
// Debug.Log($"{tag} sensorState position:[{frame.sensorState.globalPose.position.x},{frame.sensorState.globalPose.position.y},{frame.sensorState.globalPose.position.z}]," +
|
||||
// $" orientation:[{frame.sensorState.globalPose.orientation.x},{frame.sensorState.globalPose.orientation.y},{frame.sensorState.globalPose.orientation.z},{frame.sensorState.globalPose.orientation.w}] ");
|
||||
// FrameTarget.position=frame.pose.position;
|
||||
// FrameTarget.rotation = frame.pose.rotation;
|
||||
// FrameTarget.position = new Vector3(frame.pose.position.x, frame.pose.position.y, -frame.pose.position.z);
|
||||
// FrameTarget.rotation = new Quaternion(frame.pose.rotation.x, frame.pose.rotation.y, -frame.pose.rotation.z, -frame.pose.rotation.w);
|
||||
FrameTarget.position = frame.pose.position;
|
||||
FrameTarget.rotation = frame.pose.rotation;
|
||||
if (showtime.isOn)
|
||||
{
|
||||
showtimeText.text = frame.timestamp+"";
|
||||
}
|
||||
else
|
||||
{
|
||||
showtimeText.text = frame.timestamp+"";
|
||||
texture.LoadRawTextureData(imgByte);
|
||||
texture.Apply();
|
||||
}
|
||||
|
||||
Debug.Log($"{tag} imageAvailable ");
|
||||
Debug.Log($"{tag} onImageAvailable cameraFramePredictedDisplayTime = "+frame.timestamp +" Time.deltaTime:"+Time.deltaTime);
|
||||
Debug.Log($"{tag} onImageAvailable size = "+frame.datasize);
|
||||
count++;
|
||||
});
|
||||
Debug.Log($"{tag} StartGetImageData Mode= {Mode}");
|
||||
bool ret=PXR_Enterprise.StartGetImageDatafor4U(Mode, width, height);
|
||||
isRuning=true;
|
||||
Debug.Log($"{tag} StartGetImageData ret= {ret}");
|
||||
}
|
||||
|
||||
|
||||
public void Release()
|
||||
{
|
||||
PXR_Enterprise.CloseCamerafor4U();
|
||||
isRuning=false;
|
||||
}
|
||||
|
||||
private double time = 0;
|
||||
private SensorState a;
|
||||
private void Update()
|
||||
{
|
||||
deltaTime += Time.deltaTime;
|
||||
if (deltaTime >= showTime) {
|
||||
if (count>0)
|
||||
{
|
||||
float fps = count / deltaTime;
|
||||
float milliSecond = deltaTime * 1000 / count;
|
||||
string strFpsInfo = string.Format("当前每帧渲染间隔:{0:0.0} ms ({1:0.} 帧每秒)", milliSecond, fps);
|
||||
fpsText.text = strFpsInfo;
|
||||
}
|
||||
count = 0;
|
||||
deltaTime = 0f;
|
||||
}
|
||||
if (reopen)
|
||||
{
|
||||
reopen = false;
|
||||
PXR_Enterprise.StartGetImageDatafor4U(Mode, width, height);
|
||||
isRuning=true;
|
||||
}
|
||||
|
||||
|
||||
time= PXR_Enterprise.GetPredictedDisplayTime();
|
||||
a=PXR_Enterprise.GetPredictedMainSensorState(time);
|
||||
RenderTarget.position = a.pose.position;
|
||||
RenderTarget.rotation = a.pose.rotation;
|
||||
// RenderTarget.position = new Vector3(a.pose.position.x, a.pose.position.y, -a.pose.position.z);
|
||||
// RenderTarget.rotation = new Quaternion(a.pose.rotation.x, a.pose.rotation.y, -a.pose.rotation.z, -a.pose.rotation.w);
|
||||
}
|
||||
static bool reopen = false;
|
||||
private void OnApplicationPause(bool pauseStatus)
|
||||
{
|
||||
if (isRuning)
|
||||
{
|
||||
// PXR_Enterprise.SetRunningState(pauseStatus);
|
||||
if (pauseStatus)
|
||||
{
|
||||
PXR_Enterprise.CloseCamerafor4U();
|
||||
}
|
||||
else
|
||||
{
|
||||
PXR_Enterprise.OpenCameraAsyncfor4U(ret =>
|
||||
{
|
||||
Debug.Log($"{tag} OpenCameraAsync reopen= {ret}");
|
||||
reopen = ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed1e10c5fb5ae544595d9c223445b3c9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17d857d92a3b44e4dbdee33b07ebf948
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bc19543f1bf9114b8e974ae6ba05f7b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,240 @@
|
||||
#if !PICO_OPENXR_SDK
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using AOT;
|
||||
using Unity.XR.PICO.TOBSupport;
|
||||
using Unity.XR.PXR;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EnterpriseAPI : MonoBehaviour
|
||||
{
|
||||
private string tag = "CaptureLib ----";
|
||||
private PXR_CompositionLayer overlay = null;
|
||||
private PXRCaptureRenderMode Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_LEFT;
|
||||
byte[] imgByte ;
|
||||
private int width=2048;
|
||||
private int height=1536;
|
||||
public Material videoMaterial;
|
||||
public Transform FrameTarget;
|
||||
public Transform RenderTarget;
|
||||
public Text CanshuText;
|
||||
private bool isRuning=false;
|
||||
private bool d=false;
|
||||
// 将视频帧转换为 Unity 纹理
|
||||
Texture2D texture;
|
||||
public Text fpsText;
|
||||
public Toggle showtime;
|
||||
public Text showtimeText;
|
||||
bool camera_raw_data=false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
PXR_Manager.EnableVideoSeeThrough = true;
|
||||
PXR_Enterprise.UseGlobalPose(true);
|
||||
Debug.Log($"{tag} Awake ");
|
||||
PXR_Plugin.System.UPxr_GetConfigFloat(ConfigType.ToDelaSensorY);
|
||||
overlay = GetComponent<PXR_CompositionLayer>();
|
||||
if (overlay == null)
|
||||
{
|
||||
Debug.LogError("PXRLog Overlay is null!");
|
||||
overlay = gameObject.AddComponent<PXR_CompositionLayer>();
|
||||
}
|
||||
|
||||
imgByte = new byte[width*height*4];
|
||||
texture = new Texture2D((int)width, (int)height, TextureFormat.RGBA32, false);
|
||||
videoMaterial.SetTexture("_MainTex", texture);
|
||||
PXR_Enterprise.InitEnterpriseService();
|
||||
PXR_Enterprise.BindEnterpriseService(b =>
|
||||
{
|
||||
Debug.Log($"{tag} Bind enterprise service success={b}");
|
||||
} );
|
||||
}
|
||||
public void OpenCamera()
|
||||
{
|
||||
Dictionary<string, string> cameraParams1 = new Dictionary<string, string>();
|
||||
cameraParams1.Add(PXRCapture.KEY_OUTPUT_CAMERA_RAW_DATA, camera_raw_data?PXRCapture.VALUE_TRUE:PXRCapture.VALUE_FALSE);
|
||||
PXR_Enterprise.Configurefor4U(cameraParams1);
|
||||
|
||||
Dictionary<string, string> cameraParams = new Dictionary<string, string>();
|
||||
cameraParams.Add(PXRCapture.KEY_MCTF, PXRCapture.VALUE_TRUE);
|
||||
cameraParams.Add(PXRCapture.KEY_EIS, PXRCapture.VALUE_FALSE);
|
||||
cameraParams.Add(PXRCapture.KEY_MFNR, PXRCapture.VALUE_TRUE);
|
||||
|
||||
PXR_Enterprise.OpenCameraAsyncfor4U(ret =>
|
||||
{
|
||||
Debug.Log($"{tag} OpenCameraAsync ret= {ret}");
|
||||
},cameraParams);
|
||||
|
||||
Invoke(nameof(getCameraParameters), 1f);
|
||||
}
|
||||
|
||||
public void SetRawData(int listChoice)
|
||||
{
|
||||
Debug.Log($"{tag} SetMode ret= {listChoice}");
|
||||
camera_raw_data=listChoice==1;
|
||||
}
|
||||
public void SetMode(int listChoice)
|
||||
{
|
||||
Debug.Log($"{tag} SetMode ret= {listChoice}");
|
||||
// if (listChoice > 0)
|
||||
{
|
||||
switch (listChoice)
|
||||
{
|
||||
case 0:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_LEFT;
|
||||
break;
|
||||
case 1:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_RIGHT;
|
||||
break;
|
||||
case 2:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_3D;
|
||||
break;
|
||||
case 3:
|
||||
Mode = PXRCaptureRenderMode.PXRCapture_RenderMode_Interlace;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
float outputFovHorizontal=76.35f;
|
||||
float outputFovVertical=61.05f;
|
||||
public void getCameraParameters()
|
||||
{
|
||||
Debug.Log($"{tag} getCamera ");
|
||||
double[] CameraIntrinsics=PXR_Enterprise.GetCameraIntrinsicsfor4U(width, height, outputFovHorizontal, outputFovVertical);
|
||||
PXR_Enterprise.GetCameraExtrinsicsfor4U(out Matrix4x4 leftExtrinsics, out Matrix4x4 rightExtrinsics);
|
||||
if (CameraIntrinsics!=null)
|
||||
{
|
||||
Debug.Log($"getCamera-- GetCameraIntrinsics:[{CameraIntrinsics[0]},{CameraIntrinsics[1]},{CameraIntrinsics[2]},{CameraIntrinsics[3]}]");
|
||||
}
|
||||
if (leftExtrinsics!=null)
|
||||
{
|
||||
Debug.Log(tag+"getCamera-- GetCameraExtrinsics leftExtrinsics :\n"+leftExtrinsics);
|
||||
}
|
||||
if (rightExtrinsics!=null)
|
||||
{
|
||||
Debug.Log(tag+"getCamera-- GetCameraExtrinsics rightExtrinsics :\n"+rightExtrinsics);
|
||||
}
|
||||
|
||||
RGBCameraParamsNew param = PXR_Enterprise.GetCameraParametersNewfor4U(width, height);
|
||||
// Debug.Log($"getCamera GetCameraIntrinsics:[{param.cx},{param.cy},{param.fx},{param.fy}]");
|
||||
// Debug.Log($"getCamera GetCameraExtrinsics leftExtrinsics::[{param.l_pos} ------ {param.l_rot}]");
|
||||
// Debug.Log($"getCamera GetCameraExtrinsics rightExtrinsics::[{param.r_pos} ------ {param.r_rot}]");
|
||||
CanshuText.text =$"内参::[fx,fy,cx,cy]=[{param.fx},{param.fy},{param.cx},{param.cy}]\n"+ $"外参::L=[{param.l_pos},{param.l_rot}]\n"+$" R=[{param.r_pos},{param.r_rot}]";
|
||||
}
|
||||
public void StartPreview()
|
||||
{
|
||||
Debug.Log($"{tag} StartPreview ");
|
||||
overlay.enabled = true;
|
||||
Debug.Log($"{tag} externalAndroidSurfaceObject "+overlay.externalAndroidSurfaceObject);
|
||||
PXR_Enterprise.StartPreviewfor4U(overlay.externalAndroidSurfaceObject,Mode);
|
||||
FrameTarget.position = new Vector3(0,0,0);
|
||||
FrameTarget.rotation = Quaternion.Euler(0,0,0);
|
||||
RenderTarget.position = new Vector3(0,0,0);
|
||||
RenderTarget.rotation = Quaternion.Euler(0,0,0);
|
||||
}
|
||||
public float showTime = 1f;
|
||||
|
||||
private int count = 0;
|
||||
private float deltaTime = 0f;
|
||||
public void StartGetImageData()
|
||||
{
|
||||
Debug.Log($"{tag} StartGetImageData ");
|
||||
overlay.enabled = false;
|
||||
|
||||
IntPtr data=Marshal.UnsafeAddrOfPinnedArrayElement(imgByte,0);
|
||||
PXR_Enterprise.SetCameraFrameBufferfor4U(width,height,ref data, (Frame frame) =>
|
||||
{
|
||||
// Debug.Log($"{tag} sensorState position:[{frame.sensorState.globalPose.position.x},{frame.sensorState.globalPose.position.y},{frame.sensorState.globalPose.position.z}]," +
|
||||
// $" orientation:[{frame.sensorState.globalPose.orientation.x},{frame.sensorState.globalPose.orientation.y},{frame.sensorState.globalPose.orientation.z},{frame.sensorState.globalPose.orientation.w}] ");
|
||||
// FrameTarget.position=frame.pose.position;
|
||||
// FrameTarget.rotation = frame.pose.rotation;
|
||||
// FrameTarget.position = new Vector3(frame.pose.position.x, frame.pose.position.y, -frame.pose.position.z);
|
||||
// FrameTarget.rotation = new Quaternion(frame.pose.rotation.x, frame.pose.rotation.y, -frame.pose.rotation.z, -frame.pose.rotation.w);
|
||||
FrameTarget.position = frame.pose.position;
|
||||
FrameTarget.rotation = frame.pose.rotation;
|
||||
if (showtime.isOn)
|
||||
{
|
||||
showtimeText.text = frame.timestamp+"";
|
||||
}
|
||||
else
|
||||
{
|
||||
showtimeText.text = frame.timestamp+"";
|
||||
texture.LoadRawTextureData(imgByte);
|
||||
texture.Apply();
|
||||
}
|
||||
Debug.Log($"{tag} imageAvailable ");
|
||||
Debug.Log("onImageAvailable cameraFramePredictedDisplayTime = "+frame.timestamp +" Time.deltaTime:"+Time.deltaTime);
|
||||
Debug.Log("onImageAvailable size = "+frame.datasize);
|
||||
|
||||
|
||||
count++;
|
||||
|
||||
});
|
||||
Debug.Log($"{tag} OpenCameraAsync Mode= {Mode}");
|
||||
bool ret=PXR_Enterprise.StartGetImageDatafor4U(Mode, width, height);
|
||||
isRuning=true;
|
||||
Debug.Log($"{tag} OpenCameraAsync ret= {ret}");
|
||||
}
|
||||
|
||||
|
||||
public void Release()
|
||||
{
|
||||
PXR_Enterprise.CloseCamerafor4U();
|
||||
}
|
||||
|
||||
private double time = 0;
|
||||
private SensorState a;
|
||||
private void Update()
|
||||
{
|
||||
deltaTime += Time.deltaTime;
|
||||
if (deltaTime >= showTime) {
|
||||
if (count>0)
|
||||
{
|
||||
float fps = count / deltaTime;
|
||||
float milliSecond = deltaTime * 1000 / count;
|
||||
string strFpsInfo = string.Format("当前每帧渲染间隔:{0:0.0} ms ({1:0.} 帧每秒)", milliSecond, fps);
|
||||
fpsText.text = strFpsInfo;
|
||||
}
|
||||
count = 0;
|
||||
deltaTime = 0f;
|
||||
}
|
||||
if (reopen)
|
||||
{
|
||||
reopen = false;
|
||||
PXR_Enterprise.StartGetImageDatafor4U(Mode, width, height);
|
||||
}
|
||||
time= PXR_Enterprise.GetPredictedDisplayTime();
|
||||
a=PXR_Enterprise.GetPredictedMainSensorState(time);
|
||||
RenderTarget.position = a.pose.position;
|
||||
RenderTarget.rotation = a.pose.rotation;
|
||||
// RenderTarget.position = new Vector3(a.pose.position.x, a.pose.position.y, -a.pose.position.z);
|
||||
// RenderTarget.rotation = new Quaternion(a.pose.rotation.x, a.pose.rotation.y, -a.pose.rotation.z, -a.pose.rotation.w);
|
||||
}
|
||||
static bool reopen = false;
|
||||
private void OnApplicationPause(bool pauseStatus)
|
||||
{
|
||||
if (isRuning)
|
||||
{
|
||||
// PXR_Enterprise.SetRunningState(pauseStatus);
|
||||
if (pauseStatus)
|
||||
{
|
||||
PXR_Enterprise.CloseCamerafor4U();
|
||||
}
|
||||
else
|
||||
{
|
||||
PXR_Enterprise.OpenCameraAsyncfor4U(ret =>
|
||||
{
|
||||
Debug.Log($"{tag} OpenCameraAsync ret= {ret}");
|
||||
reopen = ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 222355b0708cdae4f87ca7a4a4618d1f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b33a1a488ac657409feee39a1e8715f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ae7139eb33276844be313c61d8bae89
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,131 @@
|
||||
#if PICO_OPENXR_SDK
|
||||
using System;
|
||||
using System.Collections;
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
using Unity.XR.CompositionLayers;
|
||||
using Unity.XR.CompositionLayers.Extensions;
|
||||
using UnityEngine.XR.OpenXR.CompositionLayers;
|
||||
#endif
|
||||
using Unity.XR.PICO.TOBSupport;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
public class VirtualDisplayDemo_OpenXR : MonoBehaviour
|
||||
{
|
||||
private string tag = "VirtualDisplayDemo ----";
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
private CompositionLayer _overlay = null;
|
||||
private TexturesExtension _sourceTextures = null;
|
||||
#endif
|
||||
|
||||
public Text mylog;
|
||||
private bool isBind = false;
|
||||
private int displayId = -1;
|
||||
|
||||
public const int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 16;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 8;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_SECURE = 4;
|
||||
public const int SOURCE_KEYBOARD = 257;
|
||||
public const int ACTION_DOWN = 0;
|
||||
public const int ACTION_UP = 1;
|
||||
public const int ACTION_MOVE = 2;
|
||||
int KEYCODE_BACK = 4;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
|
||||
_overlay = GetComponent<CompositionLayer>();
|
||||
if (_overlay == null)
|
||||
{
|
||||
_overlay = gameObject.AddComponent<CompositionLayer>();
|
||||
}
|
||||
#endif
|
||||
|
||||
PXR_Enterprise.InitEnterpriseService();
|
||||
}
|
||||
|
||||
public void showLog(string log)
|
||||
{
|
||||
Debug.Log(tag + log);
|
||||
mylog.text = log;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
showLog("tobDemo:start");
|
||||
PXR_Enterprise.BindEnterpriseService(b =>
|
||||
{
|
||||
showLog("Bind绑定的返回值测试:" + b);
|
||||
isBind = true;
|
||||
|
||||
PXR_Enterprise.SwitchSystemFunction(
|
||||
(int)SystemFunctionSwitchEnum.SFS_BASIC_SETTING_SHOW_APP_QUIT_CONFIRM_DIALOG, (int)SwitchEnum.S_OFF,
|
||||
b =>
|
||||
{
|
||||
// showLog("SFS_BASIC_SETTING_SHOW_APP_QUIT_CONFIRM_DIALOG:" + b);
|
||||
});
|
||||
|
||||
int flags = VIRTUAL_DISPLAY_FLAG_PUBLIC;
|
||||
flags |= 1 << 6; //DisplayManager.VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH
|
||||
flags |= 1 << 7; //DisplayManager.VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT
|
||||
flags |= 1 << 8; //DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL
|
||||
flags |= VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
StartCoroutine(CreateVirtualDisplay(flags));
|
||||
#endif
|
||||
showLog("CreateVirtualDisplay displayId:" + displayId);
|
||||
});
|
||||
}
|
||||
#if UNITY_XR_COMPOSITIONLAYERS
|
||||
private IEnumerator CreateVirtualDisplay(int flags)
|
||||
{
|
||||
IntPtr surface = IntPtr.Zero;
|
||||
yield return new WaitUntil(() =>
|
||||
{
|
||||
surface = OpenXRLayerUtility.GetLayerAndroidSurfaceObject(_overlay.GetInstanceID());
|
||||
|
||||
displayId = PXR_Enterprise.CreateVirtualDisplay("VirtualDisplayDemo", surface,
|
||||
320, flags,720,1280);
|
||||
return (surface != IntPtr.Zero);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
public void OpenApp()
|
||||
{
|
||||
showLog("StartApp ret:");
|
||||
Intent m = new Intent();
|
||||
m.setComponent("com.pico.myapplication", "com.pico.myapplication.MainActivity");
|
||||
int ret = PXR_Enterprise.StartApp(displayId, m);
|
||||
showLog("StartApp ret:" + ret);
|
||||
}
|
||||
|
||||
public void KillApp()
|
||||
{
|
||||
int[] args1 = {};
|
||||
string[] args2 = {"com.pico.myapplication"};
|
||||
PXR_Enterprise.KillAppsByPidOrPackageName(args1, args2);
|
||||
}
|
||||
|
||||
public void ReleaseVirtualDisplay()
|
||||
{
|
||||
int ret = PXR_Enterprise.ReleaseVirtualDisplay(displayId);
|
||||
showLog("ReleaseVirtualDisplay ret:" + ret);
|
||||
}
|
||||
|
||||
public void InjectEvent(int action, float x, float y)
|
||||
{
|
||||
int ret = PXR_Enterprise.InjectEvent(displayId, action, SOURCE_KEYBOARD, 720*x,1280*y);
|
||||
}
|
||||
|
||||
public void bcak()
|
||||
{
|
||||
int ret = PXR_Enterprise.InjectEvent(displayId, ACTION_DOWN, SOURCE_KEYBOARD, KEYCODE_BACK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f06b7308d86d8ad4b90e32cbc0dcdb2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3435bd49e96ca5040baf62d3d31b65fd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,191 @@
|
||||
#if PICO_OPENXR_SDK
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.XR;
|
||||
|
||||
|
||||
#if XRI_240
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
#endif
|
||||
#if XRI_300
|
||||
using UnityEngine.XR.Interaction.Toolkit.Interactors;
|
||||
#endif
|
||||
|
||||
public class VirtualDisplayEvent_OpenXR : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IDragHandler,
|
||||
IInitializePotentialDragHandler
|
||||
{
|
||||
public string tag = "VirtualDisplayEvent----";
|
||||
#if XRI_240||XRI_300
|
||||
public XRRayInteractor xrLeftRayInteractor;
|
||||
public XRRayInteractor xrRightRayInteractor;
|
||||
private XRRayInteractor currentRayInteractor;
|
||||
#endif
|
||||
|
||||
public VirtualDisplayDemo_OpenXR virtualDisplayController;
|
||||
|
||||
public Text mylog;
|
||||
|
||||
private GameObject mDisplay;
|
||||
private RectTransform mDisplayTran;
|
||||
private int mKeyEvent;
|
||||
private const int KEYEVENT_DEFAULT = -1;
|
||||
private const int KEYEVENT_DOWN = 0;
|
||||
private const int KEYEVENT_UP = 1;
|
||||
bool LeftState = false;
|
||||
private bool mLeftTriggerPressTemp = false;
|
||||
bool RightState = false;
|
||||
private bool mRightTriggerPressTemp = false;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
mDisplay = this.gameObject;
|
||||
mDisplayTran = mDisplay.GetComponent<RectTransform>();
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
#if XRI_240||XRI_300
|
||||
currentRayInteractor = xrRightRayInteractor;
|
||||
#endif
|
||||
|
||||
}
|
||||
public void showLog(string log)
|
||||
{
|
||||
Debug.Log(tag + log);
|
||||
mylog.text = log;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(CommonUsages.isTracked, out LeftState);
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.RightHand)
|
||||
.TryGetFeatureValue(CommonUsages.isTracked, out RightState);
|
||||
if (RightState)
|
||||
{
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.RightHand)
|
||||
.TryGetFeatureValue(CommonUsages.triggerButton, out mRightTriggerPressTemp);
|
||||
if (mRightTriggerPressTemp)
|
||||
{
|
||||
#if XRI_240||XRI_300
|
||||
currentRayInteractor = xrRightRayInteractor;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (LeftState)
|
||||
{
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.LeftHand)
|
||||
.TryGetFeatureValue(CommonUsages.triggerButton, out mLeftTriggerPressTemp);
|
||||
if (mLeftTriggerPressTemp)
|
||||
{
|
||||
#if XRI_240||XRI_300
|
||||
currentRayInteractor = xrLeftRayInteractor;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mKeyEvent != KEYEVENT_DEFAULT)
|
||||
{
|
||||
DispatchMessageToAndroid(mKeyEvent, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
mKeyEvent = KEYEVENT_DOWN;
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
mKeyEvent = KEYEVENT_UP;
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
mKeyEvent = KEYEVENT_DOWN;
|
||||
}
|
||||
|
||||
public void OnInitializePotentialDrag(PointerEventData eventData)
|
||||
{
|
||||
eventData.useDragThreshold = false;
|
||||
}
|
||||
|
||||
private void DispatchMessageToAndroid(int actionType, PointerEventData eventData)
|
||||
{
|
||||
#if XRI_240||XRI_300
|
||||
Vector3 eventPoint = mDisplay.transform.InverseTransformPoint(currentRayInteractor.rayEndPoint);
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
InstrumentationInput(eventPoint, actionType);
|
||||
}
|
||||
else
|
||||
{
|
||||
float x = (eventPoint.x + mDisplayTran.sizeDelta.x / 2) / mDisplayTran.sizeDelta.x;
|
||||
float y = (mDisplayTran.sizeDelta.y / 2 - eventPoint.y) / mDisplayTran.sizeDelta.y;
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
Debug.Log(actionType + "--->" + x + ", " + y + ", " + eventPoint.x + ", " + eventPoint.y);
|
||||
}
|
||||
#else
|
||||
showLog("com.unity.xr.interaction.toolkit Version needs to be greater than 2.3.x");
|
||||
// Debug.LogError("com.unity.xr.interaction.toolkit Version needs to be greater than 2.3.x");
|
||||
#endif
|
||||
}
|
||||
|
||||
private bool mIsUp = true;
|
||||
private float mLastX, mLastY;
|
||||
|
||||
private void InstrumentationInput(Vector3 eventPoint, int actionType)
|
||||
{
|
||||
|
||||
float eventX = eventPoint.x;
|
||||
float eventY = eventPoint.y;
|
||||
float x = (eventX + mDisplayTran.sizeDelta.x / 2) / mDisplayTran.sizeDelta.x;
|
||||
float y = (mDisplayTran.sizeDelta.y / 2 - eventY) / mDisplayTran.sizeDelta.y;
|
||||
|
||||
if (mIsUp && (eventX == 0.0f || eventY == 0.0f || x > 0.99f || x < 0.01f || y > 0.99f || y < 0.01f))
|
||||
{
|
||||
//处理在屏幕外操作的问题
|
||||
showLog("input--->out of the screen---1");
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
return;
|
||||
}
|
||||
|
||||
if (actionType == KEYEVENT_DOWN)
|
||||
{
|
||||
if (mIsUp)
|
||||
{
|
||||
mIsUp = false;
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo_OpenXR.ACTION_DOWN,x,y);
|
||||
showLog("down--->" + x + ", " + y + ", " + eventX + ", " + eventY);
|
||||
}
|
||||
|
||||
if (!mIsUp)
|
||||
{
|
||||
if (eventX == 0.0f || eventY == 0.0f || x > 0.99f || x < 0.01f || y > 0.99f || y < 0.01f)
|
||||
{
|
||||
//处理划出屏幕,还未抬起的问题
|
||||
showLog("input--->out of the screen---2");
|
||||
mIsUp = true;
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo_OpenXR.ACTION_UP,x,y);
|
||||
showLog("up--->" + mLastX + ", " + mLastY + ", " + eventX + ", " + eventY);
|
||||
}
|
||||
else
|
||||
{
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo_OpenXR.ACTION_MOVE,x,y);
|
||||
showLog("move--->" + x + ", " + y + ", " + eventX + ", " + eventY);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (actionType == KEYEVENT_UP)
|
||||
{
|
||||
mIsUp = true;
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo_OpenXR.ACTION_UP,x,y);
|
||||
showLog("up--->" + x + ", " + y + ", " + eventPoint.x + ", " + eventPoint.y);
|
||||
}
|
||||
|
||||
mLastX = x;
|
||||
mLastY = y;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08f33d7dda159e143969c80188c1203f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 885ac79e2188a9546a58dc2a5dd526f8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,102 @@
|
||||
#if !PICO_OPENXR_SDK
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.XR.PICO.TOBSupport;
|
||||
using Unity.XR.PXR;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class VirtualDisplayDemo : MonoBehaviour
|
||||
{
|
||||
private string tag = "VirtualDisplayDemo ----";
|
||||
private PXR_CompositionLayer overlay = null;
|
||||
public Text mylog;
|
||||
private bool isBind = false;
|
||||
private int displayId = -1;
|
||||
|
||||
public const int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 16;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 8;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1;
|
||||
public const int VIRTUAL_DISPLAY_FLAG_SECURE = 4;
|
||||
public const int SOURCE_KEYBOARD = 257;
|
||||
public const int ACTION_DOWN = 0;
|
||||
public const int ACTION_UP = 1;
|
||||
public const int ACTION_MOVE = 2;
|
||||
int KEYCODE_BACK = 4;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
overlay = GetComponent<PXR_CompositionLayer>();
|
||||
if (overlay == null)
|
||||
{
|
||||
Debug.LogError("PXRLog Overlay is null!");
|
||||
overlay = gameObject.AddComponent<PXR_CompositionLayer>();
|
||||
}
|
||||
|
||||
overlay.isExternalAndroidSurface = true;
|
||||
PXR_Enterprise.InitEnterpriseService();
|
||||
}
|
||||
|
||||
public void showLog(string log)
|
||||
{
|
||||
Debug.Log(tag + log);
|
||||
mylog.text = log;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
showLog("tobDemo:start");
|
||||
PXR_Enterprise.BindEnterpriseService(b =>
|
||||
{
|
||||
showLog("Bind绑定的返回值测试:" + b);
|
||||
isBind = true;
|
||||
|
||||
PXR_Enterprise.SwitchSystemFunction(
|
||||
(int)SystemFunctionSwitchEnum.SFS_BASIC_SETTING_SHOW_APP_QUIT_CONFIRM_DIALOG, (int)SwitchEnum.S_OFF,
|
||||
b =>
|
||||
{
|
||||
// showLog("SFS_BASIC_SETTING_SHOW_APP_QUIT_CONFIRM_DIALOG:" + b);
|
||||
});
|
||||
|
||||
int flags = VIRTUAL_DISPLAY_FLAG_PUBLIC;
|
||||
flags |= 1 << 6; //DisplayManager.VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH
|
||||
flags |= 1 << 7; //DisplayManager.VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT
|
||||
flags |= 1 << 8; //DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL
|
||||
flags |= VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
|
||||
|
||||
displayId = PXR_Enterprise.CreateVirtualDisplay("VirtualDisplayDemo", overlay.externalAndroidSurfaceObject,
|
||||
320, flags);
|
||||
showLog("CreateVirtualDisplay displayId:" + displayId);
|
||||
});
|
||||
}
|
||||
|
||||
public void OpenApp()
|
||||
{
|
||||
showLog("StartApp ret:");
|
||||
Intent m = new Intent();
|
||||
m.setComponent("com.pico.myapplication", "com.pico.myapplication.MainActivity");
|
||||
int ret = PXR_Enterprise.StartApp(displayId, m);
|
||||
showLog("StartApp ret:" + ret);
|
||||
}
|
||||
|
||||
|
||||
public void ReleaseVirtualDisplay()
|
||||
{
|
||||
int ret = PXR_Enterprise.ReleaseVirtualDisplay(displayId);
|
||||
showLog("ReleaseVirtualDisplay ret:" + ret);
|
||||
}
|
||||
|
||||
public void InjectEvent(int action, float x, float y)
|
||||
{
|
||||
int ret = PXR_Enterprise.InjectEvent(displayId, action, SOURCE_KEYBOARD, x, y);
|
||||
}
|
||||
|
||||
public void bcak()
|
||||
{
|
||||
int ret = PXR_Enterprise.InjectEvent(displayId, ACTION_DOWN, SOURCE_KEYBOARD, KEYCODE_BACK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9eff5f4fc4057284d87f413c0a63b1a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6971024d1aca1a545ab8ad133a569d1a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,181 @@
|
||||
#if !PICO_OPENXR_SDK
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.XR.PXR;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.XR;
|
||||
|
||||
#if !XRI_300
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
#else
|
||||
using UnityEngine.XR.Interaction.Toolkit.Interactors;
|
||||
#endif
|
||||
|
||||
public class VirtualDisplayEvent : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IDragHandler,
|
||||
IInitializePotentialDragHandler
|
||||
{
|
||||
public string tag = "VirtualDisplayEvent----";
|
||||
public XRRayInteractor xrLeftRayInteractor;
|
||||
public XRRayInteractor xrRightRayInteractor;
|
||||
public VirtualDisplayDemo virtualDisplayController;
|
||||
|
||||
public Text mylog;
|
||||
private XRRayInteractor currentRayInteractor;
|
||||
private GameObject mDisplay;
|
||||
private RectTransform mDisplayTran;
|
||||
private int mKeyEvent;
|
||||
private const int KEYEVENT_DEFAULT = -1;
|
||||
private const int KEYEVENT_DOWN = 0;
|
||||
private const int KEYEVENT_UP = 1;
|
||||
bool LeftState = false;
|
||||
private bool mLeftTriggerPressTemp = false;
|
||||
bool RightState = false;
|
||||
private bool mRightTriggerPressTemp = false;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
mDisplay = this.gameObject;
|
||||
mDisplayTran = mDisplay.GetComponent<RectTransform>();
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
currentRayInteractor = xrRightRayInteractor;
|
||||
}
|
||||
public void showLog(string log)
|
||||
{
|
||||
Debug.Log(tag + log);
|
||||
mylog.text = log;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(PXR_Usages.controllerStatus, out LeftState);
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.RightHand)
|
||||
.TryGetFeatureValue(PXR_Usages.controllerStatus, out RightState);
|
||||
if (RightState)
|
||||
{
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.RightHand)
|
||||
.TryGetFeatureValue(CommonUsages.triggerButton, out mRightTriggerPressTemp);
|
||||
if (mRightTriggerPressTemp)
|
||||
{
|
||||
currentRayInteractor = xrRightRayInteractor;
|
||||
}
|
||||
}
|
||||
else if (LeftState)
|
||||
{
|
||||
InputDevices.GetDeviceAtXRNode(XRNode.LeftHand)
|
||||
.TryGetFeatureValue(CommonUsages.triggerButton, out mLeftTriggerPressTemp);
|
||||
if (mLeftTriggerPressTemp)
|
||||
{
|
||||
currentRayInteractor = xrLeftRayInteractor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mKeyEvent != KEYEVENT_DEFAULT)
|
||||
{
|
||||
DispatchMessageToAndroid(mKeyEvent, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
mKeyEvent = KEYEVENT_DOWN;
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
mKeyEvent = KEYEVENT_UP;
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
mKeyEvent = KEYEVENT_DOWN;
|
||||
}
|
||||
|
||||
public void OnInitializePotentialDrag(PointerEventData eventData)
|
||||
{
|
||||
eventData.useDragThreshold = false;
|
||||
}
|
||||
|
||||
private void DispatchMessageToAndroid(int actionType, PointerEventData eventData)
|
||||
{
|
||||
#if XRI_240
|
||||
Vector3 eventPoint = mDisplay.transform.InverseTransformPoint(currentRayInteractor.rayEndPoint);
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
InstrumentationInput(eventPoint, actionType);
|
||||
}
|
||||
else
|
||||
{
|
||||
float x = (eventPoint.x + mDisplayTran.sizeDelta.x / 2) / mDisplayTran.sizeDelta.x;
|
||||
float y = (mDisplayTran.sizeDelta.y / 2 - eventPoint.y) / mDisplayTran.sizeDelta.y;
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
Debug.Log(actionType + "--->" + x + ", " + y + ", " + eventPoint.x + ", " + eventPoint.y);
|
||||
}
|
||||
#else
|
||||
showLog("com.unity.xr.interaction.toolkit Version needs to be greater than 2.3.x");
|
||||
// Debug.LogError("com.unity.xr.interaction.toolkit Version needs to be greater than 2.3.x");
|
||||
#endif
|
||||
}
|
||||
|
||||
private bool mIsUp = true;
|
||||
private float mLastX, mLastY;
|
||||
|
||||
private void InstrumentationInput(Vector3 eventPoint, int actionType)
|
||||
{
|
||||
|
||||
float eventX = eventPoint.x;
|
||||
float eventY = eventPoint.y;
|
||||
float x = (eventX + mDisplayTran.sizeDelta.x / 2) / mDisplayTran.sizeDelta.x;
|
||||
float y = (mDisplayTran.sizeDelta.y / 2 - eventY) / mDisplayTran.sizeDelta.y;
|
||||
|
||||
if (mIsUp && (eventX == 0.0f || eventY == 0.0f || x > 0.99f || x < 0.01f || y > 0.99f || y < 0.01f))
|
||||
{
|
||||
//处理在屏幕外操作的问题
|
||||
showLog("input--->out of the screen---1");
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
return;
|
||||
}
|
||||
|
||||
if (actionType == KEYEVENT_DOWN)
|
||||
{
|
||||
if (mIsUp)
|
||||
{
|
||||
mIsUp = false;
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo.ACTION_DOWN,x,y);
|
||||
showLog("down--->" + x + ", " + y + ", " + eventX + ", " + eventY);
|
||||
}
|
||||
|
||||
if (!mIsUp)
|
||||
{
|
||||
if (eventX == 0.0f || eventY == 0.0f || x > 0.99f || x < 0.01f || y > 0.99f || y < 0.01f)
|
||||
{
|
||||
//处理划出屏幕,还未抬起的问题
|
||||
showLog("input--->out of the screen---2");
|
||||
mIsUp = true;
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo.ACTION_UP,x,y);
|
||||
showLog("up--->" + mLastX + ", " + mLastY + ", " + eventX + ", " + eventY);
|
||||
}
|
||||
else
|
||||
{
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo.ACTION_MOVE,x,y);
|
||||
showLog("move--->" + x + ", " + y + ", " + eventX + ", " + eventY);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (actionType == KEYEVENT_UP)
|
||||
{
|
||||
mIsUp = true;
|
||||
mKeyEvent = KEYEVENT_DEFAULT;
|
||||
virtualDisplayController.InjectEvent(VirtualDisplayDemo.ACTION_UP,x,y);
|
||||
showLog("up--->" + x + ", " + y + ", " + eventPoint.x + ", " + eventPoint.y);
|
||||
}
|
||||
|
||||
mLastX = x;
|
||||
mLastY = y;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff6164edb8163214a94140877bd556c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0a26202f0fdfe449a11cf4685646f86
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user