Beispiel #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            var teapot = TeapotRenderer.Create();

            this.teapot = teapot;

            int width = 400, height = 200;
            var rtt = new RTTRenderer(width, height, new Camera(new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, width, height));

            rtt.Children.Add(teapot);// rendered to framebuffer, then to texture.
            this.rtt = rtt;

            var rectangle = RectangleRenderer.Create();

            //var rectangle = new LegacyRectangleRenderer();//LegacyRectangleRenderer dosen't work in rendering-to-texture.
            rectangle.TextureSource = rtt;
            rectangle.Scale         = new vec3(7, 7, 7);
            this.rectangle          = rectangle;

            var group = new GroupRenderer();

            group.Children.Add(rtt);
            group.Children.Add(rectangle);

            var position = new vec3(5, 1, 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)
            {
                ClearColor  = Color.SkyBlue.ToVec4(),
                RootElement = group,
            };
        }
Beispiel #2
0
        private RendererBase GetPropellerRTT()
        {
            var teapot = TeapotRenderer.Create();

            teapot.Scale *= 0.5f;

            int width = 600, height = 400;
            var innerCamera = new Camera(new vec3(0, 2, 5), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Ortho, width, height);
            var rtt         = new RTTRenderer(width, height, innerCamera);

            rtt.Children.Add(teapot);

            var billboard = TextureBillboardRenderer.Create(rtt as ITextureSource, width, height);

            var group = new GroupRenderer();

            group.Children.Add(rtt);                    // rtt must be before billboard.
            group.Children.Add(billboard);
            group.WorldPosition = new vec3(3, 0.5f, 0); // this looks nice.

            var propeller = GetPropellerFlabellum();

            propeller.Children.Add(group);

            return(propeller);
        }
Beispiel #3
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 = TeapotRenderer.Create();
            teapot.Children.Add(new LegacyBoundingBoxRenderer(teapot.ModelSize));

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