Browse Source

Merge branch 'F/20231110_Init' of https://gogs.ghz-tech.com:8843/GHzGlass/MREdustryXR into F/20231110_Init

# Conflicts:
#	Assets/FrameWork/ProjectManager/Scripts/Project/XunJian/XunJianDataManager.cs
胡佳骏 1 year ago
parent
commit
ff0bc87fd2

+ 85 - 1
Assets/FrameWork/ProjectManager/Scripts/Project/XunJian/XunJianDataManager.cs

@@ -88,7 +88,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         xj.renwuModelType = RenWuModelType.None;
         xj.itemList = getRenwuData();
         xj.people = "员工C";
-
+        xj.listWall = getWallData();
         return xj;
     }
     List<RenWuItem> getRenwuData()
@@ -269,6 +269,75 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
 
     public Dictionary<string, List<XunJianListData>> areaList = new Dictionary<string, List<XunJianListData>>();
     public Dictionary<string, List<XunJianListData>> peopleList = new Dictionary<string, List<XunJianListData>>();
+    List<Wall> getWallData()
+    {
+        List<Wall> listWall = new List<Wall>();
+
+        for (int i = 0; i < 6; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Wall wall = new Wall();
+                    wall.listPoint.Add(new Vector3(-5, 0, 0.25f));
+                    wall.listPoint.Add(new Vector3(5, 0, 0.25f));
+                    wall.listPoint.Add(new Vector3(5, 0, -0.25f));
+                    wall.listPoint.Add(new Vector3(-5, 0, -0.25f));
+                    listWall.Add(wall);
+                    break;
+
+                case 1:
+                    Wall wall1 = new Wall();
+                    wall1.listPoint.Add(new Vector3(-5, 0, -4.75f));
+                    wall1.listPoint.Add(new Vector3(5, 0, -4.75f));
+                    wall1.listPoint.Add(new Vector3(5, 0, -5.25f));
+                    wall1.listPoint.Add(new Vector3(-5, 0, -5.25f));
+                    listWall.Add(wall1);
+                    break;
+
+                case 2:
+                    Wall wall2 = new Wall();
+                    wall2.listPoint.Add(new Vector3(-5.25f, 0, 0));
+                    wall2.listPoint.Add(new Vector3(-4.75f, 0, 0));
+                    wall2.listPoint.Add(new Vector3(-4.75f, 0, -5));
+                    wall2.listPoint.Add(new Vector3(-5.25f, 0, -5));
+                    listWall.Add(wall2);
+                    break;
+
+                case 3:
+                    Wall wall3 = new Wall();
+                    wall3.listPoint.Add(new Vector3(4.75f, 0, 0));
+                    wall3.listPoint.Add(new Vector3(5.25f, 0, 0));
+                    wall3.listPoint.Add(new Vector3(5.25f, 0, -5));
+                    wall3.listPoint.Add(new Vector3(4.75f, 0, -5));
+                    listWall.Add(wall3);
+                    break;
+
+                case 4:
+                    Wall wall4 = new Wall();
+                    wall4.listPoint.Add(new Vector3(-2.75f, 0, -1f));
+                    wall4.listPoint.Add(new Vector3(-2.25f, 0, -1f));
+                    wall4.listPoint.Add(new Vector3(-2.25f, 0, -3f));
+                    wall4.listPoint.Add(new Vector3(-2.75f, 0, -3f));
+                    listWall.Add(wall4);
+                    break;
+
+                case 5:
+                    Wall wall5 = new Wall();
+                    wall5.listPoint.Add(new Vector3(2.25f, 0, -2));
+                    wall5.listPoint.Add(new Vector3(2.75f, 0, -2));
+                    wall5.listPoint.Add(new Vector3(2.75f, 0, -4));
+                    wall5.listPoint.Add(new Vector3(2.25f, 0, -4));
+                    listWall.Add(wall5);
+                    break;
+
+                default:
+                    break;
+            }
+        }
+
+        return listWall;
+    }
     IEnumerator testBack(Action<List<XunJianListData>> callback)
     {
         yield return WindowsManager.Instance.StartCoroutine(HttpTool.Instance.SendHttp(HttpEdustryAction.InspectionList, "", (string msg) =>
@@ -346,6 +415,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
             xj.projectType = ((ProjectType)data[i].type).ToString();
             xj.projectTime = data[i].inspectionTime.ToString();
             xj.updateState = data[i].status > 2 ? "已更新" : "新项目";
+            xj.listWall = data[i].listWall;
             listData.Add(xj);
         }
 
@@ -366,6 +436,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         public RenWuModelType renwuModelType;
         public string url;
         public string people = "未知员工";
+        public List<Wall> listWall;
     }
 
     public class XunJianData
@@ -378,6 +449,8 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         public int status { get; set; }
         public int inspectionTime { get; set; }
         public List<EmployeesData> listEmployees { get; set; }
+
+        public List<Wall> listWall { get; set; }
     }
     public class EmployeesData
     {
@@ -449,6 +522,8 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         public string imageUrl;
         public ImageFileSourceData imageData;
         public RenWuState state = RenWuState.None;
+
+        
     }
     public class RenWuTypeModel
     {
@@ -457,6 +532,15 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         public string url;
         public string info;
     }
