Beispiel #1
0
        private void SampleGraphicsControl_GraphicsContextCreated(object sender, GraphicsControlEventArgs e)
        {
            GraphicsContext ctx         = e.Context;
            GraphicsSurface framebuffer = e.Framebuffer;

#if DEBUG
            _GeometryClipmapObject = new GeometryClipmapObject(6, 7, _BlockUnit);
#else
            _GeometryClipmapObject = new GeometryClipmapObject(9, 11, _BlockUnit);
#endif

            string workingDir = Directory.GetCurrentDirectory();

            _GeometryClipmapObject.SetTerrainElevationFactory(Path.Combine(workingDir, @"..\..\..\Data\Terrain.vrt"), 45.5, 10.5);

            _GeometryClipmapScene = new SceneGraph();
            _GeometryClipmapScene.AddChild(new SceneGraphCameraObject());
            _GeometryClipmapScene.AddChild(_GeometryClipmapObject);
            _GeometryClipmapScene.Create(ctx);

            // Set projection
            _GeometryClipmapScene.CurrentView.ProjectionMatrix = new PerspectiveProjectionMatrix(
                _ViewFov / 16.0f * 9.0f,
                (float)ClientSize.Width / (float)ClientSize.Height,
                1.0f, _ViewDepth
                );;

            // Clear color
            framebuffer.SetClearColor(new ColorRGBAF(0.0f, 0.0f, 0.0f));
        }