Example #1
0
        override protected void BuildGizmo()
        {
            gizmo.SetName("SnapDragGizmo");

            float fAlpha = 0.5f;

            srcMaterial      = MaterialUtil.CreateTransparentMaterial(ColorUtil.SelectionGold, fAlpha);
            srcHoverMaterial = MaterialUtil.CreateStandardMaterial(ColorUtil.SelectionGold);

            // generate snap target set
            Snaps = SnapSet.CreateStandard(Scene);
            Snaps.IgnoreSet.AddRange(this.targets);
            Snaps.PreRender(parentScene.ActiveCamera.GetPosition());

            // [TODO] this should iterate through targets...

            Debug.Assert(this.targets.Count == 1);
            // [TODO] should maybe be using GetBoundingBox now??
            Bounds b = this.targets[0].GetLocalBoundingBox();
            float  h = b.extents[1];

            // object origin
            add_snap_source(Vector3.zero, "obj_origin", Snaps);
            add_snap_source(Vector3.zero + h * Vector3.up, "obj_top", Snaps);
            add_snap_source(Vector3.zero - h * Vector3.up, "obj_base", Snaps);

            gizmo.Hide();
        }
 virtual public void PreRender()
 {
     if (Snaps != null)
     {
         Snaps.PreRender(scene.ActiveCamera.GetPosition());
     }
     if (primitive != null)
     {
         primitive.PreRender();
     }
 }
Example #3
0
 virtual public void PreRender()
 {
     if (Snaps != null)
     {
         Snaps.PreRender(scene.ActiveCamera.GetPosition());
     }
     if (preview != null)
     {
         preview.PreRender();
     }
     if (curvePreview != null)
     {
         curvePreview.PreRender();
     }
 }
Example #4
0
        public RemoteGrabBehavior(Cockpit cockpit)
        {
            this.cockpit = cockpit;

            EnableSnapping = true;

            // build snap target set
            Snaps      = SnapSet.CreateStandard(cockpit.Scene);
            SnapHelper = new PreRenderHelper("remote_grab_snap_helper")
            {
                PreRenderF = () => { Snaps.PreRender(cockpit.ActiveCamera.GetPosition()); }
            };

            cockpit.Scene.SelectionChangedEvent += ActiveScene_SelectionChangedEvent;
            cockpit.Scene.ChangedEvent          += ActiveScene_ChangedEvent;
        }
Example #5
0
        // called on per-frame Update()
        override public void PreRender()
        {
            gizmo.Show();

            foreach (var v in Widgets)
            {
                float fScaling = VRUtil.GetVRRadiusForVisualAngle(
                    v.Key.GetPosition(),
                    parentScene.ActiveCamera.GetPosition(),
                    SceneGraphConfig.DefaultPivotVisualDegrees);
                fScaling /= parentScene.GetSceneScale();
                v.Key.SetLocalScale(new Vector3f(fScaling, fScaling, fScaling));
            }

            Snaps.PreRender(parentScene.ActiveCamera.GetPosition());
        }