Пример #1
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        private void CreateScene()
        {
            //  Create OpenGL.
            gl.Create(RenderContextType.DIBSection, 800, 600, 32, null);

            //   Create the scene object.
            Scene = new Scene() { OpenGL = gl };

            //  Initialise the scene object.
            SharpGL.SceneGraph.Helpers.SceneHelper.InitialiseModelingScene(Scene);

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();

            //  Add it.
            Scene.SceneContainer.AddChild(sphere);

            //  Create the arcball camera.
            var camera = new ArcBallCamera()
            {
                Position = new Vertex(-10, -10, 10)
            };
            Camera = camera;
            Scene.CurrentCamera = camera;
        }
Пример #2
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        private void CreateScene()
        {
            //  Create the perspective camera.
            
            var camera = new ArcBallCamera()
            {
                Name = "Look at camera",
                Position = new Vertex(-10, -10, 10)
            };
            Camera = camera;
            /*
            //  Create the look at camera.
            var camera = new LookAtCamera()
            {
                Name = "Look at camera",
                Position = new Vertex(-10, -10, 10),
                Target = new Vertex(0, 0, 0),
                UpVector = new Vertex(0, 0, 1)
            };*/
            Camera = camera;

            //  Create OpenGL.
            gl.Create(RenderContextType.DIBSection, 800, 600, 32, null);

            //   Create the scene object.
            Scene = new Scene() { OpenGL = gl };

            //  Initialise the scene.
            SceneHelper.InitialiseModelingScene(Scene);
            Scene.CurrentCamera = camera;

            //  Set the polygon mode.
            openGlAttributes = (Scene.SceneContainer.Effects[0] as OpenGLAttributesEffect);
            openGlAttributes.PolygonAttributes.PolygonMode = PolygonMode.Lines;

            //  Set the attributes as a scene level effect.
            Scene.SceneContainer.AddEffect(openGlAttributes);
        }
 internal static bool Equal(ArcBallCamera x, ArcBallCamera y)
 {
     return CamerasEqual(x, y);
 }