Exemplo n.º 1
0
        public static SmallQuadNode Create()
        {
            var model = new SmallQuadModel();
            var vs    = new VertexShader(vertexCode);
            var fs    = new FragmentShader(fragmentCode);
            var array = new ShaderArray(vs, fs);
            var map   = new AttributeMap();

            map.Add("inPosition", SmallQuadModel.strPosition);
            map.Add("inColor", SmallQuadModel.strColor);
            var builder = new RenderMethodBuilder(array, map);
            var node    = new SmallQuadNode(model, builder);

            node.Initialize();

            return(node);
        }
Exemplo n.º 2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            var position = new vec3(1, 0.6f, 1) * 14;
            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);
            this.scene.RootElement = SmallQuadNode.Create();

            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);
        }