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 GameObject Parse(string LevelName) { this.LevelName = LevelName; Logger.Log.Debug("Parsing " + LevelName + " from " + _filePath + " file"); RootGameObject RootObject = new RootGameObject(); JObject LevelObject = JObject.Parse(File.ReadAllText(_filePath)).GetValue(LevelName).ToObject <JObject>(); if (LevelObject == null) { throw new ArgumentNullException(_filePath + " does not containt key " + LevelName); } RootObject.Name = LevelObject.GetValue("Name").ToString(); RootObject.Type = LevelObject.GetValue("Type").ToString(); Level.GetCurrentLevel().RootGameObject = RootObject; for (int i = 0; i < LevelObject.GetValue("Child").Count(); i++) { RootObject.AddChild(ParseGameObject(LevelObject.GetValue("Child")[i] as JObject)); } Logger.Log.Debug("File " + _filePath + "parsed successfully"); return(RootObject); }
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 BasicCameraGrid(string name = "basic_grid") : base(name) { grid_xy = new fLineSetGameObject("lines_xy"); RootGameObject.AddChild(grid_xy, false); }