diff --git a/Assets/.DS_Store b/Assets/.DS_Store new file mode 100644 index 0000000..aad2ded Binary files /dev/null and b/Assets/.DS_Store differ diff --git a/Assets/Demos/.DS_Store b/Assets/Demos/.DS_Store new file mode 100644 index 0000000..14ffee9 Binary files /dev/null and b/Assets/Demos/.DS_Store differ diff --git a/Assets/Demos/Marker/.DS_Store b/Assets/Demos/Marker/.DS_Store new file mode 100644 index 0000000..6942806 Binary files /dev/null and b/Assets/Demos/Marker/.DS_Store differ diff --git a/Assets/Demos/Markerless/.DS_Store b/Assets/Demos/Markerless/.DS_Store new file mode 100644 index 0000000..c912da3 Binary files /dev/null and b/Assets/Demos/Markerless/.DS_Store differ diff --git a/Assets/Plugins/WebGL/ARWTAccess.jslib b/Assets/Plugins/WebGL/ARWTAccess.jslib new file mode 100644 index 0000000..4463ec8 --- /dev/null +++ b/Assets/Plugins/WebGL/ARWTAccess.jslib @@ -0,0 +1,28 @@ +mergeInto(LibraryManager.library, { + + CameraReady : function() { + + cameraReady(); + + }, + + DetectionManagerReady : function () { + + detectionManagerReady(); + + }, + + ObjectAvailable : function() { + + objectAvailable(); + + }, + + GetCamName : function(camName) { + + var name = Pointer_stringify(camName) + getCamName(name); + + }, + +}); \ No newline at end of file diff --git a/Assets/Resources/.DS_Store b/Assets/Resources/.DS_Store new file mode 100644 index 0000000..7faafee Binary files /dev/null and b/Assets/Resources/.DS_Store differ diff --git a/Assets/Scripts/.DS_Store b/Assets/Scripts/.DS_Store new file mode 100644 index 0000000..39028e9 Binary files /dev/null and b/Assets/Scripts/.DS_Store differ diff --git a/Assets/Scripts/Common/.DS_Store b/Assets/Scripts/Common/.DS_Store new file mode 100644 index 0000000..8ba9703 Binary files /dev/null and b/Assets/Scripts/Common/.DS_Store differ diff --git a/Assets/Scripts/Common/CameraController.cs b/Assets/Scripts/Common/CameraController.cs index cc919bc..0ed1c2e 100644 --- a/Assets/Scripts/Common/CameraController.cs +++ b/Assets/Scripts/Common/CameraController.cs @@ -1,16 +1,27 @@ using UnityEngine; +using System.Runtime.InteropServices; namespace ARWT.Core{ public class CameraController : MonoBehaviour{ + [DllImport("__Internal")] + private static extern void ObjectAvailable(); + + [DllImport("__Internal")] + private static extern void CameraReady(); + Matrix4x4 defProj; Camera cam; - [System.Obsolete] void Start() { cam = GetComponent(); - Application.ExternalCall("cameraReady"); + if(!Application.isEditor){ + + CameraReady(); + + } + defProj = cam.projectionMatrix; } @@ -63,7 +74,8 @@ public void setProjection(string val){ p[2, 3] = defProj[14]; - cam.projectionMatrix = p; + cam.projectionMatrix = p; + } public void setPosition(string val){ @@ -92,6 +104,24 @@ public void setEuler(string val){ transform.eulerAngles = new Vector3(x, y, z); } + + public void ObjectCheck(string objectName){ + + if(GameObject.Find(objectName) != null){ + + if(!Application.isEditor){ + + ObjectAvailable(); + + } + + }else{ + + Debug.LogError("There is no gameobject with the name " + objectName + " available for use!"); + + } + + } } } diff --git a/Assets/Scripts/Common/PostBuild/PostBuildActions.cs b/Assets/Scripts/Common/PostBuild/PostBuildActions.cs index af0b021..3b08e86 100644 --- a/Assets/Scripts/Common/PostBuild/PostBuildActions.cs +++ b/Assets/Scripts/Common/PostBuild/PostBuildActions.cs @@ -17,26 +17,19 @@ public class PostBuildActions{ static string markersPath = "data/markers"; static string markersImagesPath = "data/markersImages"; static string index = "index.html"; - static string appJS = "js/app.js"; - - [PostProcessBuild] - public static void OnPostProcessBuild(BuildTarget target, string targetPath){ - var path = Path.Combine(targetPath, "Build/UnityLoader.js"); + public static void OnPostProcessBuild(BuildTarget target, string targetPath){ + + var path = Path.Combine(targetPath, "Build/" + getName(targetPath) + ".loader.js"); var text = File.ReadAllText(path); text = text.Replace("UnityLoader.SystemInfo.mobile", "false"); File.WriteAllText(path, text); - string buildJsonPath = "Build/" + getName(targetPath) + ".json"; - path = Path.Combine(targetPath, "Build/" + getName(targetPath) + ".json"); - replaceInFile(path, "backgroundColor", ""); generateHTML(targetPath); copyImages(targetPath); - string unityDeclaration = $"const unityInstance = UnityLoader.instantiate(\"unityContainer\", \"{buildJsonPath}\");"; - replaceInFile(Path.Combine(targetPath, appJS), buildPlaceholder, unityDeclaration); } static string getName(string p){ diff --git a/Assets/Scripts/WebAR/.DS_Store b/Assets/Scripts/WebAR/.DS_Store new file mode 100644 index 0000000..4586c99 Binary files /dev/null and b/Assets/Scripts/WebAR/.DS_Store differ diff --git a/Assets/Scripts/WebAR/DetectionManager.cs b/Assets/Scripts/WebAR/DetectionManager.cs index 96af069..7a2af10 100644 --- a/Assets/Scripts/WebAR/DetectionManager.cs +++ b/Assets/Scripts/WebAR/DetectionManager.cs @@ -1,5 +1,6 @@ using ARWT.Core; using UnityEngine; +using System.Runtime.InteropServices; namespace ARWT.Marker{ public class MarkerInfo{ @@ -19,15 +20,23 @@ public MarkerInfo(string name, bool isVisible, Vector3 position, Quaternion rota } public class DetectionManager : Singleton{ - + + [DllImport("__Internal")] + private static extern void DetectionManagerReady(); + public delegate void MarkerDetection(MarkerInfo m); public static event MarkerDetection onMarkerDetected; public static event MarkerDetection onMarkerVisible; public static event MarkerDetection onMarkerLost; - [System.Obsolete] - void Start() { - Application.ExternalCall("detectionManagerReady"); + void Start() { + + if(!Application.isEditor){ + + DetectionManagerReady(); + + } + } public void markerInfos(string infos){ diff --git a/Assets/WebGLTemplates/.DS_Store b/Assets/WebGLTemplates/.DS_Store new file mode 100644 index 0000000..f4ac641 Binary files /dev/null and b/Assets/WebGLTemplates/.DS_Store differ diff --git a/Assets/WebGLTemplates/WebAR/.DS_Store b/Assets/WebGLTemplates/WebAR/.DS_Store new file mode 100644 index 0000000..e9b5054 Binary files /dev/null and b/Assets/WebGLTemplates/WebAR/.DS_Store differ diff --git a/Assets/WebGLTemplates/WebAR/index.html b/Assets/WebGLTemplates/WebAR/index.html index 8286be0..2d815d7 100644 --- a/Assets/WebGLTemplates/WebAR/index.html +++ b/Assets/WebGLTemplates/WebAR/index.html @@ -1,26 +1,217 @@ - + - + - Unity WebGL Player | WebGL Test AR + Unity WebGL Player | {{{ PRODUCT_NAME }}} + - - - + - - -
- - - + + + + +
+
Loading, please wait...
+
+ + +
+ + + +
+ + + + + + --MARKERS-- + - --MARKERS-- - - - \ No newline at end of file + + + + diff --git a/Assets/WebGLTemplates/WebXR/.DS_Store b/Assets/WebGLTemplates/WebXR/.DS_Store new file mode 100644 index 0000000..5a541e5 Binary files /dev/null and b/Assets/WebGLTemplates/WebXR/.DS_Store differ