Commit 708d3dee authored by BlackAngle233's avatar BlackAngle233
Browse files

update final design

parent 1444629e
fileFormatVersion: 2
guid: df4455ed6a02924488e6d656138f5191
folderAsset: yes
timeCreated: 1566271785
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a0557ffa4697a0c4385356797a10d59f
folderAsset: yes
timeCreated: 1560415204
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: EasyAR
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 9affe52541739e043b322f2c43a7f1ac, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: 7f4df819e76fa504895b6be65b773689
timeCreated: 1560415278
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 58d7254110b71854ea4594233f236ff5
folderAsset: yes
timeCreated: 1566271808
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
//================================================================================================================================
//
// Copyright (c) 2015-2021 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//================================================================================================================================
using easyar;
using System;
using UnityEngine;
using UnityEngine.UI;
namespace Camera_VideoCamera
{
public class VideoCameraSample : MonoBehaviour
{
public ARSession arSession;
public MeshRenderer CubeRenderer;
public Text CameraStatus;
public Toggle FlipSwitch;
private VideoCameraDevice videoCamera;
private CameraImageRenderer cameraRenderer;
private Texture cubeTexture;
private Action<Camera, RenderTexture> targetTextureEventHandler;
private void Awake()
{
videoCamera = arSession.GetComponentInChildren<VideoCameraDevice>();
cameraRenderer = arSession.GetComponentInChildren<CameraImageRenderer>();
cubeTexture = CubeRenderer.material.mainTexture;
targetTextureEventHandler = (camera, texture) =>
{
if (texture)
{
CubeRenderer.material.mainTexture = texture;
}
else
{
CubeRenderer.material.mainTexture = cubeTexture;
CubeRenderer.transform.localScale = new Vector3(1, 1, 1);
}
};
videoCamera.DeviceOpened += () =>
{
if (videoCamera.Device == null)
{
return;
}
var flip = videoCamera.Device.type() == CameraDeviceType.Front ? arSession.HorizontalFlipFront : arSession.HorizontalFlipNormal;
FlipSwitch.isOn = flip == ARSession.ARHorizontalFlipMode.World;
};
}
private void Update()
{
if (videoCamera.Device == null)
{
CameraStatus.text = "Camera: Unavailable";
return;
}
using (var cameraParameters = videoCamera.Device.cameraParameters())
{
CameraStatus.text = "Camera: " + (videoCamera.enabled ? "On" : "Off") + Environment.NewLine +
"Camera Index: " + videoCamera.Device.index() + Environment.NewLine +
"Camera Count: " + CameraDevice.cameraCount() + Environment.NewLine +
"Camera Type: " + cameraParameters.cameraDeviceType() + Environment.NewLine +
"HorizontalFlip: " + (cameraParameters.cameraDeviceType() == CameraDeviceType.Front ? arSession.HorizontalFlipFront : arSession.HorizontalFlipNormal);
}
if (CubeRenderer.material.mainTexture != cubeTexture)
{
CubeRenderer.transform.localScale = new Vector3(1, (float)Screen.height / Screen.width, 1);
}
}
public void NextCamera()
{
if (!videoCamera || videoCamera.Device == null)
{
return;
}
if (CameraDevice.cameraCount() == 0)
{
GUIPopup.EnqueueMessage("Camera unavailable", 3);
videoCamera.Close();
return;
}
var index = videoCamera.Device.index();
index = (index + 1) % CameraDevice.cameraCount();
videoCamera.CameraOpenMethod = VideoCameraDevice.CameraDeviceOpenMethod.DeviceIndex;
videoCamera.CameraIndex = index;
GUIPopup.EnqueueMessage("Switch to camera index: " + index, 3);
videoCamera.Close();
videoCamera.Open();
}
public void Capture(bool on)
{
if (!videoCamera || videoCamera.Device == null)
{
return;
}
if (on)
{
cameraRenderer.RequestTargetTexture(targetTextureEventHandler);
}
else
{
cameraRenderer.DropTargetTexture(targetTextureEventHandler);
}
return;
}
public void EnableCamera(bool enable)
{
videoCamera.enabled = enable;
}
public void ShowCameraImage(bool show)
{
cameraRenderer.enabled = show;
}
public void HFlip(bool flip)
{
if (!videoCamera || videoCamera.Device == null)
{
return;
}
bool isFront = false;
using (var cameraParameters = videoCamera.Device.cameraParameters())
{
if(cameraParameters.cameraDeviceType() == CameraDeviceType.Front)
{
isFront = true;
}
}
if (isFront)
{
arSession.HorizontalFlipFront = flip ? ARSession.ARHorizontalFlipMode.World : ARSession.ARHorizontalFlipMode.None;
}
else
{
arSession.HorizontalFlipNormal = flip ? ARSession.ARHorizontalFlipMode.World : ARSession.ARHorizontalFlipMode.None;
}
}
}
}
fileFormatVersion: 2
guid: 49c24ca6b85934d4d8c0ec869393b592
timeCreated: 1566281090
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c67c6702e786f364991149b5ff3d0b51
folderAsset: yes
timeCreated: 1560415205
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: abab1247db658cf4f94d54f728bf1073
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9affe52541739e043b322f2c43a7f1ac
timeCreated: 1575369588
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9fea40207f6b4374c83b5239a29022d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c376e05e40a904646a3d3d03f99a3bee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: EasyAR
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 2417dc227032f2f408819013986c2f68, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: 162779db9e4ba324e98e3ea59d2d58fd
timeCreated: 1560416472
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8d4d9a1855234b9418f402fc06154977
folderAsset: yes
timeCreated: 1572720390
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
//================================================================================================================================
//
// Copyright (c) 2015-2021 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//================================================================================================================================
using easyar;
using System;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
namespace FrameRecording
{
public class Sample : MonoBehaviour
{
public GameObject EasyARSession;
public Text Status;
private ImageTargetController controllerNamecard;
private ImageTargetController controllerIdback;
private GameObject easyarObject;
private FramePlayer player;
private FrameRecorder recorder;
private string filePath;
private void Awake()
{
var folder = Application.persistentDataPath + "/FrameRecording/";
if (!Directory.Exists(folder))
{
Directory.CreateDirectory(folder);
}
filePath = folder + "recording.eif";
controllerNamecard = GameObject.Find("ImageTarget-namecard").GetComponent<ImageTargetController>();
controllerIdback = GameObject.Find("ImageTarget-idback").GetComponent<ImageTargetController>();
AddTargetControllerEvents(controllerNamecard);
AddTargetControllerEvents(controllerIdback);
CreateRecorder();
}
private void Update()
{
if (player)
{
Status.text = "Playback Mode";
Status.text += Environment.NewLine +
"Playback from: " + filePath + Environment.NewLine +
"Playback: " + player.Time + " / " + player.Length + (player.IsCompleted ? " -- completed" : "");
}
else
{
Status.text = "Recoding Mode";
if (recorder.enabled)
{
Status.text += Environment.NewLine +
"Recoding to: " + filePath;
}
}
}
private void OnDestroy()
{
DestroySession();
}
public void CreateRecorder()
{
DestroySession();
easyarObject = Instantiate(EasyARSession);
easyarObject.GetComponentInChildren<VideoCameraDevice>().gameObject.SetActive(true);
easyarObject.GetComponentInChildren<FramePlayer>().gameObject.SetActive(false);
easyarObject.GetComponentInChildren<FrameRecorder>().gameObject.SetActive(true);
easyarObject.SetActive(true);
var imageTracker = easyarObject.GetComponentInChildren<ImageTrackerFrameFilter>();
controllerNamecard.Tracker = null;
controllerIdback.Tracker = null;
controllerNamecard.Tracker = imageTracker;
controllerIdback.Tracker = imageTracker;
player = null;
recorder = easyarObject.GetComponentInChildren<FrameRecorder>();
recorder.FilePathType = WritablePathType.Absolute;
recorder.FilePath = filePath;
recorder.enabled = false;
}
public void CreatePlayer()
{
DestroySession();
easyarObject = Instantiate(EasyARSession);
easyarObject.GetComponentInChildren<VideoCameraDevice>().gameObject.SetActive(false);
easyarObject.GetComponentInChildren<FramePlayer>().gameObject.SetActive(true);
easyarObject.GetComponentInChildren<FrameRecorder>().gameObject.SetActive(false);
easyarObject.SetActive(true);
var imageTracker = easyarObject.GetComponentInChildren<ImageTrackerFrameFilter>();
controllerNamecard.Tracker = null;
controllerIdback.Tracker = null;
controllerNamecard.Tracker = imageTracker;
controllerIdback.Tracker = imageTracker;
recorder = null;
player = easyarObject.GetComponentInChildren<FramePlayer>();
player.FilePathType = WritablePathType.Absolute;
player.FilePath = filePath;
}
public void Record(bool val)
{
recorder.enabled = val;
}
public void Playback(bool val)
{
if (val)
{
player.Play();
}
else
{
player.Stop();
}
}
private void DestroySession()
{
if (easyarObject) { DestroyImmediate(easyarObject); }
}
private void AddTargetControllerEvents(ImageTargetController controller)
{
if (!controller)
{
return;
}
controller.TargetFound += () =>
{
Debug.LogFormat("Found target {{id = {0}, name = {1}}}", controller.Target.runtimeID(), controller.Target.name());
};
controller.TargetLost += () =>
{
Debug.LogFormat("Lost target {{id = {0}, name = {1}}}", controller.Target.runtimeID(), controller.Target.name());
};
controller.TargetLoad += (Target target, bool status) =>
{
Debug.LogFormat("Load target {{id = {0}, name = {1}, size = {2}}} into {3} => {4}", target.runtimeID(), target.name(), controller.Size, controller.Tracker.name, status);
};
controller.TargetUnload += (Target target, bool status) =>
{
Debug.LogFormat("Unload target {{id = {0}, name = {1}}} => {2}", target.runtimeID(), target.name(), status);
};
}
}
}
fileFormatVersion: 2
guid: 21124cb0a846817428070a8f12048366
timeCreated: 1575788133
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 72f11e4cf974b06418be75e37da08943
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment