public Hexagon() { mColor1 = Color.Green; mColor2 = Color.DarkGreen; mHexTube = new HexTube(); SetUpVerts(DEFAULT_DEPTH); SetUpIndicies(); SetColorScheme(mColor1, mColor2); // Set the bounding sphere. It is shifted when // the user clicks (since the hex doens't know where // it is) and when the depth is changed. mBoundingSphere = new BoundingSphere(new Vector3(0, 0, DEFAULT_DEPTH), HEX_WIDTH + 0.5f); }
/// <summary> /// Initializes the control. /// </summary> protected override void Initialize() { mPreviousMouseState = Mouse.GetState(); IsDrawingModels = true; IsDrawingWireFrame = true; // Create a Vector Direction Marker vectorDirMarker = new VectorDirectionMarker(GraphicsDevice.Viewport.AspectRatio); // Create a hextube hexTube = new HexTube(); // Create a hexgrid hexGrid = new HexGrid(); HexHelper.GenerateNoise(hexGrid, 0, 3); //hexGrid.SmoothHexesDown(); //hexGrid.SetColorSchemeAll(Color.DarkSeaGreen, Color.DarkOrchid); hexGrid.ClusterColor(1, 4, Color.Red, Color.Pink); // Create our camera. camera = new Camera(GraphicsDevice.Viewport.AspectRatio); // Create our effect. effect = new BasicEffect(GraphicsDevice); // Enable to allow color effect.VertexColorEnabled = true; // Start the animation timer. timer = Stopwatch.StartNew(); // Hook the idle event to constantly redraw our animation. Application.Idle += delegate { Invalidate(); }; }