+
+    public class Wall
+    {
+        public List<Vector3> listPoint { get; set; }
+        public Wall()
+        {
+            listPoint = new List<Vector3>();
+        }
+    }
     public enum RenWuState
     {
         None = 100001, // 未处理

+ 1 - 1
Assets/FrameWork/Scenes/Edustry.unity

@@ -38,7 +38,7 @@ RenderSettings:
   m_ReflectionIntensity: 1
   m_CustomReflection: {fileID: 0}
   m_Sun: {fileID: 0}
-  m_IndirectSpecularColor: {r: 0.44402242, g: 0.49316543, b: 0.5722324, a: 1}
+  m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
   m_UseRadianceAmbientProbe: 0
 --- !u!157 &3
 LightmapSettings:

+ 1 - 1
Assets/FrameWork/墙体.prefab

@@ -25,7 +25,7 @@ Transform:
   m_GameObject: {fileID: 3649401808606158665}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 7.61, y: 2, z: 5.61}
+  m_LocalScale: {x: 1, y: 2, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 3649401810370552673}

File diff suppressed because it is too large
+ 3056 - 157
Assets/Scenes/Test.unity


+ 101 - 0
Assets/Scripts/CreateWalls.cs

@@ -0,0 +1,101 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using static XunJianDataManager;
+
+public class CreateWalls : MonoBehaviour
+{
+    public GameObject Wall;
+    public List<Wall> listWall;
+    private void Start()
+    {
+        this.listWall = getWallData();
+
+        CreateWall(listWall);
+    }
+
+    List<Wall> getWallData()
+    {
+        List<Wall> listWall = new List<Wall>();
+
+        for (int i = 0; i < 6; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Wall wall = new Wall();
+                    wall.listPoint.Add(new Vector3(-5, 0, 0.25f));
+                    wall.listPoint.Add(new Vector3(5, 0, 0.25f));
+                    wall.listPoint.Add(new Vector3(5, 0, -0.25f));
+                    wall.listPoint.Add(new Vector3(-5, 0, -0.25f));
+                    listWall.Add(wall);
+                    break;
+
+                case 1:
+                    Wall wall1 = new Wall();
+                    wall1.listPoint.Add(new Vector3(-5, 0, -4.75f));
+                    wall1.listPoint.Add(new Vector3(5, 0, -4.75f));
+                    wall1.listPoint.Add(new Vector3(5, 0, -5.25f));
+                    wall1.listPoint.Add(new Vector3(-5, 0, -5.25f));
+                    listWall.Add(wall1);
+                    break;
+
+                case 2:
+                    Wall wall2 = new Wall();
+                    wall2.listPoint.Add(new Vector3(-5.25f, 0, 0));
+                    wall2.listPoint.Add(new Vector3(-4.75f, 0, 0));
+                    wall2.listPoint.Add(new Vector3(-4.75f, 0, -5));
+                    wall2.listPoint.Add(new Vector3(-5.25f, 0, -5));
+                    listWall.Add(wall2);
+                    break;
+
+                case 3:
+                    Wall wall3 = new Wall();
+                    wall3.listPoint.Add(new Vector3(4.75f, 0, 0));
+                    wall3.listPoint.Add(new Vector3(5.25f, 0, 0));
+                    wall3.listPoint.Add(new Vector3(5.25f, 0, -5));
+                    wall3.listPoint.Add(new Vector3(4.75f, 0, -5));
+                    listWall.Add(wall3);
+                    break;
+
+                case 4:
+                    Wall wall4 = new Wall();
+                    wall4.listPoint.Add(new Vector3(-2.75f, 0, -1f));
+                    wall4.listPoint.Add(new Vector3(-2.25f, 0, -1f));
+                    wall4.listPoint.Add(new Vector3(-2.25f, 0, -3f));
+                    wall4.listPoint.Add(new Vector3(-2.75f, 0, -3f));
+                    listWall.Add(wall4);
+                    break;
+
+                case 5:
+                    Wall wall5 = new Wall();
+                    wall5.listPoint.Add(new Vector3(2.25f, 0, -2));
+                    wall5.listPoint.Add(new Vector3(2.75f, 0, -2));
+                    wall5.listPoint.Add(new Vector3(2.75f, 0, -4));
+                    wall5.listPoint.Add(new Vector3(2.25f, 0, -4));
+                    listWall.Add(wall5);
+                    break;
+
+                default:
+                    break;
+            }
+        }
+
+        return listWall;
+    }
+  
+    public void CreateWall( List<Wall> listWall)
+    {
+        for (int i = 0; i < listWall.Count; i++)
+        {
+            Transform wallObj = GameObject.Instantiate(Wall).transform;
+
+            wallObj.position = listWall[i].listPoint[0];
+
+            float x = Vector3.Distance(listWall[i].listPoint[0], listWall[i].listPoint[1]);
+            float y = Vector3.Distance(listWall[i].listPoint[0], listWall[i].listPoint[3]);
+
+            wallObj.localScale = new Vector3(x, 3, y);
+        }
+    }
+}

