public virtual void Setup() { // do this here ?? behaviors = new InputBehaviorSet(); SpatialDeviceGrabBehavior behavior = new SpatialDeviceGrabBehavior(Scene.Context, (so) => { return(so == this.Target); }) { Priority = 1, RotationSpeed = 0.25f, TranslationSpeed = 0.25f }; behaviors.Add(behavior); indicators = new ToolIndicatorSet(this, Scene); float h = 300.0f; Frame3f f1 = Frame3f.Identity.Rotated(Quaternionf.AxisAngleD(Vector3f.AxisZ, 90.0f)).Translated(h * 0.5f * Vector3f.AxisY); var plane1 = new SectionPlaneIndicator() { Width = fDimension.Scene(h), // in mm SceneFrameF = () => { return(f1); } }; indicators.AddIndicator(plane1); Frame3f f2 = Frame3f.Identity.Rotated(Quaternionf.AxisAngleD(Vector3f.AxisX, 90.0f)).Translated(h * 0.5f * Vector3f.AxisY); var plane2 = new SectionPlaneIndicator() { Width = fDimension.Scene(h), // in mm SceneFrameF = () => { return(f2); } }; indicators.AddIndicator(plane2); }
public OldPlaneCutTool(FScene scene, SceneObject target) { this.scene = scene; this.target = target as DMeshSO; double plane_dim = 1.5 * this.target.Mesh.CachedBounds.DiagonalLength; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new PlaneCutTool_SpatialBehavior(this, scene.Context) { Priority = 5 }); // shut off transform gizmo scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType); indicators = new ToolIndicatorSet(this, scene); SectionPlaneIndicator section_plane = new SectionPlaneIndicator() { SceneFrameF = () => { return(cut_plane); }, Width = fDimension.Scene(() => { return((float)(plane_dim)); }) }; indicators.AddIndicator(section_plane); }
public MultiPointTool(FScene scene, SceneObject target) { this.Scene = scene; TargetSO = target; // do this here ?? behaviors = new InputBehaviorSet(); behaviors.Add( new MultiPointTool_2DBehavior(scene.Context, this) { Priority = 5 }); if (FPlatform.IsUsingVR()) { behaviors.Add( new MultiPointTool_SpatialBehavior(scene.Context, this) { Priority = 5 }); } Indicators = new ToolIndicatorSet(this, scene); IndicatorBuilder = new StandardIndicatorFactory(); GizmoPoints = new Dictionary <int, ControlPoint>(); PointHitTestF = PointIntersectionTest; }
public CreatePlaneFromSurfacePointTool(FScene scene, SceneObject target) : base(scene) { TargetSO = target; ObjectFrameS = TargetSO.GetLocalFrame(CoordSpace.SceneCoords); Indicators = new ToolIndicatorSet(this, scene); IndicatorBuilder = new StandardIndicatorFactory(); have_set_plane = false; }
public virtual void Setup() { Func <Vector3f> centerPosF = () => { return((Vector3f)(snappedPointsS[0] + snappedPointsS[1]) * 0.5f); }; centerPos = fPosition.Scene(centerPosF); fDimension textHeight = null; if (TextHeightDimensionType == DimensionType.VisualAngle) { textHeight = fDimension.VisualAngle(centerPos, TextHeightDimension); } else if (TextHeightDimensionType == DimensionType.SceneUnits) { textHeight = fDimension.Scene(() => { return(TextHeightDimension); }); } else { textHeight = fDimension.World(() => { return(TextHeightDimension); }); } Func <Vector3f> labelPosF = () => { Vector3f p = centerPos.ScenePoint; float h = textHeight.SceneValuef; p += 0.5f * h * scene.ToSceneN(Vector3f.AxisY); return(p); }; indicators = new ToolIndicatorSet(this, scene); LineIndicator diag = new LineIndicator() { VisibleF = () => { return(Initialized); }, SceneStartF = () => { return((Vector3f)snappedPointsS[0]); }, SceneEndF = () => { return((Vector3f)snappedPointsS[1]); }, ColorF = () => { return(Colorf.VideoRed); }, LineWidth = fDimension.VisualAngle(centerPos, 0.5f), }; indicators.AddIndicator(diag); dimension = new TextLabelIndicator() { VisibleF = () => { return(Initialized && ShowTextLabel); }, ScenePositionF = labelPosF, TextHeight = textHeight, DimensionTextF = () => { return(string.Format("{0:F4}", snappedPointsS[0].Distance(snappedPointsS[1]))); } }; indicators.AddIndicator(dimension); }
public TwoPointFaceSelectionTool(FScene scene, DMeshSO target) : base(scene) { TargetSO = target; indicators = new ToolIndicatorSet(this, scene); have_source = have_extent = false; selection_valid = false; selectionCache = new MeshFaceSelectionCache(target.Mesh); selectionCache.ChunkMeshMaterial = MaterialUtil.CreateStandardMaterialF(Colorf.Gold); targetTrackingGO = GameObjectFactory.CreateTrackingGO("track_target", target.RootGameObject); scene.TransientObjectsParent.AddChild(targetTrackingGO, false); selectionCache.ChunkMeshParent = targetTrackingGO; }
public BendTool(FScene scene, DMeshSO target) { this.Scene = scene; TargetSO = target; // do this here ?? behaviors = new InputBehaviorSet(); //behaviors.Add( // new MultiPointTool_2DBehavior(scene.Context, this) { Priority = 5 }); //if (FPlatform.IsUsingVR()) { // behaviors.Add( // new MultiPointTool_SpatialBehavior(scene.Context, this) { Priority = 5 }); //} Indicators = new ToolIndicatorSet(this, scene); }
public MeshEditorTool(FScene scene, DMeshSO target) { this.Scene = scene; this.target = target; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new MeshEditorTool_2DInputBehavior(this, scene.Context) { Priority = 5 }); // shut off transform gizmo scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType); // set up parameters initialize_parameters(); SceneUtil.SetVisible(Target, false); Indicators = new ToolIndicatorSet(this, scene); }
public DrawTubeTool(FScene scene) { this.scene = scene; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new DrawTubeTool_MouseBehavior(scene.Context) { Priority = 5 }); behaviors.Add( new DrawTubeTool_SpatialDeviceBehavior(this, scene.Context) { Priority = 5 }); // restore radius if (SavedSettings.Restore("DrawTubeTool_radius") != null) { radius = (float)SavedSettings.Restore("DrawTubeTool_radius"); } indicators = new ToolIndicatorSet(this, scene); BrushCursorSphere brushSphere = new BrushCursorSphere() { PositionF = () => { return(lastPreviewPos.Origin); }, Radius = fDimension.Scene(() => { return(Radius); }) }; brushSphereMat = MaterialUtil.CreateTransparentMaterialF(Colorf.CornflowerBlue, 0.2f); brushSphere.material = brushSphereMat; indicators.AddIndicator(brushSphere); }
public DrawMultiClickLoopTool(FScene scene, SceneObject target) : base(scene, target) { indicators = new ToolIndicatorSet(this, scene); }
public RadialMeasureTool(FScene scene, SceneObject target) { this.scene = scene; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new RadialMeasureTool_MouseBehavior(scene.Context) { Priority = 5 }); //behaviors.Add( // new RevolveTool_SpatialDeviceBehavior(scene.ActiveController) { Priority = 5 }); // shut off transform gizmo scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType); scene.SelectionChangedEvent += Scene_SelectionChangedEvent; this.meshTarget = target as MeshSO; var boundsW = meshTarget.GetBoundingBox(CoordSpace.WorldCoords); measureHitPos = boundsW.Center; update_measurement(); indicators = new ToolIndicatorSet(this, scene); TextLabelIndicator dimensionLabel = new TextLabelIndicator() { ScenePositionF = () => { return(displayPosS + 0.01f * Vector3f.AxisY); }, TextHeight = fDimension.Scene(0.05f), DimensionTextF = () => { return(" " + (curDimension * 100).ToString("F2") + "cm"); } }; indicators.AddIndicator(dimensionLabel); CircleIndicator circle = new CircleIndicator() { SceneFrameF = () => { return(new Frame3f(circleCenterS)); }, RadiusF = () => { return((float)(curDimension * 0.5)); }, ColorF = () => { return(new Colorf(Colorf.VideoRed, 0.5f)); }, LineWidth = fDimension.Scene(0.001f) }; indicators.AddIndicator(circle); LineIndicator diag = new LineIndicator() { SceneStartF = () => { return(maxStart); }, SceneEndF = () => { return(maxEnd); }, ColorF = () => { return(Colorf.VideoRed); }, LineWidth = fDimension.Scene(0.001f) }; indicators.AddIndicator(diag); SectionPlaneIndicator section_plane = new SectionPlaneIndicator() { SceneFrameF = () => { return(new Frame3f(displayPosS)); }, Width = fDimension.Scene(() => { return((float)(curDimension * 1.5)); }) }; indicators.AddIndicator(section_plane); }