update 1.1.2
This commit is contained in:
Родитель
d3fa3221c2
Коммит
cbd94e10bd
|
@ -14,7 +14,7 @@ namespace MarkerLessARExample
|
|||
/// <summary>
|
||||
/// Pattern capture.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(WebCamTextureToMatHelper))]
|
||||
[RequireComponent(typeof(MultiSource2MatHelper))]
|
||||
public class CapturePattern : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -28,9 +28,9 @@ namespace MarkerLessARExample
|
|||
Texture2D texture;
|
||||
|
||||
/// <summary>
|
||||
/// The webcam texture to mat helper.
|
||||
/// The multi source to mat helper.
|
||||
/// </summary>
|
||||
WebCamTextureToMatHelper webCamTextureToMatHelper;
|
||||
MultiSource2MatHelper multiSource2MatHelper;
|
||||
|
||||
/// <summary>
|
||||
/// The pattern rect.
|
||||
|
@ -57,6 +57,11 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
MatOfKeyPoint keypoints;
|
||||
|
||||
/// <summary>
|
||||
/// The FPS monitor.
|
||||
/// </summary>
|
||||
FpsMonitor fpsMonitor;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
@ -83,9 +88,9 @@ namespace MarkerLessARExample
|
|||
}
|
||||
}
|
||||
|
||||
webCamTextureToMatHelper = gameObject.GetComponent<WebCamTextureToMatHelper>();
|
||||
|
||||
webCamTextureToMatHelper.Initialize();
|
||||
multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
|
||||
multiSource2MatHelper.outputColorFormat = Source2MatHelperColorFormat.RGBA;
|
||||
multiSource2MatHelper.Initialize();
|
||||
|
||||
detector = ORB.create();
|
||||
detector.setMaxFeatures(1000);
|
||||
|
@ -93,27 +98,29 @@ namespace MarkerLessARExample
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper initialized event.
|
||||
/// Raises the source to mat helper initialized event.
|
||||
/// </summary>
|
||||
public void OnWebCamTextureToMatHelperInitialized()
|
||||
public void OnSourceToMatHelperInitialized()
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperInitialized");
|
||||
Debug.Log("OnSourceToMatHelperInitialized");
|
||||
|
||||
|
||||
Mat webCamTextureMat = webCamTextureToMatHelper.GetMat();
|
||||
Mat rgbaMat = multiSource2MatHelper.GetMat();
|
||||
|
||||
texture = new Texture2D(webCamTextureMat.width(), webCamTextureMat.height(), TextureFormat.RGB24, false);
|
||||
rgbMat = new Mat(webCamTextureMat.rows(), webCamTextureMat.cols(), CvType.CV_8UC3);
|
||||
outputMat = new Mat(webCamTextureMat.rows(), webCamTextureMat.cols(), CvType.CV_8UC3);
|
||||
texture = new Texture2D(rgbaMat.width(), rgbaMat.height(), TextureFormat.RGB24, false);
|
||||
rgbMat = new Mat(rgbaMat.rows(), rgbaMat.cols(), CvType.CV_8UC3);
|
||||
outputMat = new Mat(rgbaMat.rows(), rgbaMat.cols(), CvType.CV_8UC3);
|
||||
|
||||
gameObject.transform.localScale = new Vector3(webCamTextureMat.width(), webCamTextureMat.height(), 1);
|
||||
// Set the Texture2D as the main texture of the Renderer component attached to the game object
|
||||
gameObject.GetComponent<Renderer>().material.mainTexture = texture;
|
||||
|
||||
// Adjust the scale of the game object to match the dimensions of the texture
|
||||
gameObject.transform.localScale = new Vector3(rgbaMat.width(), rgbaMat.height(), 1);
|
||||
Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
|
||||
|
||||
|
||||
float width = webCamTextureMat.width();
|
||||
float height = webCamTextureMat.height();
|
||||
|
||||
// Adjust the orthographic size of the main Camera to fit the aspect ratio of the image
|
||||
float width = rgbaMat.width();
|
||||
float height = rgbaMat.height();
|
||||
float widthScale = (float)Screen.width / width;
|
||||
float heightScale = (float)Screen.height / height;
|
||||
if (widthScale < heightScale)
|
||||
|
@ -125,27 +132,23 @@ namespace MarkerLessARExample
|
|||
Camera.main.orthographicSize = height / 2;
|
||||
}
|
||||
|
||||
gameObject.GetComponent<Renderer>().material.mainTexture = texture;
|
||||
|
||||
// If the WebCam is front facing, flip the Mat horizontally. Required for successful detection.
|
||||
if (multiSource2MatHelper.source2MatHelper is WebCamTexture2MatHelper webCamHelper)
|
||||
webCamHelper.flipHorizontal = webCamHelper.IsFrontFacing();
|
||||
|
||||
|
||||
//if WebCamera is frontFaceing,flip Mat.
|
||||
if (webCamTextureToMatHelper.GetWebCamDevice().isFrontFacing)
|
||||
{
|
||||
webCamTextureToMatHelper.flipHorizontal = true;
|
||||
}
|
||||
int patternWidth = (int)(Mathf.Min(rgbaMat.width(), rgbaMat.height()) * 0.8f);
|
||||
|
||||
|
||||
int patternWidth = (int)(Mathf.Min(webCamTextureMat.width(), webCamTextureMat.height()) * 0.8f);
|
||||
|
||||
patternRect = new OpenCVForUnity.CoreModule.Rect(webCamTextureMat.width() / 2 - patternWidth / 2, webCamTextureMat.height() / 2 - patternWidth / 2, patternWidth, patternWidth);
|
||||
patternRect = new OpenCVForUnity.CoreModule.Rect(rgbaMat.width() / 2 - patternWidth / 2, rgbaMat.height() / 2 - patternWidth / 2, patternWidth, patternWidth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper disposed event.
|
||||
/// Raises the source to mat helper disposed event.
|
||||
/// </summary>
|
||||
public void OnWebCamTextureToMatHelperDisposed()
|
||||
public void OnSourceToMatHelperDisposed()
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperDisposed");
|
||||
Debug.Log("OnSourceToMatHelperDisposed");
|
||||
|
||||
if (rgbMat != null)
|
||||
{
|
||||
|
@ -158,20 +161,26 @@ namespace MarkerLessARExample
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper error occurred event.
|
||||
/// Raises the source to mat helper error occurred event.
|
||||
/// </summary>
|
||||
/// <param name="errorCode">Error code.</param>
|
||||
public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode)
|
||||
/// <param name="message">Message.</param>
|
||||
public void OnSourceToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message)
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
|
||||
Debug.Log("OnSourceToMatHelperErrorOccurred " + errorCode + ":" + message);
|
||||
|
||||
if (fpsMonitor != null)
|
||||
{
|
||||
fpsMonitor.consoleText = "ErrorCode: " + errorCode + ":" + message;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
|
||||
if (multiSource2MatHelper.IsPlaying() && multiSource2MatHelper.DidUpdateThisFrame())
|
||||
{
|
||||
Mat rgbaMat = webCamTextureToMatHelper.GetMat();
|
||||
Mat rgbaMat = multiSource2MatHelper.GetMat();
|
||||
|
||||
Imgproc.cvtColor(rgbaMat, rgbMat, Imgproc.COLOR_RGBA2RGB);
|
||||
Imgproc.cvtColor(rgbaMat, outputMat, Imgproc.COLOR_RGBA2RGB);
|
||||
|
@ -183,7 +192,7 @@ namespace MarkerLessARExample
|
|||
|
||||
Imgproc.rectangle(rgbMat, patternRect.tl(), patternRect.br(), new Scalar(255, 0, 0, 255), 5);
|
||||
|
||||
Utils.fastMatToTexture2D(rgbMat, texture);
|
||||
Utils.matToTexture2D(rgbMat, texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +201,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
void OnDestroy()
|
||||
{
|
||||
webCamTextureToMatHelper.Dispose();
|
||||
multiSource2MatHelper.Dispose();
|
||||
|
||||
detector.Dispose();
|
||||
if (keypoints != null)
|
||||
|
@ -214,7 +223,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnPlayButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Play();
|
||||
multiSource2MatHelper.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -222,7 +231,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnPauseButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Pause();
|
||||
multiSource2MatHelper.Pause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -230,7 +239,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnStopButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Stop();
|
||||
multiSource2MatHelper.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -238,7 +247,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnChangeCameraButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing();
|
||||
multiSource2MatHelper.requestedIsFrontFacing = !multiSource2MatHelper.requestedIsFrontFacing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -283,11 +292,11 @@ namespace MarkerLessARExample
|
|||
|
||||
if (GraphicsSettings.defaultRenderPipeline == null)
|
||||
{
|
||||
SceneManager.LoadScene("WebCamTextureMarkerLessARExample_Built-in");
|
||||
SceneManager.LoadScene("MultiSourceMarkerLessARExample_Built-in");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("WebCamTextureMarkerLessARExample_SRP");
|
||||
SceneManager.LoadScene("MultiSourceMarkerLessARExample_SRP");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 654080877}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -316,6 +317,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 2113186859}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -474,6 +476,7 @@ RectTransform:
|
|||
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: 1447707945}
|
||||
m_RootOrder: 0
|
||||
|
@ -556,6 +559,7 @@ RectTransform:
|
|||
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: 1592116328}
|
||||
m_RootOrder: 5
|
||||
|
@ -618,6 +622,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 665656285}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -834,6 +839,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
|
@ -868,6 +874,7 @@ RectTransform:
|
|||
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: 934912248}
|
||||
m_RootOrder: 0
|
||||
|
@ -951,6 +958,7 @@ RectTransform:
|
|||
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: 871800087}
|
||||
m_RootOrder: 0
|
||||
|
@ -1034,6 +1042,7 @@ RectTransform:
|
|||
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: 138603723}
|
||||
m_RootOrder: 0
|
||||
|
@ -1117,6 +1126,7 @@ RectTransform:
|
|||
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: 450047694}
|
||||
m_RootOrder: 0
|
||||
|
@ -1202,6 +1212,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 621619342}
|
||||
m_Father: {fileID: 1649355747}
|
||||
|
@ -1480,6 +1491,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 614553145}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -1522,6 +1534,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
|
@ -1556,6 +1569,7 @@ Transform:
|
|||
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: 0}
|
||||
m_RootOrder: 3
|
||||
|
@ -1592,6 +1606,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1781641915}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -1748,6 +1763,7 @@ RectTransform:
|
|||
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: 1649355747}
|
||||
m_RootOrder: 2
|
||||
|
@ -1824,6 +1840,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 355999108}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -1967,7 +1984,7 @@ GameObject:
|
|||
- component: {fileID: 1499518483}
|
||||
- component: {fileID: 1499518484}
|
||||
m_Layer: 0
|
||||
m_Name: Quad
|
||||
m_Name: CapturePattern
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -1984,6 +2001,7 @@ MeshRenderer:
|
|||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
|
@ -2046,6 +2064,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1024, y: 1024, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
@ -2072,25 +2091,30 @@ MonoBehaviour:
|
|||
m_GameObject: {fileID: 1499518478}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: e564a549956aebc4d9acef3ff91b0981, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_requestedSource2MatHelperClassName: 0
|
||||
_currentSource2MatHelperClassCategory: 0
|
||||
_requestedDeviceName:
|
||||
_requestedWidth: 640
|
||||
_requestedHeight: 480
|
||||
_requestedIsFrontFacing: 0
|
||||
_requestedFPS: 30
|
||||
_rotate90Degree: 0
|
||||
_flipVertical: 0
|
||||
_flipHorizontal: 0
|
||||
_requestedVideoFilePath:
|
||||
_loop: 1
|
||||
_requestedImageFilePath:
|
||||
_repeat: 1
|
||||
_sourceTexture: {fileID: 0}
|
||||
_customClassComponent: {fileID: 0}
|
||||
_outputColorFormat: 3
|
||||
_timeoutFrameCount: 300
|
||||
onInitialized:
|
||||
_timeoutFrameCount: 1500
|
||||
_onInitialized:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperInitialized
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.CapturePattern, Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperInitialized
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2100,12 +2124,12 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onDisposed:
|
||||
_onDisposed:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperDisposed
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.CapturePattern, Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperDisposed
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2115,12 +2139,12 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onErrorOccurred:
|
||||
_onErrorOccurred:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperErrorOccurred
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.CapturePattern, Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperErrorOccurred
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2130,7 +2154,6 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
avoidAndroidFrontCameraLowLightIssue: 0
|
||||
--- !u!1 &1592116327
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2160,6 +2183,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1447707945}
|
||||
- {fileID: 138603723}
|
||||
|
@ -2234,6 +2258,7 @@ RectTransform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1592116328}
|
||||
- {fileID: 871800087}
|
||||
|
@ -2306,6 +2331,7 @@ Canvas:
|
|||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
|
@ -2340,6 +2366,7 @@ RectTransform:
|
|||
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: 1192632200}
|
||||
m_RootOrder: 0
|
||||
|
@ -2423,6 +2450,7 @@ RectTransform:
|
|||
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: 199499326}
|
||||
m_RootOrder: 0
|
||||
|
|
|
@ -83,15 +83,15 @@ namespace MarkerLessARExample
|
|||
}
|
||||
}
|
||||
|
||||
public void OnWebCamTextureMarkerLessARExampleButtonClick()
|
||||
public void OnMultiSourceMarkerLessARExampleButtonClick()
|
||||
{
|
||||
if (GraphicsSettings.defaultRenderPipeline == null)
|
||||
{
|
||||
SceneManager.LoadScene("WebCamTextureMarkerLessARExample_Built-in");
|
||||
SceneManager.LoadScene("MultiSourceMarkerLessARExample_Built-in");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("WebCamTextureMarkerLessARExample_SRP");
|
||||
SceneManager.LoadScene("MultiSourceMarkerLessARExample_SRP");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,6 +154,7 @@ RectTransform:
|
|||
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: 1881272951}
|
||||
m_RootOrder: 0
|
||||
|
@ -292,6 +293,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
@ -340,6 +342,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 621508186}
|
||||
- {fileID: 691428507}
|
||||
|
@ -386,7 +389,7 @@ GameObject:
|
|||
- component: {fileID: 130009891}
|
||||
- component: {fileID: 130009890}
|
||||
m_Layer: 5
|
||||
m_Name: WebCamTextureMarkerLessARExampleButton
|
||||
m_Name: MultiSourceMarkerLessARExampleButton
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -403,6 +406,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1084706037}
|
||||
m_Father: {fileID: 2020746267}
|
||||
|
@ -480,8 +484,8 @@ MonoBehaviour:
|
|||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 29440833}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureMarkerLessARExampleButtonClick
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.MarkerLessARExample, Assembly-CSharp
|
||||
m_MethodName: OnMultiSourceMarkerLessARExampleButtonClick
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -563,6 +567,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 2020746267}
|
||||
m_Father: {fileID: 117588964}
|
||||
|
@ -689,6 +694,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1881272951}
|
||||
m_Father: {fileID: 117588964}
|
||||
|
@ -816,6 +822,7 @@ RectTransform:
|
|||
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: 2020746267}
|
||||
m_RootOrder: 1
|
||||
|
@ -876,6 +883,7 @@ RectTransform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1860947413}
|
||||
m_Father: {fileID: 0}
|
||||
|
@ -946,6 +954,7 @@ Canvas:
|
|||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
|
@ -980,6 +989,7 @@ RectTransform:
|
|||
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: 130009889}
|
||||
m_RootOrder: 0
|
||||
|
@ -1023,7 +1033,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: WebCamTexture MarkerLess AR Example
|
||||
m_Text: MultiSource MarkerLess AR Example
|
||||
--- !u!222 &1084706039
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1065,6 +1075,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1353284453}
|
||||
m_Father: {fileID: 2020746267}
|
||||
|
@ -1223,6 +1234,7 @@ RectTransform:
|
|||
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: 1205192102}
|
||||
m_RootOrder: 0
|
||||
|
@ -1346,6 +1358,7 @@ RectTransform:
|
|||
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: 1860947413}
|
||||
m_RootOrder: 1
|
||||
|
@ -1382,6 +1395,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 2088230833}
|
||||
- {fileID: 1530287820}
|
||||
|
@ -1452,6 +1466,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1869573383}
|
||||
m_Father: {fileID: 2020746267}
|
||||
|
@ -1610,6 +1625,7 @@ RectTransform:
|
|||
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: 1867454787}
|
||||
m_RootOrder: 0
|
||||
|
@ -1691,6 +1707,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 525383}
|
||||
m_Father: {fileID: 691428507}
|
||||
|
@ -1733,6 +1750,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
|
@ -1767,6 +1785,7 @@ Transform:
|
|||
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: 0}
|
||||
m_RootOrder: 2
|
||||
|
@ -1801,6 +1820,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1205192102}
|
||||
- {fileID: 931819284}
|
||||
|
@ -1926,6 +1946,7 @@ RectTransform:
|
|||
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: 1860947413}
|
||||
m_RootOrder: 0
|
||||
|
|
|
@ -12,11 +12,11 @@ using UnityEngine.UI;
|
|||
namespace MarkerLessARExample
|
||||
{
|
||||
/// <summary>
|
||||
/// WebCamTexture Markerless AR Example
|
||||
/// MultiSource Markerless AR Example
|
||||
/// This code is a rewrite of https://github.com/MasteringOpenCV/code/tree/master/Chapter3_MarkerlessAR using "OpenCV for Unity".
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(WebCamTextureToMatHelper))]
|
||||
public class WebCamTextureMarkerLessARExample : MonoBehaviour
|
||||
[RequireComponent(typeof(MultiSource2MatHelper))]
|
||||
public class MultiSourceMarkerLessARExample : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// The pattern texture.
|
||||
|
@ -104,9 +104,9 @@ namespace MarkerLessARExample
|
|||
Texture2D texture;
|
||||
|
||||
/// <summary>
|
||||
/// The webcam texture to mat helper.
|
||||
/// The multi source to mat helper.
|
||||
/// </summary>
|
||||
WebCamTextureToMatHelper webCamTextureToMatHelper;
|
||||
MultiSource2MatHelper multiSource2MatHelper;
|
||||
|
||||
/// <summary>
|
||||
/// The gray mat.
|
||||
|
@ -148,6 +148,11 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
PatternDetector patternDetector;
|
||||
|
||||
/// <summary>
|
||||
/// The FPS monitor.
|
||||
/// </summary>
|
||||
FpsMonitor fpsMonitor;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
@ -160,8 +165,8 @@ namespace MarkerLessARExample
|
|||
|
||||
ARGameObject.gameObject.SetActive(false);
|
||||
|
||||
webCamTextureToMatHelper = gameObject.GetComponent<WebCamTextureToMatHelper>();
|
||||
|
||||
multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
|
||||
multiSource2MatHelper.outputColorFormat = Source2MatHelperColorFormat.RGBA;
|
||||
|
||||
if (patternTexture != null)
|
||||
{
|
||||
|
@ -205,9 +210,9 @@ namespace MarkerLessARExample
|
|||
{
|
||||
patternDetector.train(pattern);
|
||||
|
||||
webCamTextureToMatHelper.Initialize();
|
||||
multiSource2MatHelper.Initialize();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Debug.LogError("Input image could not be used as pattern image due to missing keypoints.");
|
||||
}
|
||||
|
@ -215,29 +220,27 @@ namespace MarkerLessARExample
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper initialized event.
|
||||
/// Raises the source to mat helper initialized event.
|
||||
/// </summary>
|
||||
public void OnWebCamTextureToMatHelperInitialized()
|
||||
public void OnSourceToMatHelperInitialized()
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperInitialized");
|
||||
Debug.Log("OnSourceToMatHelperInitialized");
|
||||
|
||||
Mat webCamTextureMat = webCamTextureToMatHelper.GetMat();
|
||||
Mat rgbaMat = multiSource2MatHelper.GetMat();
|
||||
|
||||
texture = new Texture2D(webCamTextureMat.width(), webCamTextureMat.height(), TextureFormat.RGBA32, false);
|
||||
texture = new Texture2D(rgbaMat.width(), rgbaMat.height(), TextureFormat.RGBA32, false);
|
||||
grayMat = new Mat(rgbaMat.rows(), rgbaMat.cols(), CvType.CV_8UC1);
|
||||
|
||||
// Set the Texture2D as the main texture of the Renderer component attached to the game object
|
||||
gameObject.GetComponent<Renderer>().material.mainTexture = texture;
|
||||
|
||||
|
||||
grayMat = new Mat(webCamTextureMat.rows(), webCamTextureMat.cols(), CvType.CV_8UC1);
|
||||
|
||||
|
||||
gameObject.transform.localScale = new Vector3(webCamTextureMat.width(), webCamTextureMat.height(), 1);
|
||||
|
||||
// Adjust the scale of the game object to match the dimensions of the texture
|
||||
gameObject.transform.localScale = new Vector3(rgbaMat.width(), rgbaMat.height(), 1);
|
||||
Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
|
||||
|
||||
|
||||
float width = webCamTextureMat.width();
|
||||
float height = webCamTextureMat.height();
|
||||
|
||||
// Adjust the orthographic size of the main Camera to fit the aspect ratio of the image
|
||||
float width = rgbaMat.width();
|
||||
float height = rgbaMat.height();
|
||||
float imageSizeScale = 1.0f;
|
||||
float widthScale = (float)Screen.width / width;
|
||||
float heightScale = (float)Screen.height / height;
|
||||
|
@ -323,37 +326,44 @@ namespace MarkerLessARExample
|
|||
Debug.Log("invertZM " + invertZM.ToString());
|
||||
|
||||
|
||||
//if WebCamera is frontFaceing,flip Mat.
|
||||
webCamTextureToMatHelper.flipHorizontal = webCamTextureToMatHelper.GetWebCamDevice().isFrontFacing;
|
||||
// If the WebCam is front facing, flip the Mat horizontally. Required for successful detection.
|
||||
if (multiSource2MatHelper.source2MatHelper is WebCamTexture2MatHelper webCamHelper)
|
||||
webCamHelper.flipHorizontal = webCamHelper.IsFrontFacing();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper disposed event.
|
||||
/// Raises the source to mat helper disposed event.
|
||||
/// </summary>
|
||||
public void OnWebCamTextureToMatHelperDisposed()
|
||||
public void OnSourceToMatHelperDisposed()
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperDisposed");
|
||||
Debug.Log("OnSourceToMatHelperDisposed");
|
||||
|
||||
if (grayMat != null)
|
||||
grayMat.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper error occurred event.
|
||||
/// Raises the source to mat helper error occurred event.
|
||||
/// </summary>
|
||||
/// <param name="errorCode">Error code.</param>
|
||||
public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode)
|
||||
/// <param name="message">Message.</param>
|
||||
public void OnSourceToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message)
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
|
||||
Debug.Log("OnSourceToMatHelperErrorOccurred " + errorCode + ":" + message);
|
||||
|
||||
if (fpsMonitor != null)
|
||||
{
|
||||
fpsMonitor.consoleText = "ErrorCode: " + errorCode + ":" + message;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
|
||||
if (multiSource2MatHelper.IsPlaying() && multiSource2MatHelper.DidUpdateThisFrame())
|
||||
{
|
||||
|
||||
Mat rgbaMat = webCamTextureToMatHelper.GetMat();
|
||||
Mat rgbaMat = multiSource2MatHelper.GetMat();
|
||||
|
||||
Imgproc.cvtColor(rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY);
|
||||
|
||||
|
@ -400,7 +410,7 @@ namespace MarkerLessARExample
|
|||
ARGameObject.GetComponent<DelayableSetActive>().SetActive(false, 0.5f);
|
||||
}
|
||||
|
||||
Utils.fastMatToTexture2D(rgbaMat, texture);
|
||||
Utils.matToTexture2D(rgbaMat, texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,7 +419,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
void OnDestroy()
|
||||
{
|
||||
webCamTextureToMatHelper.Dispose();
|
||||
multiSource2MatHelper.Dispose();
|
||||
|
||||
if (patternMat != null)
|
||||
patternMat.Dispose();
|
||||
|
@ -428,7 +438,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnPlayButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Play();
|
||||
multiSource2MatHelper.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -436,7 +446,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnPauseButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Pause();
|
||||
multiSource2MatHelper.Pause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -444,7 +454,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnStopButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Stop();
|
||||
multiSource2MatHelper.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -452,7 +462,7 @@ namespace MarkerLessARExample
|
|||
/// </summary>
|
||||
public void OnChangeCameraButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing();
|
||||
multiSource2MatHelper.requestedIsFrontFacing = !multiSource2MatHelper.requestedIsFrontFacing;
|
||||
}
|
||||
|
||||
/// <summary>
|
|
@ -173,6 +173,7 @@ RectTransform:
|
|||
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: 1977600972}
|
||||
m_RootOrder: 1
|
||||
|
@ -256,6 +257,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 654080877}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -416,6 +418,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 2113186859}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -654,6 +657,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0.9848078, z: -0, w: -0.17364809}
|
||||
m_LocalPosition: {x: 2, y: 0, z: 3}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
|
@ -688,6 +692,7 @@ RectTransform:
|
|||
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: 1447707945}
|
||||
m_RootOrder: 0
|
||||
|
@ -788,6 +793,7 @@ Transform:
|
|||
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:
|
||||
- {fileID: 1801648533}
|
||||
- {fileID: 620936918}
|
||||
|
@ -827,6 +833,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 665656285}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -983,6 +990,7 @@ RectTransform:
|
|||
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: 1883494530}
|
||||
m_RootOrder: 0
|
||||
|
@ -1058,6 +1066,7 @@ RectTransform:
|
|||
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: 1482815189}
|
||||
m_RootOrder: 1
|
||||
|
@ -1197,6 +1206,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
|
@ -1231,6 +1241,7 @@ RectTransform:
|
|||
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: 934912248}
|
||||
m_RootOrder: 0
|
||||
|
@ -1320,6 +1331,7 @@ RectTransform:
|
|||
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: 138603723}
|
||||
m_RootOrder: 0
|
||||
|
@ -1403,6 +1415,7 @@ RectTransform:
|
|||
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: 450047694}
|
||||
m_RootOrder: 0
|
||||
|
@ -1490,6 +1503,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1648377979}
|
||||
- {fileID: 1985951973}
|
||||
|
@ -1610,6 +1624,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1508174469}
|
||||
m_Father: {fileID: 1977600972}
|
||||
|
@ -1715,6 +1730,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 941253126}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -1993,6 +2009,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 614553145}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -2033,6 +2050,7 @@ RectTransform:
|
|||
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: 909783133}
|
||||
m_RootOrder: 0
|
||||
|
@ -2115,6 +2133,7 @@ RectTransform:
|
|||
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: 1592116328}
|
||||
m_RootOrder: 8
|
||||
|
@ -2183,6 +2202,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
|
@ -2217,6 +2237,7 @@ Transform:
|
|||
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: 0}
|
||||
m_RootOrder: 6
|
||||
|
@ -2265,6 +2286,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 355999108}
|
||||
m_Father: {fileID: 1592116328}
|
||||
|
@ -2421,6 +2443,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1883494530}
|
||||
- {fileID: 490734387}
|
||||
|
@ -2526,9 +2549,10 @@ GameObject:
|
|||
- component: {fileID: 1499518480}
|
||||
- component: {fileID: 1499518479}
|
||||
- component: {fileID: 1499518483}
|
||||
- component: {fileID: 1499518485}
|
||||
- component: {fileID: 1499518484}
|
||||
m_Layer: 0
|
||||
m_Name: Quad
|
||||
m_Name: MultiSourceMarkerLessARExample
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -2545,6 +2569,7 @@ MeshRenderer:
|
|||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
|
@ -2607,6 +2632,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1024, y: 1024, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
@ -2647,25 +2673,50 @@ MonoBehaviour:
|
|||
m_GameObject: {fileID: 1499518478}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: f0807ac37acb13a41a354abd1e677fbb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
alignment: 1
|
||||
offset: {x: 10, y: 10}
|
||||
boxVisible: 1
|
||||
boxWidth: 75
|
||||
boxHeight: 30
|
||||
padding: {x: 8, y: 5}
|
||||
consoleHeight: 100
|
||||
--- !u!114 &1499518485
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1499518478}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e564a549956aebc4d9acef3ff91b0981, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_requestedSource2MatHelperClassName: 0
|
||||
_currentSource2MatHelperClassCategory: 0
|
||||
_requestedDeviceName:
|
||||
_requestedWidth: 640
|
||||
_requestedHeight: 480
|
||||
_requestedIsFrontFacing: 0
|
||||
_requestedFPS: 30
|
||||
_rotate90Degree: 0
|
||||
_flipVertical: 0
|
||||
_flipHorizontal: 0
|
||||
_requestedVideoFilePath: MarkerLessARExample/MarkerLessARExample_TestVideo_640_640_30fps.mp4
|
||||
_loop: 1
|
||||
_requestedImageFilePath: MarkerLessARExample/TestImage.jpg
|
||||
_repeat: 1
|
||||
_sourceTexture: {fileID: 0}
|
||||
_customClassComponent: {fileID: 0}
|
||||
_outputColorFormat: 3
|
||||
_timeoutFrameCount: 300
|
||||
onInitialized:
|
||||
_timeoutFrameCount: 1500
|
||||
_onInitialized:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperInitialized
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.MultiSourceMarkerLessARExample,
|
||||
Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperInitialized
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2675,12 +2726,13 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onDisposed:
|
||||
_onDisposed:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperDisposed
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.MultiSourceMarkerLessARExample,
|
||||
Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperDisposed
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2690,12 +2742,13 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onErrorOccurred:
|
||||
_onErrorOccurred:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperErrorOccurred
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.MultiSourceMarkerLessARExample,
|
||||
Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperErrorOccurred
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2705,7 +2758,6 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
avoidAndroidFrontCameraLowLightIssue: 0
|
||||
--- !u!1 &1508174468
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2734,6 +2786,7 @@ RectTransform:
|
|||
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: 758903966}
|
||||
m_RootOrder: 0
|
||||
|
@ -2859,6 +2912,7 @@ Transform:
|
|||
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:
|
||||
- {fileID: 1024130543}
|
||||
- {fileID: 2024975249}
|
||||
|
@ -2908,6 +2962,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1447707945}
|
||||
- {fileID: 138603723}
|
||||
|
@ -3020,6 +3075,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 1739801976}
|
||||
m_Father: {fileID: 749454550}
|
||||
|
@ -3061,6 +3117,7 @@ RectTransform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1592116328}
|
||||
- {fileID: 1756129325}
|
||||
|
@ -3132,6 +3189,7 @@ Canvas:
|
|||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
|
@ -3164,6 +3222,7 @@ RectTransform:
|
|||
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: 1648377979}
|
||||
m_RootOrder: 0
|
||||
|
@ -3274,6 +3333,7 @@ RectTransform:
|
|||
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: 1649355747}
|
||||
m_RootOrder: 1
|
||||
|
@ -3317,6 +3377,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 487579064}
|
||||
m_Father: {fileID: 1482815189}
|
||||
|
@ -3414,6 +3475,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 758903966}
|
||||
- {fileID: 114640989}
|
||||
|
@ -3534,6 +3596,7 @@ RectTransform:
|
|||
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: 749454550}
|
||||
m_RootOrder: 1
|
||||
|
@ -3648,6 +3711,7 @@ RectTransform:
|
|||
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: 199499326}
|
||||
m_RootOrder: 0
|
|
@ -2560,9 +2560,10 @@ GameObject:
|
|||
- component: {fileID: 1499518480}
|
||||
- component: {fileID: 1499518479}
|
||||
- component: {fileID: 1499518483}
|
||||
- component: {fileID: 1499518485}
|
||||
- component: {fileID: 1499518484}
|
||||
m_Layer: 0
|
||||
m_Name: Quad
|
||||
m_Name: MultiSourceMarkerLessARExample
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -2683,25 +2684,50 @@ MonoBehaviour:
|
|||
m_GameObject: {fileID: 1499518478}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: f0807ac37acb13a41a354abd1e677fbb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
alignment: 1
|
||||
offset: {x: 10, y: 10}
|
||||
boxVisible: 1
|
||||
boxWidth: 75
|
||||
boxHeight: 30
|
||||
padding: {x: 8, y: 5}
|
||||
consoleHeight: 100
|
||||
--- !u!114 &1499518485
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1499518478}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e564a549956aebc4d9acef3ff91b0981, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_requestedSource2MatHelperClassName: 0
|
||||
_currentSource2MatHelperClassCategory: 0
|
||||
_requestedDeviceName:
|
||||
_requestedWidth: 640
|
||||
_requestedHeight: 480
|
||||
_requestedIsFrontFacing: 0
|
||||
_requestedFPS: 30
|
||||
_rotate90Degree: 0
|
||||
_flipVertical: 0
|
||||
_flipHorizontal: 0
|
||||
_requestedVideoFilePath: MarkerLessARExample/MarkerLessARExample_TestVideo_640_640_30fps.mp4
|
||||
_loop: 1
|
||||
_requestedImageFilePath: MarkerLessARExample/TestImage.jpg
|
||||
_repeat: 1
|
||||
_sourceTexture: {fileID: 0}
|
||||
_customClassComponent: {fileID: 0}
|
||||
_outputColorFormat: 3
|
||||
_timeoutFrameCount: 300
|
||||
onInitialized:
|
||||
_timeoutFrameCount: 1500
|
||||
_onInitialized:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperInitialized
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.MultiSourceMarkerLessARExample,
|
||||
Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperInitialized
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2711,12 +2737,13 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onDisposed:
|
||||
_onDisposed:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperDisposed
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.MultiSourceMarkerLessARExample,
|
||||
Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperDisposed
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2726,12 +2753,13 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onErrorOccurred:
|
||||
_onErrorOccurred:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1499518483}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName: OnWebCamTextureToMatHelperErrorOccurred
|
||||
m_TargetAssemblyTypeName: MarkerLessARExample.MultiSourceMarkerLessARExample,
|
||||
Assembly-CSharp
|
||||
m_MethodName: OnSourceToMatHelperErrorOccurred
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -2741,7 +2769,6 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
avoidAndroidFrontCameraLowLightIssue: 0
|
||||
--- !u!1 &1508174468
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
Двоичные данные
Assets/MarkerLessARExample/ReadMe.pdf
Двоичные данные
Assets/MarkerLessARExample/ReadMe.pdf
Двоичный файл не отображается.
|
@ -0,0 +1,215 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MarkerLessARExample
|
||||
{
|
||||
// v1.0.2
|
||||
public class FpsMonitor : MonoBehaviour
|
||||
{
|
||||
int tick = 0;
|
||||
float elapsed = 0;
|
||||
float fps = 0;
|
||||
|
||||
public enum Alignment
|
||||
{
|
||||
LeftTop,
|
||||
RightTop,
|
||||
LeftBottom,
|
||||
RightBottom,
|
||||
}
|
||||
|
||||
public Alignment alignment = Alignment.RightTop;
|
||||
|
||||
const float GUI_WIDTH = 75f;
|
||||
const float GUI_HEIGHT = 30f;
|
||||
const float MARGIN_X = 10f;
|
||||
const float MARGIN_Y = 10f;
|
||||
const float INNER_X = 8f;
|
||||
const float INNER_Y = 5f;
|
||||
const float GUI_CONSOLE_HEIGHT = 100f;
|
||||
|
||||
public Vector2 offset = new Vector2(MARGIN_X, MARGIN_Y);
|
||||
public bool boxVisible = true;
|
||||
public float boxWidth = GUI_WIDTH;
|
||||
public float boxHeight = GUI_HEIGHT;
|
||||
public Vector2 padding = new Vector2(INNER_X, INNER_Y);
|
||||
public float consoleHeight = GUI_CONSOLE_HEIGHT;
|
||||
|
||||
GUIStyle console_labelStyle;
|
||||
|
||||
float x, y;
|
||||
Rect outer;
|
||||
Rect inner;
|
||||
|
||||
float console_x, console_y;
|
||||
Rect console_outer;
|
||||
Rect console_inner;
|
||||
|
||||
int oldScrWidth;
|
||||
int oldScrHeight;
|
||||
|
||||
Dictionary<string, string> outputDict = new Dictionary<string, string>();
|
||||
|
||||
protected string _consoleText = null;
|
||||
public virtual string consoleText
|
||||
{
|
||||
get { return _consoleText; }
|
||||
set
|
||||
{
|
||||
_consoleText = value;
|
||||
toast_time = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int toast_time = -1;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
console_labelStyle = new GUIStyle();
|
||||
console_labelStyle.fontSize = 32;
|
||||
console_labelStyle.fontStyle = FontStyle.Normal;
|
||||
console_labelStyle.wordWrap = true;
|
||||
console_labelStyle.normal.textColor = Color.white;
|
||||
|
||||
oldScrWidth = Screen.width;
|
||||
oldScrHeight = Screen.height;
|
||||
LocateGUI();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
tick++;
|
||||
elapsed += Time.deltaTime;
|
||||
if (elapsed >= 1f)
|
||||
{
|
||||
fps = tick / elapsed;
|
||||
tick = 0;
|
||||
elapsed = 0;
|
||||
}
|
||||
|
||||
if (toast_time > 0)
|
||||
{
|
||||
toast_time = toast_time - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (oldScrWidth != Screen.width || oldScrHeight != Screen.height)
|
||||
{
|
||||
LocateGUI();
|
||||
}
|
||||
oldScrWidth = Screen.width;
|
||||
oldScrHeight = Screen.height;
|
||||
|
||||
if (boxVisible)
|
||||
{
|
||||
GUI.Box(outer, "");
|
||||
}
|
||||
|
||||
GUILayout.BeginArea(inner);
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label("fps : " + fps.ToString("F1"));
|
||||
foreach (KeyValuePair<string, string> pair in outputDict)
|
||||
{
|
||||
GUILayout.Label(pair.Key + " : " + pair.Value);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
GUILayout.EndArea();
|
||||
|
||||
if (!string.IsNullOrEmpty(consoleText))
|
||||
{
|
||||
if (toast_time != 0)
|
||||
{
|
||||
if (boxVisible)
|
||||
{
|
||||
GUI.Box(console_outer, "");
|
||||
}
|
||||
|
||||
GUILayout.BeginArea(console_inner);
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(consoleText, console_labelStyle);
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
GUILayout.EndArea();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(string key, string value)
|
||||
{
|
||||
if (outputDict.ContainsKey(key))
|
||||
{
|
||||
outputDict[key] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDict.Add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(string key)
|
||||
{
|
||||
outputDict.Remove(key);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
outputDict.Clear();
|
||||
}
|
||||
|
||||
public void LocateGUI()
|
||||
{
|
||||
x = GetAlignedX(alignment, boxWidth);
|
||||
y = GetAlignedY(alignment, boxHeight);
|
||||
outer = new Rect(x, y, boxWidth, boxHeight);
|
||||
inner = new Rect(x + padding.x, y + padding.y, boxWidth, boxHeight);
|
||||
|
||||
console_x = GetAlignedX(Alignment.LeftBottom, Screen.width);
|
||||
console_y = GetAlignedY(Alignment.LeftBottom, consoleHeight);
|
||||
console_outer = new Rect(console_x, console_y, Screen.width - offset.x * 2, consoleHeight);
|
||||
console_inner = new Rect(console_x + padding.x, console_y + padding.y, Screen.width - offset.x * 2 - padding.x, consoleHeight);
|
||||
}
|
||||
|
||||
public void Toast(string message, int time = 120)
|
||||
{
|
||||
_consoleText = message;
|
||||
toast_time = (time < 60) ? 60 : time;
|
||||
}
|
||||
|
||||
float GetAlignedX(Alignment anchor, float w)
|
||||
{
|
||||
switch (anchor)
|
||||
{
|
||||
default:
|
||||
case Alignment.LeftTop:
|
||||
case Alignment.LeftBottom:
|
||||
return offset.x;
|
||||
|
||||
case Alignment.RightTop:
|
||||
case Alignment.RightBottom:
|
||||
return Screen.width - w - offset.x;
|
||||
}
|
||||
}
|
||||
|
||||
float GetAlignedY(Alignment anchor, float h)
|
||||
{
|
||||
switch (anchor)
|
||||
{
|
||||
default:
|
||||
case Alignment.LeftTop:
|
||||
case Alignment.RightTop:
|
||||
return offset.y;
|
||||
|
||||
case Alignment.LeftBottom:
|
||||
case Alignment.RightBottom:
|
||||
return Screen.height - h - offset.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f0807ac37acb13a41a354abd1e677fbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -156,6 +156,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
|
@ -190,6 +191,7 @@ Transform:
|
|||
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: 0}
|
||||
m_RootOrder: 7
|
||||
|
@ -344,6 +346,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 538633487}
|
||||
m_Father: {fileID: 218001138}
|
||||
|
@ -400,6 +403,7 @@ RectTransform:
|
|||
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:
|
||||
- {fileID: 45337442}
|
||||
m_Father: {fileID: 656033446}
|
||||
|
@ -513,6 +517,7 @@ RectTransform:
|
|||
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: 45337442}
|
||||
m_RootOrder: 0
|
||||
|
@ -597,6 +602,7 @@ RectTransform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 218001138}
|
||||
- {fileID: 1393514934}
|
||||
|
@ -668,6 +674,7 @@ Canvas:
|
|||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
|
@ -760,6 +767,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
|
@ -853,6 +861,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0.9848078, z: -0, w: -0.17364809}
|
||||
m_LocalPosition: {x: 2, y: 0, z: 3}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
|
@ -958,6 +967,7 @@ RectTransform:
|
|||
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: 656033446}
|
||||
m_RootOrder: 1
|
||||
|
@ -1016,7 +1026,7 @@ GameObject:
|
|||
- component: {fileID: 1410197063}
|
||||
- component: {fileID: 1410197062}
|
||||
m_Layer: 0
|
||||
m_Name: Quad
|
||||
m_Name: Texture2DMarkerLessARExample
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -1051,6 +1061,7 @@ MeshRenderer:
|
|||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
|
@ -1113,6 +1124,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1024, y: 1024, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
@ -1160,6 +1172,7 @@ MeshRenderer:
|
|||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
|
@ -1222,6 +1235,7 @@ Transform:
|
|||
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: 0}
|
||||
m_RootOrder: 3
|
||||
|
@ -1258,6 +1272,7 @@ Transform:
|
|||
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:
|
||||
- {fileID: 1282818104}
|
||||
- {fileID: 1298675159}
|
||||
|
|
|
@ -1086,7 +1086,7 @@ GameObject:
|
|||
- component: {fileID: 1410197063}
|
||||
- component: {fileID: 1410197062}
|
||||
m_Layer: 0
|
||||
m_Name: Quad
|
||||
m_Name: Texture2DMarkerLessARExample
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
|
Двоичные данные
Assets/StreamingAssets/MarkerLessARExample/MarkerLessARExample_TestVideo_640_640_30fps.mp4
Normal file
Двоичные данные
Assets/StreamingAssets/MarkerLessARExample/MarkerLessARExample_TestVideo_640_640_30fps.mp4
Normal file
Двоичный файл не отображается.
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6c3d111613ae4cf4a9db68c309be36b6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 72 KiB |
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aadbccc7ef9dd2a469a5bf5fb4299e94
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 68 KiB |
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dd56c0e0c19dfc347949935763238c10
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 61 KiB |
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 71c0dd8ccc9d83c4b838d6f635e34fd9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Загрузка…
Ссылка в новой задаче