void enable_circle_indicator(bool enable) { if (enable == false && circle_indicator == null) { return; } if (enable && circle_indicator == null) { LineSet lines = new LineSet(); lines.UseFixedNormal = true; lines.FixedNormal = Vector3f.AxisY; DCurve3 curve = new DCurve3(Polygon2d.MakeCircle(gizmoInitialRadius, 64), 0, 2); lines.Curves.Add(curve); lines.Width = 1.0f; lines.WidthType = LineWidthType.Pixel; lines.Segments.Add( new Segment3d(Vector3d.Zero, gizmoInitialRadius * diagonals[nRotationAxis])); lines.Color = Colorf.DimGrey; circle_indicator = new fLineSetGameObject(new GameObject(), lines, "circle"); circle_indicator.SetLayer(FPlatform.WidgetOverlayLayer, true); circle_indicator.SetLocalRotation(Quaternionf.FromTo(Vector3f.AxisY, Frame3f.Identity.GetAxis(nRotationAxis))); RootGameObject.AddChild(circle_indicator, false); } circle_indicator.SetVisible(enable); }
public BasicSceneGrid(bool xyPlane, bool yzPlane, bool xzPlane, string name = "basic_grid") : base(name) { grid_xy = (xyPlane) ? new fLineSetGameObject("lines_x") : null; grid_yz = (yzPlane) ? new fLineSetGameObject("lines_y") : null; grid_xz = (xzPlane) ? new fLineSetGameObject("lines_z") : null; if (grid_xy != null) { RootGameObject.AddChild(grid_xy, false); } if (grid_yz != null) { RootGameObject.AddChild(grid_yz, false); } if (grid_xz != null) { RootGameObject.AddChild(grid_xz, false); } }
void enable_snap_indicator(bool enable) { if (enable == false && snap_indicator == null) { return; } if (enable && snap_indicator == null) { LineSet lines = new LineSet(); lines.UseFixedNormal = true; lines.FixedNormal = Vector3f.AxisY; int n = 360 / (int)SnapIncrementDeg; int n45 = 45 / (int)SnapIncrementDeg; int n90 = 90 / (int)SnapIncrementDeg; double r = gizmoInitialRadius; double r2 = gizmoInitialRadius * 1.05; double r45 = gizmoInitialRadius * 1.10; double r90 = gizmoInitialRadius * 1.175; for (int k = 0; k < n; ++k) { float angle = ((float)k / (float)n) * MathUtil.TwoPIf; double x = Math.Cos(angle), y = Math.Sin(angle); Vector3d v = new Vector3d(x, 0, y); v.Normalize(); double far_r = ((k + n45) % n90) == 0 ? r90 : (((k + n45) % n45) == 0 ? r45 : r2); lines.Segments.Add(new Segment3d(r * v, far_r * v)); } lines.Width = 1.0f; lines.WidthType = LineWidthType.Pixel; lines.Color = Colorf.DimGrey; snap_indicator = new fLineSetGameObject(new GameObject(), lines, "indicator"); snap_indicator.SetLayer(FPlatform.WidgetOverlayLayer, true); RootGameObject.AddChild(snap_indicator, false); } snap_indicator.SetVisible(enable); }
public static void RemoveLineSet(fLineSetGameObject source) { int layer = source.GetLayer(); GlobalLineRenderers[layer].RemoveLineSet(source); }
public static void ChangeLayer(fLineSetGameObject source, int fromLayer, int toLayer) { GlobalLineRenderers[fromLayer].RemoveLineSet(source); GlobalLineRenderers[toLayer].AddLineSet(source, source.Lines); }
public static void AddLineSet(fLineSetGameObject source) { int layer = source.GetLayer(); GlobalLineRenderers[layer].AddLineSet(source, source.Lines); }
public BasicCameraGrid(string name = "basic_grid") : base(name) { grid_xy = new fLineSetGameObject("lines_xy"); RootGameObject.AddChild(grid_xy, false); }