Example #1
0
        private void Reset()
        {
            if (spongyWorldViz != null)
            {
                Destroy(spongyWorldViz.gameObject);
            }
            spongyWorldViz = null;

            if (worldLockingVizRoot != null)
            {
                Destroy(worldLockingVizRoot);
            }
            worldLockingVizRoot = null;

            foreach (var p in frozenFragmentVizs.Values)
            {
                if (p != null)
                {
                    Destroy(p.gameObject);
                }
            }
            frozenFragmentVizs.Clear();

            spongyResources.Clear();
            frozenResources.Clear();
            edgeResources.Clear();
            displacementResources.Clear();
        }
Example #2
0
 /// <summary>
 /// Ensure there is a "spongy root" to attach spongy anchor visuals to.
 /// </summary>
 /// <param name="parentTransform">The transform to attach the spongy root to.</param>
 private void CheckSpongyRoot(Transform parentTransform)
 {
     // The spongyWorldViz object is hung off the SpongyFrame.
     if (!spongyWorldViz)
     {
         spongyWorldViz       = Instantiate(Prefab_FrameViz, parentTransform);
         spongyWorldViz.name  = "Spongy";
         spongyWorldViz.color = Color.green;
     }
 }
Example #3
0
        /// <summary>
        /// Create an instance of a frame visualizer
        /// </summary>
        /// <param name="name">The name of the anchor to be displayed</param>
        /// <param name="parent">The frame visualization object that defines the color of this anchor</param>
        /// <returns></returns>
        public FrozenAnchorVisual Instantiate(string name, FrameVisual parent)
        {
            var res = Instantiate(this, parent.transform);

            res.parent = parent;
            res.name   = name;
            if (res.textObject != null)
            {
                res.textObject.text = name;
            }
            return(res);
        }
        /// <summary>
        /// Create a visualizer for a spongy anchor.
        /// </summary>
        /// <param name="parent">Coordinate space to create the visualizer in</param>
        /// <param name="worldAnchor">The worldanchor component assigned to some other object that this object is supposed to sync with</param>
        /// <returns></returns>
        public SpongyAnchorVisual Instantiate(FrameVisual parent, WorldAnchor worldAnchor)
        {
            var res = Instantiate(this, parent.transform);

            res.name = worldAnchor.name;
            if (res.textObject != null)
            {
                res.textObject.text = res.name;
            }
            res.worldAnchor = worldAnchor;
            res.color       = Color.gray;
            return(res);
        }
        /// <summary>
        /// Create a visualizer for a spongy anchor.
        /// </summary>
        /// <param name="parent">Coordinate space to create the visualizer in</param>
        /// <param name="spongyAnchor">The spongyAnchor component assigned to some other object that this object is supposed to sync with</param>
        /// <returns></returns>
        public SpongyAnchorVisual Instantiate(FrameVisual parent, SpongyAnchor spongyAnchor, float verticalDisplacement)
        {
            var res = Instantiate(this, parent.transform);

            res.name = spongyAnchor.name;
            if (res.textObject != null)
            {
                res.textObject.text = res.name;
            }
            res.spongyAnchor         = spongyAnchor;
            res.color                = Color.gray;
            res.verticalDisplacement = verticalDisplacement;
            return(res);
        }
Example #6
0
 /// <summary>
 /// Ensure there is a "spongy root" to attach spongy anchor visuals to.
 /// </summary>
 /// <param name="parentTransform">The transform to attach the spongy root to.</param>
 private void CheckSpongyRoot(Transform parentTransform)
 {
     // The spongyWorldViz object is hung off the SpongyFrame.
     if (!spongyWorldViz)
     {
         spongyWorldViz       = Instantiate(Prefab_FrameViz, parentTransform);
         spongyWorldViz.name  = "Spongy";
         spongyWorldViz.color = Color.green;
         if (connectingLine != null)
         {
             /// Connecting line material is only included to force import of the shader.
             /// No-op access it here to suppress warning that it is unused.
             spongyWorldViz.color = Color.green;
         }
     }
 }
Example #7
0
 /// <summary>
 /// Constructor takes the prefab to construct the visual out of, and a FrameVisual
 /// to creat the visual attached to.
 /// </summary>
 /// <param name="prefab">Prefab to create the visual out of.</param>
 /// <param name="spongyWorldVisual">Parent of created visuals.</param>
 public SpongyVisualCreator(SpongyAnchorVisual prefab, FrameVisual spongyWorldVisual)
 {
     Prefab_SpongyAnchorVisual = prefab;
     this.spongyWorldVisual    = spongyWorldVisual;
 }
 /// <summary>
 /// Constructor takes the prefab to construct the visual out of, and a FrameVisual
 /// to creat the visual attached to.
 /// </summary>
 /// <param name="prefab">Prefab to create the visual out of.</param>
 /// <param name="spongyWorldVisual">Parent of created visuals.</param>
 public SpongyVisualCreator(SpongyAnchorVisual prefab, FrameVisual spongyWorldVisual, float verticalDisplacement)
 {
     Prefab_SpongyAnchorVisual = prefab;
     this.spongyWorldVisual    = spongyWorldVisual;
     this.verticalDisplacement = verticalDisplacement;
 }