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(); } }
virtual public void PreRender() { if (Snaps != null) { Snaps.PreRender(scene.ActiveCamera.GetPosition()); } if (preview != null) { preview.PreRender(); } if (curvePreview != null) { curvePreview.PreRender(); } }
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; }
// 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()); }