예제 #1
0
        /// <summary> Add this direction and orientation to the stamp cache. </summary>
        /// <param name="position">Position of where the stamp was captured.</param>
        /// <param name="direction">Direction in which the stamp was captured.</param>
        private void CacheStamp(Vector3 position, Vector3 direction)
        {
            StampDir stamp = new StampDir();

            stamp.position  = position;
            stamp.direction = direction;
            stamp.timestamp = Time.time;
            stampCache.Add(stamp);
        }
예제 #2
0
        /// <summary> Add this direction and orientation to the stamp cache. </summary>
        /// <param name="position">Position of where the stamp was captured.</param>
        /// <param name="orientation">Rotation of how the stamp was captured.</param>
        private void CacheStamp(Vector3 position, Quaternion orientation)
        {
            StampDir stamp = new StampDir();

            stamp.position  = position;
            stamp.direction = orientation;
            stamp.timestamp = Time.time;
            stampCache.Add(stamp);
        }
예제 #3
0
        /// <summary>
        /// Checks if a particular transform would overlap with an existing stamp on the Cubemap!
        /// </summary>
        public bool IsCached(Vector3 position, Vector3 direction)
        {
            float min = float.MaxValue;

            for (int i = 0; i < stampCache.Count; i++)
            {
                StampDir s = stampCache[i];
                if (IsExpired(i, position))
                {
                    stampCache.RemoveAt(i);
                    continue;
                }
                float ang = Vector3.Angle(direction, s.direction);
                if (min > ang)
                {
                    min = ang;
                }
            }

            // allow for a little overlap (using .8 fov instead of 1), especially since fov is horiontal, not vertical, and vertical is
            // shorter due to aspect ratio
            return(min < fov * .8f);
        }