public void GenerateModelEventHandler(ModelControl sender, GenerateModelEventArgs args)
 {
     if (args.Type == GenerateModelEventArgs.ModelType.SuperquadricToroid)
     {
         _toroid.SetPhiResolParam(args.PhiParam);
         _toroid.SetThetaResolParam(args.ThetaParam);
         _toroid.SetXCompParam(args.XScale);
         _toroid.SetYCompParam(args.YScale);
         _toroid.SetZCompParam(args.ZScale);
         _toroid.ReconstructModel();
         SceneElements.Clear();
         SceneElements.Add(_toroid);
     }
     else
     {
         _hyperboloid.SetPhiResolParam(args.PhiParam);
         _hyperboloid.SetThetaResolParam(args.ThetaParam);
         _hyperboloid.SetXCompParam(args.XScale);
         _hyperboloid.SetYCompParam(args.YScale);
         _hyperboloid.SetZCompParam(args.ZScale);
         _hyperboloid.ReconstructModel();
         SceneElements.Clear();
         SceneElements.Add(_hyperboloid);
     }
 }
Пример #2
0
 public void OnKeyPress(string key)
 {
     if (key.Contains("F", StringComparison.CurrentCultureIgnoreCase))
     {
         generate = !generate;
     }
     if (generate)
     {
         _village.Generate(); SceneElements.Clear(); SceneElements.AddRange(_village.GetRenderables());
     }
 }
Пример #3
0
        public void OnMouseDown(Coordinate position)
        {
            _village.Attractors.Add(new Attractor(_focusAttractor));
            float      scaleX = 1920 / (2 * RenderableTerrainObject.MaxTerrainOffsetX);
            float      scaleY = -1080 / (2 * RenderableTerrainObject.MaxTerrainOffsetY);
            Coordinate coord  = new Coordinate(position.XCoord / scaleX, position.YCoord / scaleY, 0);

            coord.XCoord -= RenderableTerrainObject.MaxTerrainOffsetX;
            coord.YCoord += RenderableTerrainObject.MaxTerrainOffsetY;
            _village.Attractors.Last().Coord = coord;
            if (generate)
            {
                _village.Generate(); SceneElements.Clear(); SceneElements.AddRange(_village.GetRenderables());
            }
        }