/// <summary> /// Updates examples status text. /// </summary> private void UpdateStatusText() { _statusLabel.text = string.Format("<color=#dbfb76><b>{0} {1}</b></color>\n{2}: {3}\n", LocalizeManager.GetString("Controller"), LocalizeManager.GetString("Data"), LocalizeManager.GetString("Status"), LocalizeManager.GetString(ControllerStatus.Text)); _statusLabel.text += string.Format( "\n<color=#dbfb76><b>{0} {1}</b></color>\n{2} {3}: {4}\n{5} {6}: {7}\n{8}: {9}", LocalizeManager.GetString("Meshing"), LocalizeManager.GetString("Data"), LocalizeManager.GetString("Render"), LocalizeManager.GetString("Mode"), LocalizeManager.GetString(_renderMode.ToString()), LocalizeManager.GetString("Bounded"), LocalizeManager.GetString("Extents"), LocalizeManager.GetString(_bounded.ToString()), LocalizeManager.GetString("LOD"), #if UNITY_2019_3_OR_NEWER LocalizeManager.GetString(MLSpatialMapper.DensityToLevelOfDetail(_mlSpatialMapper.density).ToString()) #else LocalizeManager.GetString(_mlSpatialMapper.levelOfDetail.ToString()) #endif ); }
public override void InitializeGenerator(Locator mainLoc) { base.InitializeGenerator(mainLoc); _seenCount = new Dictionary <TrackableId, int>(); _mapper = FindObjectOfType <MLSpatialMapper>(); _mapper.requestVertexConfidence = true; _mapper.RefreshAllMeshes(); FindNextTarget(); }
void CheckMesh() { if (tMapper == null && GameObject.FindObjectOfType <MLSpatialMapper>() != null) { tMapper = GameObject.FindObjectOfType <MLSpatialMapper>(); Debug.LogError("Init" + tMapper.levelOfDetail); } else { CopyMesh(); } }
/// <summary> /// Handles the event for touchpad gesture start. Changes level of detail /// if gesture is swipe up. /// </summary> /// <param name="controllerId">The id of the controller.</param> /// <param name="gesture">The gesture getting started.</param> private void OnTouchpadGestureStart(byte controllerId, MLInput.Controller.TouchpadGesture gesture) { #if PLATFORM_LUMIN if (_controllerConnectionHandler.IsControllerValid(controllerId) && gesture.Type == MLInput.Controller.TouchpadGesture.GestureType.Swipe && gesture.Direction == MLInput.Controller.TouchpadGesture.GestureDirection.Up) { #if UNITY_2019_3_OR_NEWER _mlSpatialMapper.density = MLSpatialMapper.LevelOfDetailToDensity((MLSpatialMapper.DensityToLevelOfDetail(_mlSpatialMapper.density) == MLSpatialMapper.LevelOfDetail.Maximum) ? MLSpatialMapper.LevelOfDetail.Minimum : (MLSpatialMapper.DensityToLevelOfDetail(_mlSpatialMapper.density) + 1)); #else _mlSpatialMapper.levelOfDetail = ((_mlSpatialMapper.levelOfDetail == MLSpatialMapper.LevelOfDetail.Maximum) ? MLSpatialMapper.LevelOfDetail.Minimum : (_mlSpatialMapper.levelOfDetail + 1)); #endif } #endif }
//Init: private void Start() { _mainCamera = Camera.main; _spatialMapper = FindObjectOfType <MLSpatialMapper>(); //if no spatial mapper is found then disable //since this is just a nice helper there is no real need to announce this if (_spatialMapper == null) { enabled = false; return; } _spatialMapper.pollingRate = _minPollingRate; }
public override void Install(bool reset) { base.Install(reset); mapper = DisplayManager.MainCamera.Ensure <MLSpatialMapper>().Value; mapper.meshParent = transform; if (mapper.meshPrefab == null) { var pre = mapper.Ensure <Transform>("Original") .Value .gameObject; pre.Ensure <MeshFilter>(); pre.Ensure <MeshCollider>(); pre.Ensure <MeshRenderer>((rend) => rend.SetMaterial(CurrentMaterial)); pre.Deactivate(); mapper.meshPrefab = pre; } }
void CacheSerializedProperties() { m_MeshPrefab = this.serializedObject.FindProperty("m_MeshPrefab"); m_ComputeNormals = this.serializedObject.FindProperty("m_ComputeNormals"); m_Density = this.serializedObject.FindProperty("m_Density"); m_MeshParent = this.serializedObject.FindProperty("m_MeshParent"); m_MeshType = this.serializedObject.FindProperty("m_RequestedMeshType"); m_FillHoleLength = this.serializedObject.FindProperty("m_FillHoleLength"); m_MeshQueueSize = this.serializedObject.FindProperty("m_MeshQueueSize"); m_PollingRate = this.serializedObject.FindProperty("m_PollingRate"); m_BatchSize = this.serializedObject.FindProperty("m_BatchSize"); m_Planarize = this.serializedObject.FindProperty("m_Planarize"); m_DisconnectedComponentArea = this.serializedObject.FindProperty("m_DisconnectedComponentArea"); m_RequestVertexConfidence = this.serializedObject.FindProperty("m_RequestVertexConfidence"); m_RemoveMeshSkirt = this.serializedObject.FindProperty("m_RemoveMeshSkirt"); SerializedProperty legacyLod = this.serializedObject.FindProperty("m_LevelOfDetail"); if (legacyLod != null) { m_Density.floatValue = MLSpatialMapper.LevelOfDetailToDensity((MLSpatialMapper.LevelOfDetail)legacyLod.intValue); } }
void Awake() { _mapper = GetComponentInChildren <MLSpatialMapper>(); _meshes = _mapper.meshParent; }
private void Awake() { _mLSpatialMapper = GetComponent <MLSpatialMapper>(); }