Exemple #1
0
        /// <summary>
        /// Gets the color of the given surface type
        /// </summary>
        /// <param name="surfaceType">The surface type to get color for</param>
        /// <returns>The color of the type</returns>
        private Color ColorForSurfaceType(SpatialAwarenessSurfaceTypes surfaceType)
        {
            // shout-out to solarized!

            switch (surfaceType)
            {
            case SpatialAwarenessSurfaceTypes.Unknown:
                return(new Color32(220, 50, 47, 255));    // red

            case SpatialAwarenessSurfaceTypes.Floor:
                return(new Color32(38, 139, 210, 255));    // blue

            case SpatialAwarenessSurfaceTypes.Ceiling:
                return(new Color32(108, 113, 196, 255));    // violet

            case SpatialAwarenessSurfaceTypes.Wall:
                return(new Color32(181, 137, 0, 255));    // yellow

            case SpatialAwarenessSurfaceTypes.Platform:
                return(new Color32(133, 153, 0, 255));    // green

            case SpatialAwarenessSurfaceTypes.Background:
                return(new Color32(203, 75, 22, 255));    // orange

            case SpatialAwarenessSurfaceTypes.World:
                return(new Color32(211, 54, 130, 255));    // magenta

            case SpatialAwarenessSurfaceTypes.Inferred:
                return(new Color32(42, 161, 152, 255));    // cyan

            default:
                return(new Color32(220, 50, 47, 255));    // red
            }
        }
Exemple #2
0
 private void ToggleObservedSurfaceType(SpatialAwarenessSurfaceTypes surfaceType)
 {
     if (observer.SurfaceTypes.IsMaskSet(surfaceType))
     {
         observer.SurfaceTypes &= ~surfaceType;
     }
     else
     {
         observer.SurfaceTypes |= surfaceType;
     }
 }
        public SpatialAwarenessSceneObject(
            System.Guid guid,
            SpatialAwarenessSurfaceTypes surfaceType,
            Vector3 position,
            Quaternion rotation,
            List <Quad> quads,
            List <MeshData> meshDatas
            )
        {
            Guid        = guid;
            SurfaceType = surfaceType;

            Position = position;
            Rotation = rotation;

            Quads  = quads;
            Meshes = meshDatas;
        }
        /// <summary>
        /// Creates a <see cref="SpatialAwarenessSceneObject"/>.
        /// </summary>
        /// <returns>
        /// A SpatialAwarenessSceneObject containing the fields that describe the scene object.
        /// </returns>
        public static SpatialAwarenessSceneObject Create(
            int id,
            SpatialAwarenessSurfaceTypes surfaceType,
            Vector3 position,
            Quaternion rotation,
            List <QuadData> quads,
            List <MeshData> meshData
            )
        {
            SpatialAwarenessSceneObject newObject = new SpatialAwarenessSceneObject
            {
                Id = id
            };

            newObject.SurfaceType = surfaceType;
            newObject.Position    = position;
            newObject.Rotation    = rotation;
            newObject.Quads       = quads;
            newObject.Meshes      = meshData;

            return(newObject);
        }
Exemple #5
0
        /// <summary>
        /// Get all currently observed SceneObjects of a certain type.
        /// </summary>
        /// <remarks>
        /// Before calling this function, the observer should be configured to observe the specified type by including that type in the SurfaceTypes property.
        /// </remarks>
        /// <returns>A dictionary with the scene objects of the requested type being the values and their ids being the keys.</returns>
        public IReadOnlyDictionary <int, SpatialAwarenessSceneObject> GetSceneObjectsOfType(SpatialAwarenessSurfaceTypes type)
        {
            if (!observer.SurfaceTypes.IsMaskSet(type))
            {
                Debug.LogErrorFormat("The Scene Objects of type {0} are not being observed. You should add {0} to the SurfaceTypes property of the observer in advance.", type);
            }

            if (observedSceneObjects.TryGetValue(type, out Dictionary <int, SpatialAwarenessSceneObject> sceneObjects))
            {
                return(sceneObjects);
            }
            else
            {
                observedSceneObjects.Add(type, new Dictionary <int, SpatialAwarenessSceneObject>());
                return(observedSceneObjects[type]);
            }
        }
Exemple #6
0
 /// <summary>
 /// Checks to determine if all bits in a provided mask are set.
 /// </summary>
 /// <param name="a"><see cref="SpatialAwarenessSurfaceTypes"/> value.</param>
 /// <param name="b"><see cref="SpatialAwarenessSurfaceTypes"/> mask.</param>
 /// <returns>
 /// True if all of the bits in the specified mask are set in the current value.
 /// </returns>
 public static bool IsMaskSet(this SpatialAwarenessSurfaceTypes a, SpatialAwarenessSurfaceTypes b)
 {
     return((a & b) == b);
 }