protected override void OnSurfaceDataReady(SpatialMappingBase requester, SurfaceData bakedData, bool outputWritten, float elapsedBakeTimeSeconds) { SpatialMappingBase.Surface surface; if (base.surfaceObjects.TryGetValue(bakedData.id.handle, out surface)) { surface.awaitingBake = false; if (outputWritten) { if (surface.gameObject == null) { Debug.LogError(string.Format("A SpatialMappingCollider component can not apply baked data to the surface with id \"{0}\" because its GameObject is null.", bakedData.id.handle)); } else if (bakedData.outputCollider != null) { if (requester != this) { base.CloneBakedComponents(bakedData, surface); } bakedData.outputCollider.gameObject.layer = this.layer; if (this.material != null) { bakedData.outputCollider.material = this.material; } } } } }
protected override void OnBeginSurfaceEviction(bool shouldBeActiveWhileRemoved, SpatialMappingBase.Surface surfaceData) { if ((surfaceData.gameObject != null) && (surfaceData.meshCollider != null)) { surfaceData.meshCollider.enabled = shouldBeActiveWhileRemoved; } }
protected override void AddRequiredComponentsForBaking(SpatialMappingBase.Surface surface) { base.AddRequiredComponentsForBaking(surface); if (surface.meshCollider == null) { surface.meshCollider = surface.gameObject.AddComponent<MeshCollider>(); } SurfaceData surfaceData = surface.surfaceData; surfaceData.outputCollider = surface.meshCollider; surface.surfaceData = surfaceData; }
protected override void DestroySurface(SpatialMappingBase.Surface surface) { if (surface.meshRenderer != null) { surface.meshRenderer.sharedMaterial = null; surface.meshRenderer.enabled = false; UnityEngine.Object.Destroy(surface.meshRenderer); surface.meshRenderer = null; } base.DestroySurface(surface); }
protected virtual void OnEnable() { this.m_SMBase = base.target as SpatialMappingBase; this.m_SurfaceParentProp = base.serializedObject.FindProperty("m_SurfaceParent"); this.m_FreezeUpdatesProp = base.serializedObject.FindProperty("m_FreezeUpdates"); this.m_SecondsBetweenUpdatesProp = base.serializedObject.FindProperty("m_SecondsBetweenUpdates"); this.m_NumUpdatesBeforeRemovalProp = base.serializedObject.FindProperty("m_NumUpdatesBeforeRemoval"); this.m_LodProp = base.serializedObject.FindProperty("m_LodType"); this.m_VolumeProp = base.serializedObject.FindProperty("m_VolumeType"); this.m_SphereRadiusProp = base.serializedObject.FindProperty("m_SphereRadius"); this.m_HalfBoxExtentsProp = base.serializedObject.FindProperty("m_HalfBoxExtents"); }
protected override void UpdateSurfaceData(SpatialMappingBase.Surface surface) { base.UpdateSurfaceData(surface); SurfaceData surfaceData = surface.surfaceData; surfaceData.bakeCollider = base.bakePhysics; surfaceData.outputCollider = surface.meshCollider; surface.surfaceData = surfaceData; }
protected override void OnSurfaceDataReady(SpatialMappingBase requester, SurfaceData bakedData, bool outputWritten, float elapsedBakeTimeSeconds) { SpatialMappingBase.Surface surface; if (base.surfaceObjects.TryGetValue(bakedData.id.handle, out surface)) { surface.awaitingBake = false; if (outputWritten) { if (surface.gameObject == null) { Debug.LogError(string.Format("A SpatialMappingRenderer component can not apply baked data to a surface with id \"{0}\" because its GameObject is null.", bakedData.id.handle)); } else { if (requester != this) { base.CloneBakedComponents(bakedData, surface); } if (surface.meshRenderer == null) { surface.meshRenderer = surface.gameObject.GetComponent<MeshRenderer>(); if (surface.meshRenderer == null) { surface.meshRenderer = surface.gameObject.AddComponent<MeshRenderer>(); } surface.meshRenderer.receiveShadows = false; surface.meshRenderer.shadowCastingMode = ShadowCastingMode.Off; } this.ApplyRenderSettings(surface.meshRenderer); } } } }