集成UVC摄像头功能
This commit is contained in:
parent
cd5bc028c4
commit
2233e6e83d
|
@ -255,6 +255,8 @@ RectTransform:
|
||||||
- {fileID: 8475079236000353301}
|
- {fileID: 8475079236000353301}
|
||||||
- {fileID: 6229047881894855180}
|
- {fileID: 6229047881894855180}
|
||||||
- {fileID: 4277339089744270226}
|
- {fileID: 4277339089744270226}
|
||||||
|
- {fileID: 4318354961022875112}
|
||||||
|
- {fileID: 3096906925272982799}
|
||||||
m_Father: {fileID: 475269767089658797}
|
m_Father: {fileID: 475269767089658797}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
@ -1395,6 +1397,78 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_ShowMaskGraphic: 1
|
m_ShowMaskGraphic: 1
|
||||||
|
--- !u!1 &5049731194724459156
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4318354961022875112}
|
||||||
|
- component: {fileID: 9105578097159592020}
|
||||||
|
- component: {fileID: 7455986887067286179}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Displayer
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &4318354961022875112
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5049731194724459156}
|
||||||
|
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_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 38199016232350786}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: -270, y: 0}
|
||||||
|
m_SizeDelta: {x: -640, y: -100}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &9105578097159592020
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5049731194724459156}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &7455986887067286179
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5049731194724459156}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, 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_Texture: {fileID: 0}
|
||||||
|
m_UVRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
--- !u!1 &5105019391767359508
|
--- !u!1 &5105019391767359508
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1908,6 +1982,114 @@ MonoBehaviour:
|
||||||
m_hasFontAssetChanged: 0
|
m_hasFontAssetChanged: 0
|
||||||
m_baseMaterial: {fileID: 0}
|
m_baseMaterial: {fileID: 0}
|
||||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
--- !u!1 &7940173089482779789
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3096906925272982799}
|
||||||
|
- component: {fileID: 7626762285874418130}
|
||||||
|
- component: {fileID: 6854932209812094026}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: CaptureManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &3096906925272982799
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7940173089482779789}
|
||||||
|
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_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 38199016232350786}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &7626762285874418130
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7940173089482779789}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c96807d839ba7554d92494fd6d25bb28, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_webCamTextureToMatHelper: {fileID: 0}
|
||||||
|
SamplingRate: 0.3
|
||||||
|
TargetDisplayer: {fileID: 7455986887067286179}
|
||||||
|
--- !u!114 &6854932209812094026
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7940173089482779789}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_requestedDeviceName:
|
||||||
|
_requestedWidth: 960
|
||||||
|
_requestedHeight: 720
|
||||||
|
_requestedIsFrontFacing: 0
|
||||||
|
_requestedFPS: 30
|
||||||
|
_rotate90Degree: 0
|
||||||
|
_flipVertical: 0
|
||||||
|
_flipHorizontal: 0
|
||||||
|
_outputColorFormat: 4
|
||||||
|
_timeoutFrameCount: 1500
|
||||||
|
onInitialized:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 7626762285874418130}
|
||||||
|
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
||||||
|
m_MethodName: OnWebCamTextureToMatHelperInitialized
|
||||||
|
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
|
||||||
|
onDisposed:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 7626762285874418130}
|
||||||
|
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
||||||
|
m_MethodName: OnWebCamTextureToMatHelperDisposed
|
||||||
|
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
|
||||||
|
onErrorOccurred:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
avoidAndroidFrontCameraLowLightIssue: 0
|
||||||
--- !u!1 &8393834018379886065
|
--- !u!1 &8393834018379886065
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -290,6 +290,50 @@ RectTransform:
|
||||||
m_CorrespondingSourceObject: {fileID: 8805156796672989800, guid: 85c5c8dc06b4f49419cf4b1751725a67, type: 3}
|
m_CorrespondingSourceObject: {fileID: 8805156796672989800, guid: 85c5c8dc06b4f49419cf4b1751725a67, type: 3}
|
||||||
m_PrefabInstance: {fileID: 168110290}
|
m_PrefabInstance: {fileID: 168110290}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1 &280144576
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 280144578}
|
||||||
|
- component: {fileID: 280144577}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: YogaMainManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &280144577
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 280144576}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b55f4807e5753354ca51edb2a942ff20, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!4 &280144578
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 280144576}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 1042.905, y: 591.9674, z: 1279.6279}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &519578969
|
--- !u!1 &519578969
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -817,195 +861,6 @@ RectTransform:
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0, y: 0}
|
m_Pivot: {x: 0, y: 0}
|
||||||
--- !u!1 &1603288915
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1603288919}
|
|
||||||
- component: {fileID: 1603288918}
|
|
||||||
- component: {fileID: 1603288916}
|
|
||||||
- component: {fileID: 1603288917}
|
|
||||||
- component: {fileID: 1603288921}
|
|
||||||
- component: {fileID: 1603288922}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Capture
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!64 &1603288916
|
|
||||||
MeshCollider:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1603288915}
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IncludeLayers:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 0
|
|
||||||
m_ExcludeLayers:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 0
|
|
||||||
m_LayerOverridePriority: 0
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_ProvidesContacts: 0
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 5
|
|
||||||
m_Convex: 0
|
|
||||||
m_CookingOptions: 30
|
|
||||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
--- !u!23 &1603288917
|
|
||||||
MeshRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1603288915}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
m_DynamicOccludee: 1
|
|
||||||
m_StaticShadowCaster: 0
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 0
|
|
||||||
m_ReflectionProbeUsage: 1
|
|
||||||
m_RayTracingMode: 2
|
|
||||||
m_RayTraceProcedural: 0
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_RendererPriority: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 2100000, guid: 7b4f42e90cf460d47a091713acf8db47, 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!33 &1603288918
|
|
||||||
MeshFilter:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1603288915}
|
|
||||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
--- !u!4 &1603288919
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1603288915}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: -30, y: 0, z: 80}
|
|
||||||
m_LocalScale: {x: 128, y: 96, z: 0}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &1603288921
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1603288915}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_requestedDeviceName: 1
|
|
||||||
_requestedWidth: 1280
|
|
||||||
_requestedHeight: 960
|
|
||||||
_requestedIsFrontFacing: 0
|
|
||||||
_requestedFPS: 30
|
|
||||||
_rotate90Degree: 0
|
|
||||||
_flipVertical: 0
|
|
||||||
_flipHorizontal: 0
|
|
||||||
_outputColorFormat: 2
|
|
||||||
_timeoutFrameCount: 300
|
|
||||||
onInitialized:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls:
|
|
||||||
- m_Target: {fileID: 1603288922}
|
|
||||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
|
||||||
m_MethodName: OnWebCamTextureToMatHelperInitialized
|
|
||||||
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
|
|
||||||
onDisposed:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls:
|
|
||||||
- m_Target: {fileID: 1603288922}
|
|
||||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
|
||||||
m_MethodName: OnWebCamTextureToMatHelperDisposed
|
|
||||||
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
|
|
||||||
onErrorOccurred:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls:
|
|
||||||
- m_Target: {fileID: 1603288922}
|
|
||||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
|
||||||
m_MethodName: OnWebCamTextureToMatHelperErrorOccurred
|
|
||||||
m_Mode: 0
|
|
||||||
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
|
|
||||||
avoidAndroidFrontCameraLowLightIssue: 1
|
|
||||||
--- !u!114 &1603288922
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1603288915}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: c96807d839ba7554d92494fd6d25bb28, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
SamplingRate: 0.1
|
|
||||||
--- !u!1 &1680658391
|
--- !u!1 &1680658391
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -7387,7 +7242,7 @@ SceneRoots:
|
||||||
- {fileID: 963194228}
|
- {fileID: 963194228}
|
||||||
- {fileID: 1190353384}
|
- {fileID: 1190353384}
|
||||||
- {fileID: 1521186386}
|
- {fileID: 1521186386}
|
||||||
- {fileID: 1603288919}
|
|
||||||
- {fileID: 1763781738}
|
- {fileID: 1763781738}
|
||||||
- {fileID: 51299363}
|
- {fileID: 51299363}
|
||||||
- {fileID: 2046868293}
|
- {fileID: 2046868293}
|
||||||
|
- {fileID: 280144578}
|
||||||
|
|
|
@ -90,11 +90,11 @@ public class CVEstimator : Singleton<CVEstimator>
|
||||||
Mat bgrMat = new Mat();
|
Mat bgrMat = new Mat();
|
||||||
while (IsRunning)
|
while (IsRunning)
|
||||||
{
|
{
|
||||||
Mat rgbaMat = MotionCaptureManager.Instance.RgbaMat;
|
Mat rgbaMat = YogaManager.Instance.RgbaMat;
|
||||||
if (rgbaMat == null)
|
if (rgbaMat == null)
|
||||||
{
|
{
|
||||||
Debug.Log("WebCamTexture is null. ");
|
//Debug.Log("WebCamTexture is null. ");
|
||||||
Debug.Log("Re-Estimation.");
|
//Debug.Log("Re-Estimation.");
|
||||||
continue; //重新检测
|
continue; //重新检测
|
||||||
}
|
}
|
||||||
Imgproc.cvtColor(rgbaMat, bgrMat, Imgproc.COLOR_RGBA2BGR);
|
Imgproc.cvtColor(rgbaMat, bgrMat, Imgproc.COLOR_RGBA2BGR);
|
||||||
|
@ -106,7 +106,7 @@ public class CVEstimator : Singleton<CVEstimator>
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新关键点位检测结果
|
//更新关键点位检测结果
|
||||||
MotionCaptureManager.Instance.CurrPersonPoints = points;
|
YogaManager.Instance.CurrPersonPoints = points;
|
||||||
|
|
||||||
//等待到下一个更新周期
|
//等待到下一个更新周期
|
||||||
if (DateTime.Now - startTime > _refreshRate)
|
if (DateTime.Now - startTime > _refreshRate)
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class OpenPoseEsimater : Estimator
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新人物框检测结果
|
//更新人物框检测结果
|
||||||
MotionCaptureManager.Instance.VoloResult = voloResultBox;
|
YogaManager.Instance.VoloResult = voloResultBox;
|
||||||
|
|
||||||
points = null;
|
points = null;
|
||||||
|
|
||||||
|
@ -164,12 +164,12 @@ public class OpenPoseEsimater : Estimator
|
||||||
|
|
||||||
public override void DebugPrint(Mat image, bool isRGB = false)
|
public override void DebugPrint(Mat image, bool isRGB = false)
|
||||||
{
|
{
|
||||||
if (MotionCaptureManager.Instance.VoloResult.Count > 2)
|
if (YogaManager.Instance.VoloResult.Count > 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var box = MotionCaptureManager.Instance.VoloResult[0];
|
var box = YogaManager.Instance.VoloResult[0];
|
||||||
var conf = MotionCaptureManager.Instance.VoloResult[1];
|
var conf = YogaManager.Instance.VoloResult[1];
|
||||||
var cls = MotionCaptureManager.Instance.VoloResult[2];
|
var cls = YogaManager.Instance.VoloResult[2];
|
||||||
|
|
||||||
float left = box[0];
|
float left = box[0];
|
||||||
float top = box[1];
|
float top = box[1];
|
||||||
|
|
|
@ -1,30 +1,24 @@
|
||||||
using OpenCVForUnity.CoreModule;
|
using OpenCVForUnity.CoreModule;
|
||||||
using OpenCVForUnity.DnnModule;
|
|
||||||
using OpenCVForUnity.ImgprocModule;
|
using OpenCVForUnity.ImgprocModule;
|
||||||
using OpenCVForUnity.UnityUtils;
|
using OpenCVForUnity.UnityUtils;
|
||||||
using OpenCVForUnity.UnityUtils.Helper;
|
using OpenCVForUnity.UnityUtils.Helper;
|
||||||
using OpenCVForUnityExample;
|
using Serenegiant.UVC;
|
||||||
//using Serenegiant.UVC;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Video;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace Yoga
|
namespace Yoga
|
||||||
{
|
{
|
||||||
public class MotionCaptureManager : MonoSingleton<MotionCaptureManager>
|
public class MotionCaptureManager : CameraCaptureManagerBase, IUVCDrawer
|
||||||
{
|
{
|
||||||
private WebCamTextureToMatHelper _webCamTextureToMatHelper;
|
public WebCamTextureToMatHelper _webCamTextureToMatHelper;
|
||||||
//private UVCManager _uvcManager;
|
|
||||||
private Texture2D texture;
|
private Texture2D texture;
|
||||||
|
|
||||||
public float SamplingRate = 0.3f;
|
public float SamplingRate = 0.3f;
|
||||||
|
public RawImage TargetDisplayer;
|
||||||
private List<float[]> _voloResult = new List<float[]>();
|
|
||||||
private List<Point> _currPersonPoints = new List<Point>();
|
|
||||||
|
|
||||||
private Mat _bgrMat;
|
private Mat _bgrMat;
|
||||||
|
|
||||||
|
@ -32,21 +26,7 @@ namespace Yoga
|
||||||
public bool IsOnCamCapture { get => _isOnCamCapture; internal set => _isOnCamCapture = value; }
|
public bool IsOnCamCapture { get => _isOnCamCapture; internal set => _isOnCamCapture = value; }
|
||||||
public WebCamTextureToMatHelper WebCamTextureToMatHelper => _webCamTextureToMatHelper;
|
public WebCamTextureToMatHelper WebCamTextureToMatHelper => _webCamTextureToMatHelper;
|
||||||
|
|
||||||
public List<Point> CurrPersonPoints { get => _currPersonPoints; set => _currPersonPoints = value; }
|
|
||||||
public List<float[]> VoloResult { get => _voloResult; set => _voloResult = value; }
|
|
||||||
private bool _isCorrectAction = false;
|
private bool _isCorrectAction = false;
|
||||||
private Mat _rgbaMat;
|
|
||||||
public Mat RgbaMat
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_rgbaMat == null && _webCamTextureToMatHelper != null)
|
|
||||||
_rgbaMat = _webCamTextureToMatHelper.GetMat();
|
|
||||||
return _rgbaMat;
|
|
||||||
}
|
|
||||||
|
|
||||||
set => _rgbaMat = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
|
@ -58,6 +38,7 @@ namespace Yoga
|
||||||
EventManager.Instance.AddEventListener(YogaEventType.ChangeCaptureCameraDevice, ChangeCaptureCameraDevice);
|
EventManager.Instance.AddEventListener(YogaEventType.ChangeCaptureCameraDevice, ChangeCaptureCameraDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
EventManager.Instance.RemoveEventListener(YogaEventType.StartMotionCapture, OnStartMotionCapture);
|
EventManager.Instance.RemoveEventListener(YogaEventType.StartMotionCapture, OnStartMotionCapture);
|
||||||
|
@ -68,12 +49,10 @@ namespace Yoga
|
||||||
EventManager.Instance.RemoveEventListener(YogaEventType.ChangeCaptureCameraDevice, ChangeCaptureCameraDevice);
|
EventManager.Instance.RemoveEventListener(YogaEventType.ChangeCaptureCameraDevice, ChangeCaptureCameraDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Init()
|
public void Awake()
|
||||||
{
|
{
|
||||||
base.Init();
|
if (_webCamTextureToMatHelper == null)
|
||||||
|
_webCamTextureToMatHelper = transform.GetComponent<WebCamTextureToMatHelper>();
|
||||||
_webCamTextureToMatHelper = gameObject.GetComponentInChildren<WebCamTextureToMatHelper>();
|
|
||||||
//_uvcManager = gameObject.GetComponentInChildren<UVCManager>();
|
|
||||||
|
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
// Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
|
// Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
|
||||||
|
@ -82,18 +61,116 @@ namespace Yoga
|
||||||
|
|
||||||
_webCamTextureToMatHelper.Initialize();
|
_webCamTextureToMatHelper.Initialize();
|
||||||
|
|
||||||
UIManager.Instance.LoadReset();
|
|
||||||
|
|
||||||
if (YogaManager.Instance.Action == null)
|
|
||||||
YogaManager.Instance.InitData();
|
|
||||||
|
|
||||||
UIManager.Instance.ShowPanel<ActionGuideVideoPanel>(false, YogaManager.Instance.Action);
|
|
||||||
|
|
||||||
Utils.setDebugMode(true); //打印日志
|
Utils.setDebugMode(true); //打印日志
|
||||||
|
|
||||||
|
GlobalData.Instance.CameraDeviceType = CameraDeviceType.USB; //test
|
||||||
|
|
||||||
|
var devices = UVCManager.Instance.GetAttachedDevices();
|
||||||
CVEstimator.Instance.Init();//初始化姿态检测
|
CVEstimator.Instance.Init();//初始化姿态检测
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region UVC
|
||||||
|
public UVCFilter[] UVCFilters;
|
||||||
|
private Texture SavedTexture;
|
||||||
|
public bool OnUVCAttachEvent(UVCManager manager, UVCDevice device)
|
||||||
|
{
|
||||||
|
var result = !device.IsRicoh || device.IsTHETA;
|
||||||
|
|
||||||
|
result &= UVCFilter.Match(device, UVCFilters);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnUVCDetachEvent(UVCManager manager, UVCDevice device)
|
||||||
|
{
|
||||||
|
Debug.Log("OnUVCDetachEvent " + device);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanDraw(UVCManager manager, UVCDevice device)
|
||||||
|
{
|
||||||
|
return UVCFilter.Match(device, UVCFilters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnUVCStartEvent(UVCManager manager, UVCDevice device, Texture tex)
|
||||||
|
{
|
||||||
|
HandleOnStartPreview(tex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnUVCStopEvent(UVCManager manager, UVCDevice device)
|
||||||
|
{
|
||||||
|
HandleOnStopPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleOnStartPreview(Texture tex)
|
||||||
|
{
|
||||||
|
SavedTexture = TargetDisplayer.texture;
|
||||||
|
TargetDisplayer.texture = texture;
|
||||||
|
}
|
||||||
|
private void HandleOnStopPreview()
|
||||||
|
{
|
||||||
|
RestoreTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RestoreTexture()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transform.GetComponent<Renderer>().material.mainTexture = SavedTexture;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogException(e);
|
||||||
|
}
|
||||||
|
SavedTexture = null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public static Texture2D HorizontalFlipTexture(Texture2D texture)
|
||||||
|
{
|
||||||
|
//得到图片的宽高
|
||||||
|
int width = texture.width;
|
||||||
|
int height = texture.height;
|
||||||
|
|
||||||
|
Texture2D flipTexture = new Texture2D(width, height);
|
||||||
|
|
||||||
|
for (int i = 0; i < width; i++)
|
||||||
|
{
|
||||||
|
flipTexture.SetPixels(i, 0, 1, height, texture.GetPixels(width - i - 1, 0, 1, height));
|
||||||
|
}
|
||||||
|
flipTexture.Apply();
|
||||||
|
|
||||||
|
return flipTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Mat GetMat()
|
||||||
|
{
|
||||||
|
Mat img = null;
|
||||||
|
if (GlobalData.Instance.CameraDeviceType == CameraDeviceType.USB &&
|
||||||
|
UVCManager.Instance != null &&
|
||||||
|
UVCManager.Instance.GetAttachedDevices() != null && UVCManager.Instance.GetAttachedDevices().Count > 0)
|
||||||
|
{
|
||||||
|
var devices = UVCManager.Instance.GetAttachedDevices();
|
||||||
|
var formatRefMat = _webCamTextureToMatHelper.GetMat();
|
||||||
|
var picCaptured = devices.FirstOrDefault().previewTexture;
|
||||||
|
Texture2D tmpTex = new Texture2D(picCaptured.width, picCaptured.height);
|
||||||
|
Utils.textureToTexture2D(picCaptured, tmpTex);
|
||||||
|
tmpTex = HorizontalFlipTexture(tmpTex);//picCaptured texture水平反转
|
||||||
|
img = new Mat(formatRefMat.rows(), formatRefMat.cols(), formatRefMat.type());
|
||||||
|
Utils.texture2DToMat(tmpTex, img);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_webCamTextureToMatHelper.IsPlaying() && _webCamTextureToMatHelper.DidUpdateThisFrame())
|
||||||
|
{
|
||||||
|
img = _webCamTextureToMatHelper.GetMat();
|
||||||
|
Imgproc.cvtColor(img, img, Imgproc.COLOR_BGR2RGB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (!_isOnCamCapture)
|
if (!_isOnCamCapture)
|
||||||
|
@ -101,42 +178,24 @@ namespace Yoga
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GlobalData.Instance.CameraDeviceType == CameraDeviceType.USB)
|
|
||||||
{
|
|
||||||
//if (_uvcManager != null)
|
|
||||||
//{
|
|
||||||
// var devices = _uvcManager.GetAttachedDevices();
|
|
||||||
// if (devices != null && devices.Count > 0)
|
|
||||||
// {
|
|
||||||
// Utils.textureToTexture2D(devices.FirstOrDefault().previewTexture, texture);
|
|
||||||
// //Mat img = RgbaMat.clone();
|
|
||||||
// //Utils.texture2DToMat(texture, img);
|
|
||||||
// //YogaManager.Instance.CurrentEstimator.Check(ref img);
|
|
||||||
// //Utils.matToTexture2D(img, texture);
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!transform.gameObject.activeSelf)
|
if (!transform.gameObject.activeSelf)
|
||||||
transform.gameObject.SetActive(true);
|
transform.gameObject.SetActive(true);
|
||||||
|
|
||||||
if (_webCamTextureToMatHelper.IsPlaying() && _webCamTextureToMatHelper.DidUpdateThisFrame())
|
Mat img = GetMat();
|
||||||
{
|
|
||||||
Mat img = _webCamTextureToMatHelper.GetMat();
|
|
||||||
Imgproc.cvtColor(img, img, Imgproc.COLOR_BGR2RGB);
|
|
||||||
_rgbaMat = img.clone();
|
|
||||||
|
|
||||||
|
if (img == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
YogaManager.Instance.RgbaMat = img.clone();
|
||||||
YogaManager.Instance.CurrentEstimator.Check(ref img);//检测模型,将错误信息打印在图片上
|
YogaManager.Instance.CurrentEstimator.Check(ref img);//检测模型,将错误信息打印在图片上
|
||||||
|
|
||||||
|
if (YogaManager.Instance.VoloResult.Count >= 2)
|
||||||
|
YogaManager.Instance.CurrentEstimator.DebugPrint(img);
|
||||||
|
|
||||||
if (_voloResult.Count >= 2)
|
if (YogaManager.Instance.CurrPersonPoints != null && YogaManager.Instance.CurrPersonPoints.Count > 0)
|
||||||
YogaManager.Instance.CurrentEstimator.DebugPrint(img);//DebugPrintObjectLayout(img, _voloResult[0], _voloResult[1], _voloResult[2]);
|
|
||||||
|
|
||||||
if (_currPersonPoints != null && _currPersonPoints.Count > 0)
|
|
||||||
{
|
{
|
||||||
List<Point> points = _currPersonPoints;
|
List<Point> points = YogaManager.Instance.CurrPersonPoints;
|
||||||
|
|
||||||
for (int i = 0; i < YogaConfig.POSE_PAIRS.GetLength(0); i++)
|
for (int i = 0; i < YogaConfig.POSE_PAIRS.GetLength(0); i++)
|
||||||
{
|
{
|
||||||
|
@ -158,10 +217,8 @@ namespace Yoga
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endif
|
|
||||||
Utils.matToTexture2D(img, texture);
|
Utils.matToTexture2D(img, texture);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#region Event Func
|
#region Event Func
|
||||||
private void OnStartMotionCapture()
|
private void OnStartMotionCapture()
|
||||||
|
@ -182,9 +239,9 @@ namespace Yoga
|
||||||
var startTime = DateTime.Now;
|
var startTime = DateTime.Now;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (_currPersonPoints != null && _currPersonPoints.Count != 0)
|
if (YogaManager.Instance.CurrPersonPoints != null && YogaManager.Instance.CurrPersonPoints.Count != 0)
|
||||||
{
|
{
|
||||||
YogaManager.Instance.Points = _currPersonPoints;
|
YogaManager.Instance.Points = YogaManager.Instance.CurrPersonPoints;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,9 +269,9 @@ namespace Yoga
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (YogaManager.Instance.ActionCheckPoints(_currPersonPoints))
|
if (YogaManager.Instance.ActionCheckPoints(YogaManager.Instance.CurrPersonPoints))
|
||||||
{
|
{
|
||||||
_isCorrectAction = (_isCorrectAction || YogaManager.Instance.IsCorrectAction(_currPersonPoints, actionType));
|
_isCorrectAction = (_isCorrectAction || YogaManager.Instance.IsCorrectAction(YogaManager.Instance.CurrPersonPoints, actionType));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (startTime.AddMilliseconds(100) < DateTime.Now)
|
if (startTime.AddMilliseconds(100) < DateTime.Now)
|
||||||
|
@ -226,7 +283,6 @@ namespace Yoga
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ChangeCaptureCameraDevice()
|
private void ChangeCaptureCameraDevice()
|
||||||
{
|
{
|
||||||
var deviceName = WebCamTexture.devices[GlobalData.Instance.CameraIndex].name;
|
var deviceName = WebCamTexture.devices[GlobalData.Instance.CameraIndex].name;
|
||||||
|
@ -273,7 +329,8 @@ namespace Yoga
|
||||||
texture = new Texture2D(webCamTextureMat.cols(), webCamTextureMat.rows(), TextureFormat.RGB24, false);
|
texture = new Texture2D(webCamTextureMat.cols(), webCamTextureMat.rows(), TextureFormat.RGB24, false);
|
||||||
Utils.matToTexture2D(webCamTextureMat, texture);
|
Utils.matToTexture2D(webCamTextureMat, texture);
|
||||||
|
|
||||||
this.gameObject.GetComponent<Renderer>().material.mainTexture = texture;
|
//gameObject.GetComponent<Renderer>().material.mainTexture = texture;
|
||||||
|
TargetDisplayer.texture = texture;
|
||||||
|
|
||||||
gameObject.transform.localScale = new Vector3(webCamTextureMat.cols() / 10, webCamTextureMat.rows() / 10, 1);
|
gameObject.transform.localScale = new Vector3(webCamTextureMat.cols() / 10, webCamTextureMat.rows() / 10, 1);
|
||||||
Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
|
Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
|
||||||
|
@ -330,4 +387,8 @@ namespace Yoga
|
||||||
_isCorrectAction = false;//重置
|
_isCorrectAction = false;//重置
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract class CameraCaptureManagerBase : MonoBehaviour
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class YogaMainManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
UIManager.Instance.LoadReset();
|
||||||
|
|
||||||
|
if (YogaManager.Instance.Action == null)
|
||||||
|
YogaManager.Instance.InitData();
|
||||||
|
|
||||||
|
UIManager.Instance.ShowPanel<ActionGuideVideoPanel>(false, YogaManager.Instance.Action);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b55f4807e5753354ca51edb2a942ff20
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -16,6 +16,21 @@ using Yoga;
|
||||||
public class YogaManager : MonoSingleton<YogaManager>
|
public class YogaManager : MonoSingleton<YogaManager>
|
||||||
{
|
{
|
||||||
private List<Point> _points = new List<Point>();
|
private List<Point> _points = new List<Point>();
|
||||||
|
private Mat _rgbaMat;
|
||||||
|
public Mat RgbaMat
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _rgbaMat;
|
||||||
|
}
|
||||||
|
|
||||||
|
set => _rgbaMat = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Point> _currPersonPoints = new List<Point>();
|
||||||
|
public List<Point> CurrPersonPoints { get => _currPersonPoints; set => _currPersonPoints = value; }
|
||||||
|
private List<float[]> _voloResult = new List<float[]>();
|
||||||
|
public List<float[]> VoloResult { get => _voloResult; set => _voloResult = value; }
|
||||||
|
|
||||||
public List<Point> Points { get => _points; set => _points = value; }
|
public List<Point> Points { get => _points; set => _points = value; }
|
||||||
|
|
||||||
|
@ -116,7 +131,7 @@ public class YogaManager : MonoSingleton<YogaManager>
|
||||||
{
|
{
|
||||||
if (points == null || points.Count == 0)
|
if (points == null || points.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.Log("ActionCheckPoints points is null");
|
//Debug.Log("ActionCheckPoints points is null");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class CubeHandler : MonoBehaviour,
|
||||||
public void OnPointerClick(PointerEventData eventData)
|
public void OnPointerClick(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine("OnClick:");
|
Debug.Log("OnClick:");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Serenegiant {
|
||||||
{ // タッチしたとき
|
{ // タッチしたとき
|
||||||
touchEvent.state = TouchState.Began;
|
touchEvent.state = TouchState.Began;
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine("タッチした:");
|
Debug.Log("タッチした:");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ namespace Serenegiant {
|
||||||
{ // 離したとき
|
{ // 離したとき
|
||||||
touchEvent.state = TouchState.Ended;
|
touchEvent.state = TouchState.Ended;
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine("タッチした:");
|
Debug.Log("タッチした:");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ namespace Serenegiant {
|
||||||
{ // 押し続けているとき
|
{ // 押し続けているとき
|
||||||
touchEvent.state = TouchState.Moved;
|
touchEvent.state = TouchState.Moved;
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine("押し続けている");
|
Debug.Log("押し続けている");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Serenegiant
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}Awake:");
|
Debug.Log($"{TAG}Awake:");
|
||||||
#endif
|
#endif
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID
|
||||||
Input.backButtonLeavesApp = true; // 端末のバックキーでアプリを終了できるようにする
|
Input.backButtonLeavesApp = true; // 端末のバックキーでアプリを終了できるようにする
|
||||||
|
@ -78,7 +78,7 @@ namespace Serenegiant
|
||||||
public void OnStartEvent()
|
public void OnStartEvent()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnStartEvent:");
|
Debug.Log($"{TAG}OnStartEvent:");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace Serenegiant
|
||||||
public void OnResumeEvent()
|
public void OnResumeEvent()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnResumeEvent:");
|
Debug.Log($"{TAG}OnResumeEvent:");
|
||||||
#endif
|
#endif
|
||||||
LifecycleEvent?.Invoke(true);
|
LifecycleEvent?.Invoke(true);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ namespace Serenegiant
|
||||||
public void OnPauseEvent()
|
public void OnPauseEvent()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnPauseEvent:");
|
Debug.Log($"{TAG}OnPauseEvent:");
|
||||||
#endif
|
#endif
|
||||||
LifecycleEvent?.Invoke(false);
|
LifecycleEvent?.Invoke(false);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ namespace Serenegiant
|
||||||
public void OnStopEvent()
|
public void OnStopEvent()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnStopEvent:");
|
Debug.Log($"{TAG}OnStopEvent:");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ namespace Serenegiant
|
||||||
public void OnPermissionGrant()
|
public void OnPermissionGrant()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnPermissionGrant:");
|
Debug.Log($"{TAG}OnPermissionGrant:");
|
||||||
#endif
|
#endif
|
||||||
grantResult = PermissionGrantResult.PERMISSION_GRANT;
|
grantResult = PermissionGrantResult.PERMISSION_GRANT;
|
||||||
isPermissionRequesting = false;
|
isPermissionRequesting = false;
|
||||||
|
@ -132,7 +132,7 @@ namespace Serenegiant
|
||||||
public void OnPermissionDeny()
|
public void OnPermissionDeny()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnPermissionDeny:");
|
Debug.Log($"{TAG}OnPermissionDeny:");
|
||||||
#endif
|
#endif
|
||||||
grantResult = PermissionGrantResult.PERMISSION_DENY;
|
grantResult = PermissionGrantResult.PERMISSION_DENY;
|
||||||
isPermissionRequesting = false;
|
isPermissionRequesting = false;
|
||||||
|
@ -144,7 +144,7 @@ namespace Serenegiant
|
||||||
public void OnPermissionDenyAndNeverAskAgain()
|
public void OnPermissionDenyAndNeverAskAgain()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnPermissionDenyAndNeverAskAgain:");
|
Debug.Log($"{TAG}OnPermissionDenyAndNeverAskAgain:");
|
||||||
#endif
|
#endif
|
||||||
grantResult = PermissionGrantResult.PERMISSION_DENY_AND_NEVER_ASK_AGAIN;
|
grantResult = PermissionGrantResult.PERMISSION_DENY_AND_NEVER_ASK_AGAIN;
|
||||||
isPermissionRequesting = false;
|
isPermissionRequesting = false;
|
||||||
|
@ -158,7 +158,7 @@ namespace Serenegiant
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}Initialize:{gameObject.name}");
|
Debug.Log($"{TAG}Initialize:{gameObject.name}");
|
||||||
#endif
|
#endif
|
||||||
using (AndroidJavaClass clazz = new AndroidJavaClass(FQCN_PLUGIN))
|
using (AndroidJavaClass clazz = new AndroidJavaClass(FQCN_PLUGIN))
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,7 @@ namespace Serenegiant
|
||||||
public static IEnumerator RequestPermission(string permission, OnPermission callback)
|
public static IEnumerator RequestPermission(string permission, OnPermission callback)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}GrantPermission:{permission}");
|
Debug.Log($"{TAG}GrantPermission:{permission}");
|
||||||
#endif
|
#endif
|
||||||
if (!HasPermission(permission))
|
if (!HasPermission(permission))
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ namespace Serenegiant
|
||||||
public static IEnumerator GrantPermission(string permission, OnPermission callback)
|
public static IEnumerator GrantPermission(string permission, OnPermission callback)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}GrantPermission:{permission}");
|
Debug.Log($"{TAG}GrantPermission:{permission}");
|
||||||
#endif
|
#endif
|
||||||
if (!HasPermission(permission))
|
if (!HasPermission(permission))
|
||||||
{
|
{
|
||||||
|
@ -284,7 +284,7 @@ namespace Serenegiant
|
||||||
public static IEnumerator GrantCameraPermission(OnPermission callback)
|
public static IEnumerator GrantCameraPermission(OnPermission callback)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}GrantCameraPermission:");
|
Debug.Log($"{TAG}GrantCameraPermission:");
|
||||||
#endif
|
#endif
|
||||||
if (CheckAndroidVersion(23))
|
if (CheckAndroidVersion(23))
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace Serenegiant.UVC
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}Start:");
|
Debug.Log($"{TAG}Start:");
|
||||||
#endif
|
#endif
|
||||||
UpdateTarget();
|
UpdateTarget();
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ namespace Serenegiant.UVC
|
||||||
public bool OnUVCAttachEvent(UVCManager manager, UVCDevice device)
|
public bool OnUVCAttachEvent(UVCManager manager, UVCDevice device)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnUVCAttachEvent:{device}");
|
Debug.Log($"{TAG}OnUVCAttachEvent:{device}");
|
||||||
#endif
|
#endif
|
||||||
// XXX 今の実装では基本的に全てのUVC機器を受け入れる
|
// XXX 今の実装では基本的に全てのUVC機器を受け入れる
|
||||||
// ただしTHETA SとTHETA VとTHETA Z1は映像を取得できないインターフェースがあるのでオミットする
|
// ただしTHETA SとTHETA VとTHETA Z1は映像を取得できないインターフェースがあるのでオミットする
|
||||||
|
@ -112,7 +112,7 @@ namespace Serenegiant.UVC
|
||||||
public void OnUVCDetachEvent(UVCManager manager, UVCDevice device)
|
public void OnUVCDetachEvent(UVCManager manager, UVCDevice device)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnUVCDetachEvent:{device}");
|
Debug.Log($"{TAG}OnUVCDetachEvent:{device}");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,26 +126,26 @@ namespace Serenegiant.UVC
|
||||||
// public SupportedFormats.Size OnUVCSelectSize(UVCManager manager, UVCDevice device, SupportedFormats formats)
|
// public SupportedFormats.Size OnUVCSelectSize(UVCManager manager, UVCDevice device, SupportedFormats formats)
|
||||||
// {
|
// {
|
||||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:{device}");
|
// Debug.Log($"{TAG}OnUVCSelectSize:{device}");
|
||||||
//#endif
|
//#endif
|
||||||
// if (device.IsTHETA_V || device.IsTHETA_Z1)
|
// if (device.IsTHETA_V || device.IsTHETA_Z1)
|
||||||
// {
|
// {
|
||||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:THETA V/Z1");
|
// Debug.Log($"{TAG}OnUVCSelectSize:THETA V/Z1");
|
||||||
//#endif
|
//#endif
|
||||||
// return FindSize(formats, 3840, 1920);
|
// return FindSize(formats, 3840, 1920);
|
||||||
// }
|
// }
|
||||||
// else if (device.IsTHETA_S)
|
// else if (device.IsTHETA_S)
|
||||||
// {
|
// {
|
||||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:THETA S");
|
// Debug.Log($"{TAG}OnUVCSelectSize:THETA S");
|
||||||
//#endif
|
//#endif
|
||||||
// return FindSize(formats, 1920, 1080);
|
// return FindSize(formats, 1920, 1080);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:other UVC device,{device}");
|
// Debug.Log($"{TAG}OnUVCSelectSize:other UVC device,{device}");
|
||||||
//#endif
|
//#endif
|
||||||
// return formats.Find(DefaultWidth, DefaultHeight);
|
// return formats.Find(DefaultWidth, DefaultHeight);
|
||||||
// }
|
// }
|
||||||
|
@ -172,7 +172,7 @@ namespace Serenegiant.UVC
|
||||||
public void OnUVCStartEvent(UVCManager manager, UVCDevice device, Texture tex)
|
public void OnUVCStartEvent(UVCManager manager, UVCDevice device, Texture tex)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnUVCStartEvent:{device}");
|
Debug.Log($"{TAG}OnUVCStartEvent:{device}");
|
||||||
#endif
|
#endif
|
||||||
HandleOnStartPreview(tex);
|
HandleOnStartPreview(tex);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ namespace Serenegiant.UVC
|
||||||
public void OnUVCStopEvent(UVCManager manager, UVCDevice device)
|
public void OnUVCStopEvent(UVCManager manager, UVCDevice device)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnUVCStopEvent:{device}");
|
Debug.Log($"{TAG}OnUVCStopEvent:{device}");
|
||||||
#endif
|
#endif
|
||||||
HandleOnStopPreview();
|
HandleOnStopPreview();
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ namespace Serenegiant.UVC
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}UpdateTarget:material={material}");
|
Debug.Log($"{TAG}UpdateTarget:material={material}");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -313,7 +313,7 @@ namespace Serenegiant.UVC
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{TAG}RestoreTexture:Exception cought");
|
Debug.Log($"{TAG}RestoreTexture:Exception cought");
|
||||||
}
|
}
|
||||||
SavedTextures[i] = null;
|
SavedTextures[i] = null;
|
||||||
quaternions[i] = Quaternion.identity;
|
quaternions[i] = Quaternion.identity;
|
||||||
|
@ -335,7 +335,7 @@ namespace Serenegiant.UVC
|
||||||
private void HandleOnStartPreview(Texture tex)
|
private void HandleOnStartPreview(Texture tex)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStartPreview:({tex})");
|
Debug.Log($"{TAG}HandleOnStartPreview:({tex})");
|
||||||
#endif
|
#endif
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var target in TargetMaterials)
|
foreach (var target in TargetMaterials)
|
||||||
|
@ -343,7 +343,7 @@ namespace Serenegiant.UVC
|
||||||
if (target is Material)
|
if (target is Material)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStartPreview:assign Texture to Material({target})");
|
Debug.Log($"{TAG}HandleOnStartPreview:assign Texture to Material({target})");
|
||||||
#endif
|
#endif
|
||||||
SavedTextures[i++] = (target as Material).mainTexture;
|
SavedTextures[i++] = (target as Material).mainTexture;
|
||||||
(target as Material).mainTexture = tex;
|
(target as Material).mainTexture = tex;
|
||||||
|
@ -351,7 +351,7 @@ namespace Serenegiant.UVC
|
||||||
else if (target is RawImage)
|
else if (target is RawImage)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStartPreview:assign Texture to RawImage({target})");
|
Debug.Log($"{TAG}HandleOnStartPreview:assign Texture to RawImage({target})");
|
||||||
#endif
|
#endif
|
||||||
SavedTextures[i++] = (target as RawImage).texture;
|
SavedTextures[i++] = (target as RawImage).texture;
|
||||||
(target as RawImage).texture = tex;
|
(target as RawImage).texture = tex;
|
||||||
|
@ -365,12 +365,12 @@ namespace Serenegiant.UVC
|
||||||
private void HandleOnStopPreview()
|
private void HandleOnStopPreview()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStopPreview:");
|
Debug.Log($"{TAG}HandleOnStopPreview:");
|
||||||
#endif
|
#endif
|
||||||
// 描画先のテクスチャをもとに戻す
|
// 描画先のテクスチャをもとに戻す
|
||||||
RestoreTexture();
|
RestoreTexture();
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStopPreview:finished");
|
Debug.Log($"{TAG}HandleOnStopPreview:finished");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace Serenegiant.UVC
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}Match({device}):result={result}");
|
Debug.Log($"{TAG}Match({device}):result={result}");
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@ using UnityEngine;
|
||||||
|
|
||||||
#if UNITY_ANDROID && UNITY_2018_3_OR_NEWER
|
#if UNITY_ANDROID && UNITY_2018_3_OR_NEWER
|
||||||
using UnityEngine.Android;
|
using UnityEngine.Android;
|
||||||
|
using Yoga;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Serenegiant.UVC
|
namespace Serenegiant.UVC
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(AndroidUtils))]
|
[RequireComponent(typeof(AndroidUtils))]
|
||||||
public class UVCManager : MonoBehaviour
|
public class UVCManager : MonoSingleton<UVCManager>
|
||||||
{
|
{
|
||||||
private const string TAG = "UVCManager#";
|
private const string TAG = "UVCManager#";
|
||||||
private const string FQCN_DETECTOR = "com.serenegiant.usb.DeviceDetectorFragment";
|
private const string FQCN_DETECTOR = "com.serenegiant.usb.DeviceDetectorFragment";
|
||||||
|
@ -80,7 +81,8 @@ namespace Serenegiant.UVC
|
||||||
/**
|
/**
|
||||||
* 機器idを取得
|
* 機器idを取得
|
||||||
*/
|
*/
|
||||||
public Int32 Id{
|
public Int32 Id
|
||||||
|
{
|
||||||
get { return device.id; }
|
get { return device.id; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +164,8 @@ namespace Serenegiant.UVC
|
||||||
if (renderBeforeSceneRendering)
|
if (renderBeforeSceneRendering)
|
||||||
{
|
{
|
||||||
return manager.StartCoroutine(OnRenderBeforeSceneRendering());
|
return manager.StartCoroutine(OnRenderBeforeSceneRendering());
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return manager.StartCoroutine(OnRender());
|
return manager.StartCoroutine(OnRender());
|
||||||
}
|
}
|
||||||
|
@ -246,8 +249,9 @@ namespace Serenegiant.UVC
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
IEnumerator Start()
|
IEnumerator Start()
|
||||||
{
|
{
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}Start:");
|
Debug.Log($"{TAG}Start:");
|
||||||
#endif
|
#endif
|
||||||
mainContext = SynchronizationContext.Current;
|
mainContext = SynchronizationContext.Current;
|
||||||
callback = OnDeviceChangedCallbackManager.Add(this);
|
callback = OnDeviceChangedCallbackManager.Add(this);
|
||||||
|
@ -258,28 +262,28 @@ namespace Serenegiant.UVC
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
void OnApplicationFocus()
|
void OnApplicationFocus()
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{TAG}OnApplicationFocus:");
|
Debug.Log($"{TAG}OnApplicationFocus:");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
void OnApplicationPause(bool pauseStatus)
|
void OnApplicationPause(bool pauseStatus)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{TAG}OnApplicationPause:{pauseStatus}");
|
Debug.Log($"{TAG}OnApplicationPause:{pauseStatus}");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
void OnApplicationQuits()
|
void OnApplicationQuits()
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{TAG}OnApplicationQuits:");
|
Debug.Log($"{TAG}OnApplicationQuits:");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnDestroy:");
|
Debug.Log($"{TAG}OnDestroy:");
|
||||||
#endif
|
#endif
|
||||||
StopAll();
|
StopAll();
|
||||||
OnDeviceChangedCallbackManager.Remove(this);
|
OnDeviceChangedCallbackManager.Remove(this);
|
||||||
|
@ -292,13 +296,13 @@ namespace Serenegiant.UVC
|
||||||
{
|
{
|
||||||
var id = UVCDevice.GetId(devicePtr);
|
var id = UVCDevice.GetId(devicePtr);
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnDeviceChangedInternal:id={id},attached={attached}");
|
Debug.Log($"{TAG}OnDeviceChangedInternal:id={id},attached={attached}");
|
||||||
#endif
|
#endif
|
||||||
if (attached)
|
if (attached)
|
||||||
{
|
{
|
||||||
UVCDevice device = new UVCDevice(devicePtr);
|
UVCDevice device = new UVCDevice(devicePtr);
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnDeviceChangedInternal:device={device.ToString()}");
|
Debug.Log($"{TAG}OnDeviceChangedInternal:device={device.ToString()}");
|
||||||
#endif
|
#endif
|
||||||
if (HandleOnAttachEvent(device))
|
if (HandleOnAttachEvent(device))
|
||||||
{
|
{
|
||||||
|
@ -338,85 +342,86 @@ namespace Serenegiant.UVC
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 対応解像度を取得
|
// * 対応解像度を取得
|
||||||
// * @param camera 対応解像度を取得するUVC機器を指定
|
// * @param camera 対応解像度を取得するUVC機器を指定
|
||||||
// * @return 対応解像度 既にカメラが取り外されている/closeしているのであればnull
|
// * @return 対応解像度 既にカメラが取り外されている/closeしているのであればnull
|
||||||
// */
|
// */
|
||||||
// public SupportedFormats GetSupportedVideoSize(CameraInfo camera)
|
// public SupportedFormats GetSupportedVideoSize(CameraInfo camera)
|
||||||
// {
|
// {
|
||||||
// var info = (camera != null) ? Get(camera.DeviceName) : null;
|
// var info = (camera != null) ? Get(camera.DeviceName) : null;
|
||||||
// if ((info != null) && info.IsOpen)
|
// if ((info != null) && info.IsOpen)
|
||||||
// {
|
// {
|
||||||
// return GetSupportedVideoSize(info.DeviceName);
|
// return GetSupportedVideoSize(info.DeviceName);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 解像度を変更
|
// * 解像度を変更
|
||||||
// * @param 解像度を変更するUVC機器を指定
|
// * @param 解像度を変更するUVC機器を指定
|
||||||
// * @param 変更する解像度を指定, nullならデフォルトに戻す
|
// * @param 変更する解像度を指定, nullならデフォルトに戻す
|
||||||
// * @param 解像度が変更されたかどうか
|
// * @param 解像度が変更されたかどうか
|
||||||
// */
|
// */
|
||||||
// public bool SetVideoSize(CameraInfo camera, SupportedFormats.Size size)
|
// public bool SetVideoSize(CameraInfo camera, SupportedFormats.Size size)
|
||||||
// {
|
// {
|
||||||
// var info = (camera != null) ? Get(camera.DeviceName) : null;
|
// var info = (camera != null) ? Get(camera.DeviceName) : null;
|
||||||
// var width = size != null ? size.Width : DefaultWidth;
|
// var width = size != null ? size.Width : DefaultWidth;
|
||||||
// var height = size != null ? size.Height : DefaultHeight;
|
// var height = size != null ? size.Height : DefaultHeight;
|
||||||
// if ((info != null) && info.IsPreviewing)
|
// if ((info != null) && info.IsPreviewing)
|
||||||
// {
|
// {
|
||||||
// if ((width != info.CurrentWidth) || (height != info.CurrentHeight))
|
// if ((width != info.CurrentWidth) || (height != info.CurrentHeight))
|
||||||
// { // 解像度が変更になるとき
|
// { // 解像度が変更になるとき
|
||||||
// StopPreview(info.DeviceName);
|
// StopPreview(info.DeviceName);
|
||||||
// StartPreview(info.DeviceName, width, height);
|
// StartPreview(info.DeviceName, width, height);
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private void StartPreview(UVCDevice device)
|
private void StartPreview(UVCDevice device)
|
||||||
{
|
{
|
||||||
var info = CreateIfNotExist(device);
|
var info = CreateIfNotExist(device);
|
||||||
if ((info != null) && !info.IsPreviewing) {
|
if ((info != null) && !info.IsPreviewing)
|
||||||
|
{
|
||||||
|
|
||||||
int width = DefaultWidth;
|
int width = DefaultWidth;
|
||||||
int height = DefaultHeight;
|
int height = DefaultHeight;
|
||||||
|
|
||||||
// var supportedVideoSize = GetSupportedVideoSize(deviceName);
|
// var supportedVideoSize = GetSupportedVideoSize(deviceName);
|
||||||
// if (supportedVideoSize == null)
|
// if (supportedVideoSize == null)
|
||||||
// {
|
// {
|
||||||
// throw new ArgumentException("fauled to get supported video size");
|
// throw new ArgumentException("fauled to get supported video size");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // 解像度の選択処理
|
// // 解像度の選択処理
|
||||||
// if ((UVCDrawers != null) && (UVCDrawers.Length > 0))
|
// if ((UVCDrawers != null) && (UVCDrawers.Length > 0))
|
||||||
// {
|
// {
|
||||||
// foreach (var drawer in UVCDrawers)
|
// foreach (var drawer in UVCDrawers)
|
||||||
// {
|
// {
|
||||||
// if ((drawer is IUVCDrawer) && ((drawer as IUVCDrawer).CanDraw(this, info.device)))
|
// if ((drawer is IUVCDrawer) && ((drawer as IUVCDrawer).CanDraw(this, info.device)))
|
||||||
// {
|
// {
|
||||||
// var size = (drawer as IUVCDrawer).OnUVCSelectSize(this, info.device, supportedVideoSize);
|
// var size = (drawer as IUVCDrawer).OnUVCSelectSize(this, info.device, supportedVideoSize);
|
||||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
// Console.WriteLine($"{TAG}StartPreview:selected={size}");
|
// Debug.Log($"{TAG}StartPreview:selected={size}");
|
||||||
//#endif
|
//#endif
|
||||||
// if (size != null)
|
// if (size != null)
|
||||||
// { // 一番最初に見つかった描画可能なIUVCDrawersがnull以外を返せばそれを使う
|
// { // 一番最初に見つかった描画可能なIUVCDrawersがnull以外を返せばそれを使う
|
||||||
// width = size.Width;
|
// width = size.Width;
|
||||||
// height = size.Height;
|
// height = size.Height;
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// FIXME 対応解像度の確認処理
|
// FIXME 対応解像度の確認処理
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}StartPreview:({width}x{height}),id={device.id}");
|
Debug.Log($"{TAG}StartPreview:({width}x{height}),id={device.id}");
|
||||||
#endif
|
#endif
|
||||||
int[] frameTypes = {
|
int[] frameTypes = {
|
||||||
PreferH264 ? FRAME_TYPE_H264 : FRAME_TYPE_MJPEG,
|
PreferH264 ? FRAME_TYPE_H264 : FRAME_TYPE_MJPEG,
|
||||||
|
@ -436,7 +441,7 @@ namespace Serenegiant.UVC
|
||||||
mainContext.Post(__ =>
|
mainContext.Post(__ =>
|
||||||
{ // テクスチャの生成はメインスレッドで行わないといけない
|
{ // テクスチャの生成はメインスレッドで行わないといけない
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}映像受け取り用テクスチャ生成:({width}x{height})");
|
Debug.Log($"{TAG}映像受け取り用テクスチャ生成:({width}x{height})");
|
||||||
#endif
|
#endif
|
||||||
Texture2D tex = new Texture2D(
|
Texture2D tex = new Texture2D(
|
||||||
width, height,
|
width, height,
|
||||||
|
@ -454,7 +459,8 @@ namespace Serenegiant.UVC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopPreview(UVCDevice device) {
|
private void StopPreview(UVCDevice device)
|
||||||
|
{
|
||||||
var info = Get(device);
|
var info = Get(device);
|
||||||
if ((info != null) && info.IsPreviewing)
|
if ((info != null) && info.IsPreviewing)
|
||||||
{
|
{
|
||||||
|
@ -470,7 +476,8 @@ namespace Serenegiant.UVC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void StopAll() {
|
public void StopAll()
|
||||||
|
{
|
||||||
List<CameraInfo> values = new List<CameraInfo>(cameraInfos.Values);
|
List<CameraInfo> values = new List<CameraInfo>(cameraInfos.Values);
|
||||||
foreach (var info in values)
|
foreach (var info in values)
|
||||||
{
|
{
|
||||||
|
@ -493,6 +500,7 @@ namespace Serenegiant.UVC
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool hasDrawer = false;
|
bool hasDrawer = false;
|
||||||
|
Debug.LogWarning("UVCDrawers: " + UVCDrawers.Length);
|
||||||
foreach (var drawer in UVCDrawers)
|
foreach (var drawer in UVCDrawers)
|
||||||
{
|
{
|
||||||
if (drawer is IUVCDrawer)
|
if (drawer is IUVCDrawer)
|
||||||
|
@ -534,7 +542,7 @@ namespace Serenegiant.UVC
|
||||||
void HandleOnStartPreviewEvent(CameraInfo info)
|
void HandleOnStartPreviewEvent(CameraInfo info)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStartPreviewEvent:({info})");
|
Debug.Log($"{TAG}HandleOnStartPreviewEvent:({info})");
|
||||||
#endif
|
#endif
|
||||||
if ((info != null) && info.IsPreviewing && (UVCDrawers != null))
|
if ((info != null) && info.IsPreviewing && (UVCDrawers != null))
|
||||||
{
|
{
|
||||||
|
@ -545,9 +553,11 @@ namespace Serenegiant.UVC
|
||||||
(drawer as IUVCDrawer).OnUVCStartEvent(this, info.device, info.previewTexture);
|
(drawer as IUVCDrawer).OnUVCStartEvent(this, info.device, info.previewTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStartPreviewEvent:No UVCDrawers");
|
Debug.Log($"{TAG}HandleOnStartPreviewEvent:No UVCDrawers");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,7 +569,7 @@ namespace Serenegiant.UVC
|
||||||
void HandleOnStopPreviewEvent(CameraInfo info)
|
void HandleOnStopPreviewEvent(CameraInfo info)
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}HandleOnStopPreviewEvent:({info})");
|
Debug.Log($"{TAG}HandleOnStopPreviewEvent:({info})");
|
||||||
#endif
|
#endif
|
||||||
if (UVCDrawers != null)
|
if (UVCDrawers != null)
|
||||||
{
|
{
|
||||||
|
@ -610,14 +620,14 @@ namespace Serenegiant.UVC
|
||||||
private IEnumerator Initialize()
|
private IEnumerator Initialize()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}Initialize:");
|
Debug.Log($"{TAG}Initialize:");
|
||||||
#endif
|
#endif
|
||||||
if (AndroidUtils.CheckAndroidVersion(28))
|
if (AndroidUtils.CheckAndroidVersion(28))
|
||||||
{
|
{
|
||||||
yield return AndroidUtils.GrantCameraPermission((string permission, AndroidUtils.PermissionGrantResult result) =>
|
yield return AndroidUtils.GrantCameraPermission((string permission, AndroidUtils.PermissionGrantResult result) =>
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}OnPermission:{permission}={result}");
|
Debug.Log($"{TAG}OnPermission:{permission}={result}");
|
||||||
#endif
|
#endif
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
@ -651,7 +661,7 @@ namespace Serenegiant.UVC
|
||||||
private void InitPlugin()
|
private void InitPlugin()
|
||||||
{
|
{
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}InitPlugin:");
|
Debug.Log($"{TAG}InitPlugin:");
|
||||||
#endif
|
#endif
|
||||||
// IUVCDrawersが割り当てられているかどうかをチェック
|
// IUVCDrawersが割り当てられているかどうかをチェック
|
||||||
var hasDrawer = false;
|
var hasDrawer = false;
|
||||||
|
@ -670,12 +680,19 @@ namespace Serenegiant.UVC
|
||||||
{ // インスペクタでIUVCDrawerが設定されていないときは
|
{ // インスペクタでIUVCDrawerが設定されていないときは
|
||||||
// このスクリプトがaddされているゲームオブジェクトからの取得を試みる
|
// このスクリプトがaddされているゲームオブジェクトからの取得を試みる
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}InitPlugin:has no IUVCDrawer, try to get from gameObject");
|
Debug.Log($"{TAG}InitPlugin:has no IUVCDrawer, try to get from gameObject");
|
||||||
#endif
|
#endif
|
||||||
var drawers = GetComponents(typeof(IUVCDrawer));
|
var objs = FindObjectsByType<CameraCaptureManagerBase>(FindObjectsSortMode.None);
|
||||||
if ((drawers != null) && (drawers.Length > 0))
|
List<Component> drawers = new List<Component>();
|
||||||
|
foreach (var obj in objs)
|
||||||
{
|
{
|
||||||
UVCDrawers = new Component[drawers.Length];
|
drawers.AddRange(obj.GetComponents(typeof(IUVCDrawer)));
|
||||||
|
|
||||||
|
}
|
||||||
|
Debug.LogWarning("drawers: " + drawers.Count);
|
||||||
|
if ((drawers != null) && (drawers.Count > 0))
|
||||||
|
{
|
||||||
|
UVCDrawers = new Component[drawers.Count];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var drawer in drawers)
|
foreach (var drawer in drawers)
|
||||||
{
|
{
|
||||||
|
@ -684,7 +701,7 @@ namespace Serenegiant.UVC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||||
Console.WriteLine($"{TAG}InitPlugin:num drawers={UVCDrawers.Length}");
|
Debug.Log($"{TAG}InitPlugin:num drawers={UVCDrawers.Length}");
|
||||||
#endif
|
#endif
|
||||||
// aandusbのDeviceDetectorを読み込み要求
|
// aandusbのDeviceDetectorを読み込み要求
|
||||||
using (AndroidJavaClass clazz = new AndroidJavaClass(FQCN_DETECTOR))
|
using (AndroidJavaClass clazz = new AndroidJavaClass(FQCN_DETECTOR))
|
||||||
|
@ -710,12 +727,12 @@ namespace Serenegiant.UVC
|
||||||
/**
|
/**
|
||||||
* 映像取得開始
|
* 映像取得開始
|
||||||
*/
|
*/
|
||||||
[DllImport("unityuvcplugin", EntryPoint ="Start")]
|
[DllImport("unityuvcplugin", EntryPoint = "Start")]
|
||||||
private static extern Int32 Start(Int32 deviceId, Int32 tex);
|
private static extern Int32 Start(Int32 deviceId, Int32 tex);
|
||||||
/**
|
/**
|
||||||
* 映像取得終了
|
* 映像取得終了
|
||||||
*/
|
*/
|
||||||
[DllImport("unityuvcplugin", EntryPoint ="Stop")]
|
[DllImport("unityuvcplugin", EntryPoint = "Stop")]
|
||||||
private static extern Int32 Stop(Int32 deviceId);
|
private static extern Int32 Stop(Int32 deviceId);
|
||||||
/**
|
/**
|
||||||
* 映像サイズ設定
|
* 映像サイズ設定
|
||||||
|
@ -756,7 +773,7 @@ namespace Serenegiant.UVC
|
||||||
{
|
{
|
||||||
Int32 id = manager.GetHashCode();
|
Int32 id = manager.GetHashCode();
|
||||||
OnDeviceChangedFunc callback = new OnDeviceChangedFunc(OnDeviceChanged);
|
OnDeviceChangedFunc callback = new OnDeviceChangedFunc(OnDeviceChanged);
|
||||||
sManagers.Add(id, manager);
|
sManagers[id] = manager;
|
||||||
Register(id, callback);
|
Register(id, callback);
|
||||||
return callback;
|
return callback;
|
||||||
}
|
}
|
||||||
|
@ -777,6 +794,7 @@ namespace Serenegiant.UVC
|
||||||
var manager = sManagers.ContainsKey(id) ? sManagers[id] : null;
|
var manager = sManagers.ContainsKey(id) ? sManagers[id] : null;
|
||||||
if (manager != null)
|
if (manager != null)
|
||||||
{
|
{
|
||||||
|
Debug.Log($"OnDeviceChanged{id} attached:{attached}");
|
||||||
manager.OnDeviceChanged(devicePtr, attached);
|
manager.OnDeviceChanged(devicePtr, attached);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue