// called on per-frame Update() virtual public void PreRender() { root.Show(); float useDegrees = (GizmoVisualDegrees > 0) ? GizmoVisualDegrees : SceneGraphConfig.DefaultAxisGizmoVisualDegrees; float fWorldSize = VRUtil.GetVRRadiusForVisualAngle( root.GetPosition(), parentScene.ActiveCamera.GetPosition(), useDegrees); float fSceneSize = fWorldSize / parentScene.GetSceneScale(); float fGeomScale = fSceneSize / initialGizmoRadius; root.SetLocalScale(new Vector3f(fGeomScale)); foreach (var widget in Widgets) { widget.Value.UpdateGizmoWorldSize(fWorldSize); } if (DynamicVisibilityFiltering && targetWrapper != null) { Frame3f frameW = targetWrapper.GetLocalFrame(CoordSpace.WorldCoords); Vector3d camPosW = parentScene.ActiveCamera.GetPosition(); foreach (var go in enabledWidgetGOs) { Standard3DTransformWidget widget = Widgets[go]; bool visible = widget.CheckVisibility(ref frameW, ref camPosW); go.SetVisible(visible); } } }
// // Boilerplate stuff // virtual protected void onTransformModified(SceneObject so) { // keep widget synced with object frame of target Frame3f widgetFrame = targetWrapper.GetLocalFrame(CoordSpace.ObjectCoords); gizmo.SetLocalPosition(widgetFrame.Origin); gizmo.SetLocalRotation(widgetFrame.Rotation); }
void SetActiveFrame(FrameType eFrame) { if (eFrame == FrameType.LocalFrame) { targetWrapper = new PassThroughWrapper(target); } else { targetWrapper = new SceneFrameWrapper(parentScene, target); } // update gizmo transform to match target frame Frame3 widgetFrame = targetWrapper.GetLocalFrame(CoordSpace.ObjectCoords); gizmo.transform.localPosition = widgetFrame.Origin; gizmo.transform.localRotation = widgetFrame.Rotation; }
void onTransformModified(TransformableSO so) { // keep widget synced with object frame of target Frame3f widgetFrame = targetWrapper.GetLocalFrame(CoordSpace.ObjectCoords); gizmo.transform.localPosition = widgetFrame.Origin; gizmo.transform.localRotation = widgetFrame.Rotation; }