Beispiel #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            SceneNodeBase rootElement = GetRootElement();

            var position = new vec3(1, 0, 4);
            var center   = new vec3(0, 0, 0);
            var up       = new vec3(0, 1, 0);
            var camera   = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height);

            this.scene = new Scene(camera, this.winGLCanvas1)
            {
                RootElement = rootElement,
                ClearColor  = Color.SkyBlue.ToVec4(),
            };

            var list = new ActionList();

            var transformAction = new TransformAction(scene);

            list.Add(transformAction);
            var renderAction = new RenderAction(scene);

            list.Add(renderAction);

            var guiLayoutAction = new GUILayoutAction(scene);

            list.Add(guiLayoutAction);
            var guiRenderAction = new GUIRenderAction(scene);

            list.Add(guiRenderAction);

            this.actionList = list;

            MessageBox.Show("Press 'n' to switch texture indexes!");
        }
Beispiel #2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            SceneNodeBase rootElement = GetRootElement();
            WinCtrlRoot   rootControl = GetRootControl();

            var position = new vec3(1, 0, 4);
            var center   = new vec3(0, 0, 0);
            var up       = new vec3(0, 1, 0);
            var camera   = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height);

            this.scene = new Scene(camera)

            {
                RootElement = rootElement,
                RootControl = rootControl,
                ClearColor  = Color.SkyBlue.ToVec4(),
            };
            rootControl.Bind(this.winGLCanvas1);

            var list = new ActionList();

            var transformAction = new TransformAction(scene);

            list.Add(transformAction);
            var renderAction = new RenderAction(scene);

            list.Add(renderAction);

            var guiLayoutAction = new GUILayoutAction(scene);

            list.Add(guiLayoutAction);
            var guiRenderAction = new GUIRenderAction(scene);

            list.Add(guiRenderAction);

            this.actionList = list;

            Match(this.trvSceneObject, scene.RootElement);
            this.trvSceneObject.ExpandAll();

            Match(this.trvSceneGUI, scene.RootControl);
            this.trvSceneGUI.ExpandAll();
        }