示例#1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //CSharpGL.HowTransformFeedbackWorks.Run();
            var position = new vec3(5, 3, 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.scene.ClearColor = Color.Black.ToVec4();
            {
                //var node = ParticleDemoNode.Create(10000);
                var node   = DemoNode.Create();
                var ground = GroundNode.Create();
                ground.RenderUnit.Methods[0].StateList.Add(new PolygonModeState(PolygonMode.Line));
                var group = new GroupNode(node, ground);
                this.scene.RootElement = group;
            }

            var list            = new ActionList();
            var transformAction = new TransformAction(scene);

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

            list.Add(renderAction);
            this.actionList = list;

            var manipulater = new FirstPerspectiveManipulater();

            manipulater.Bind(camera, this.winGLCanvas1);
        }
示例#2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            var position = new vec3(5, 3, 4) * 0.2f;
            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.scene.ClearColor = Color.Black.ToVec4();
            {
                var node   = DemoNode.Create();
                var ground = GroundNode.Create();
                ground.RenderUnit.Methods[0].SwitchList.Add(new PolygonModeSwitch(PolygonMode.Line));
                ground.EnableRendering = ThreeFlags.None;
                var group = new GroupNode(node, ground);
                this.scene.RootNode = group;
            }

            var list            = new ActionList();
            var transformAction = new TransformAction(scene.RootNode);

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

            list.Add(renderAction);
            this.actionList = list;

            var manipulater = new FirstPerspectiveManipulater();

            manipulater.Bind(camera, this.winGLCanvas1);
        }
示例#3
0
        private SceneNodeBase GetTree()
        {
            var node   = ParticleNode.Create();
            var ground = GroundNode.Create();
            var group  = new GroupNode(ground, node);

            this.particleNode = node;

            return(group);
        }
示例#4
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            var position = new vec3(5, 3, 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.teapot = TeapotNode.Create();
            teapot.Children.Add(new LegacyBoundingBoxNode(teapot.ModelSize));
            var ground = GroundNode.Create(); ground.Color = Color.Gray.ToVec4(); ground.Scale *= 10; ground.WorldPosition = new vec3(0, -3, 0);

            this.textNode = new DirectTextNode()
            {
                Text = "Color Coded Picking"
            };
            var group = new GroupNode(this.teapot, ground, this.textNode);

            this.scene = new Scene(camera, this.winGLCanvas1)
            {
                RootElement = group,
            };

            var list            = new ActionList();
            var transformAction = new TransformAction(scene);

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

            list.Add(renderAction);
            this.actionList = list;

            this.pickingAction = new PickingAction(scene);

            this.triangleTip = new LegacyTriangleNode();
            this.quadTip     = new LegacyQuadNode();
            this.chkRenderWireframe_CheckedChanged(this.chkRenderWireframe, EventArgs.Empty);
            this.chkRenderBody_CheckedChanged(this.chkRenderBody, EventArgs.Empty);

            // uncomment these lines to enable manipualter of camera!
            //var manipulater = new FirstPerspectiveManipulater();
            //manipulater.BindingMouseButtons = System.Windows.Forms.MouseButtons.Right;
            //manipulater.Bind(camera, this.winGLCanvas1);
        }