+ 11 - 0
Assets/Scripts/CreateWalls.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f5bdd60a6ac7056459aece5524efa555
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 101 - 0
Assets/Scripts/GameObjectExtensions.cs

@@ -0,0 +1,101 @@
+using UnityEngine;
+
+public static class GameObjectExtensions
+{
+    public static Bounds CalculatePreciseBounds(this GameObject gameObject)
+    {
+        Bounds bounds = new Bounds();
+        bool flag = false;
+        MeshFilter[] componentsInChildren1 = gameObject.GetComponentsInChildren<MeshFilter>();
+        if (componentsInChildren1.Length != 0)
+        {
+            bounds = GetMeshBounds(componentsInChildren1[0].gameObject, componentsInChildren1[0].sharedMesh);
+            flag = true;
+            for (int index = 1; index < componentsInChildren1.Length; ++index)
+                bounds.Encapsulate(GetMeshBounds(componentsInChildren1[index].gameObject,
+                    componentsInChildren1[index].sharedMesh));
+        }
+
+        SkinnedMeshRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
+        if (componentsInChildren2.Length != 0)
+        {
+            Mesh mesh = new Mesh();
+            if (!flag)
+            {
+                componentsInChildren2[0].BakeMesh(mesh);
+                bounds = GetMeshBounds(componentsInChildren2[0].gameObject, mesh);
+            }
+
+            for (int index = 1; index < componentsInChildren2.Length; ++index)
+            {
+                componentsInChildren2[index].BakeMesh(mesh);
+                bounds = GetMeshBounds(componentsInChildren2[index].gameObject, mesh);
+            }
+
+            Object.Destroy(mesh);
+        }
+
+        return bounds;
+    }
+
+    private static Bounds GetMeshBounds(GameObject gameObject, Mesh mesh)
+    {
+        Bounds bounds = new Bounds();
+        Vector3[] vertices = mesh.vertices;
+        if (vertices.Length != 0)
+        {
+            bounds = new Bounds(gameObject.transform.TransformPoint(vertices[0]), Vector3.zero);
+            for (int index = 1; index < vertices.Length; ++index)
+                bounds.Encapsulate(gameObject.transform.TransformPoint(vertices[index]));
+        }
+
+        return bounds;
+    }
+
+    public static Bounds CalculateBounds(this GameObject gameObject, bool localSpace = false)
+    {
+        Vector3 position = gameObject.transform.position;
+        Quaternion rotation = gameObject.transform.rotation;
+        Vector3 localScale = gameObject.transform.localScale;
+        if (localSpace)
+        {
+            gameObject.transform.position = Vector3.zero;
+            gameObject.transform.rotation = Quaternion.identity;
+            gameObject.transform.localScale = Vector3.one;
+        }
+
+        Bounds bounds1 = new Bounds();
+        Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
+        if (componentsInChildren.Length != 0)
+        {
+            Bounds bounds2 = componentsInChildren[0].bounds;
+            bounds1.center = bounds2.center;
+            bounds1.extents = bounds2.extents;
+            for (int index = 1; index < componentsInChildren.Length; ++index)
+            {
+                Bounds bounds3 = componentsInChildren[index].bounds;
+                bounds1.Encapsulate(bounds3);
+            }
+        }
+
+        if (localSpace)
+        {
+            gameObject.transform.position = position;
+            gameObject.transform.rotation = rotation;
+            gameObject.transform.localScale = localScale;
+        }
+
+        return bounds1;
+    }
+
+    /// <summary>
+    /// 获取模型的Bounds
+    /// </summary>
+    /// <param name="gameObject"></param>
+    /// <returns></returns>
+    public static Bounds CalculateModelBounds(GameObject gameObject)
+    {
+        Bounds bounds = gameObject.CalculateBounds(false);
+        return bounds;
+    }
+}

+ 11 - 0
Assets/Scripts/GameObjectExtensions.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6b17490c0e02de547b86d5cab8e049d8
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 28 - 0
Assets/Scripts/TestWallPoint.cs

@@ -0,0 +1,28 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using static XunJianDataManager;
+
+public class TestWallPoint : MonoBehaviour
+{
+    public List<Transform> listPoint;
+    public List<Vector3> listpos;
+
+
+    private void Update()
+    {
+        if(Input.GetKeyDown(KeyCode.K))
+        {
+            listpos = new List<Vector3>();
+
+            for (int i = 0; i < listPoint.Count; i++)
+            {
+                listpos.Add(listPoint[i].position);
+
+            }
+        }
+    }
+
+
+   
+}

+ 11 - 0
Assets/Scripts/TestWallPoint.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b56d166ae7b93204486d85f84da9bde3
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 0
ProjectSettings/EditorBuildSettings.asset

@@ -11,6 +11,7 @@ EditorBuildSettings:
   m_configObjects:
     EasyAR.Settings: {fileID: 11400000, guid: 852e6bd112d2b174996470390b08d3a7, type: 2}
     UnityEditor.XR.ARCore.ARCoreSettings: {fileID: 11400000, guid: 043206f7c0b452a4c909e5e8d13ca175, type: 2}
+    UnityEditor.XR.ARKit.ARKitSettings: {fileID: 11400000, guid: 593f97d6bb62680408c72271c3362ab7, type: 2}
     com.unity.xr.arfoundation.simulation_settings: {fileID: 11400000, guid: 8cb56588ad604a84a91a3500baedb546, type: 2}
     com.unity.xr.management.loader_settings: {fileID: 11400000, guid: 6f45d16099e3af24c9d1814902f6c1cd, type: 2}
     com.unity.xr.openxr.settings4: {fileID: 11400000, guid: 2fc93d2ce72dd364f968f3400a68213b, type: 2}

+ 12 - 2
ProjectSettings/ProjectSettings.asset

@@ -8,7 +8,7 @@ PlayerSettings:
   AndroidProfiler: 0
   AndroidFilterTouchesWhenObscured: 0
   AndroidEnableSustainedPerformanceMode: 0
-  defaultScreenOrientation: 4
+  defaultScreenOrientation: 3
   targetDevice: 2
   useOnDemandResources: 0
   accelerometerFrequency: 60
@@ -146,7 +146,17 @@ PlayerSettings:
     16:9: 1
     Others: 1
   bundleVersion: 0.5.0
-  preloadedAssets: []
+  preloadedAssets:
+  - {fileID: 4800000, guid: c9f956787b1d945e7b36e0516201fc76, type: 3}
+  - {fileID: 4800000, guid: ea9a295053a0dc440b9698a7f41d9741, type: 3}
+  - {fileID: 4800000, guid: 1499e61b3897c4a4b9318a56ca931b8a, type: 3}
+  - {fileID: 4800000, guid: 798d6e253a35a144d94205b80c8fd48b, type: 3}
+  - {fileID: 4800000, guid: ae539cb2b258bd047a57837fd579cc80, type: 3}
+  - {fileID: 4800000, guid: 58841e6e22debfc43ba09a0cf58cd92d, type: 3}
+  - {fileID: 4800000, guid: a336f422ffebbec4c89b4dac26022d5f, type: 3}
+  - {fileID: 11400000, guid: 852e6bd112d2b174996470390b08d3a7, type: 2}
+  - {fileID: 2720162604194769745, guid: 6f45d16099e3af24c9d1814902f6c1cd, type: 2}
+  - {fileID: -1976151159784538485, guid: 2fc93d2ce72dd364f968f3400a68213b, type: 2}
   metroInputSource: 0
   wsaTransparentSwapchain: 0
   m_HolographicPauseOnTrackingLoss: 1

+ 1 - 1
ProjectSettings/TagManager.asset

@@ -35,7 +35,7 @@ TagManager:
   - 
   - 
   - 
-  - 
+  - 30
   - 
   m_SortingLayers:
   - name: Default

Some files were not shown because too many files changed in this diff