Ejemplo n.º 1
0
        public void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (_dragging)
            {
                float dx = (float)(e.Y - _oldy) / 50;
                float dy = (float)(_oldx - e.X) / 50;

                if (_controlkey == true)
                {
                    _scene.defaultCamera.shift(0, 0, dx);
                }
                else
                {
                    _scene.rotate(dx, dy, 0);
                }


                _scene.render();

                _oldx = e.X;
                _oldy = e.Y;

                Refresh();
            }
        }
Ejemplo n.º 2
0
        public void DisplayDefaultScene()
        {
            _scene = new warp_Scene(512, 512);

            warp_Material crystal = new warp_Material(warp_TextureFactory.MARBLE(128, 128, .15f));

            _scene.addMaterial("crystal", crystal);

            warp_Material c = (warp_Material)_scene.materialData["crystal"];

            c.setReflectivity(255);
            c.setTransparency(100);

            _scene.environment.setBackground(warp_TextureFactory.CHECKERBOARD(128, 128, 3, 0x000000, 0x999999));

            _scene.addLight("light1", new warp_Light(new warp_Vector(0.2f, 0.2f, 1f), 0xFFFFFF, 320, 80));
            _scene.addLight("light2", new warp_Light(new warp_Vector(-1f, -1f, 1f), 0xffffff, 100, 40));

            warp_Vector[] path = new warp_Vector[15];

            path[0]  = new warp_Vector(0.0f, 0.2f, 0);
            path[1]  = new warp_Vector(0.13f, 0.25f, 0);
            path[2]  = new warp_Vector(0.33f, 0.3f, 0);
            path[3]  = new warp_Vector(0.43f, 0.6f, 0);
            path[4]  = new warp_Vector(0.48f, 0.9f, 0);
            path[5]  = new warp_Vector(0.5f, 0.9f, 0);
            path[6]  = new warp_Vector(0.45f, 0.6f, 0);
            path[7]  = new warp_Vector(0.35f, 0.3f, 0);
            path[8]  = new warp_Vector(0.25f, 0.2f, 0);
            path[9]  = new warp_Vector(0.1f, 0.15f, 0);
            path[10] = new warp_Vector(0.1f, 0.0f, 0);
            path[11] = new warp_Vector(0.1f, -0.5f, 0);
            path[12] = new warp_Vector(0.35f, -0.55f, 0);
            path[13] = new warp_Vector(0.4f, -0.6f, 0);
            path[14] = new warp_Vector(0.0f, -0.6f, 0);

            _scene.addObject("wineglass", warp_ObjectFactory.ROTATIONOBJECT(path, 32));
            _scene.sceneobject("wineglass").setMaterial(_scene.material("crystal"));

            _scene.sceneobject("wineglass").scale(0.8f, 0.8f, 0.8f);
            _scene.sceneobject("wineglass").rotate(0.5f, 0f, 0f);

            _scene.render();

            //Refresh();
        }
Ejemplo n.º 3
0
        public bool Render()
        {
            try
            {
                _scene.render();

                foreach (DictionaryEntry myDE in _plugins)
                {
                    warp_FXPlugin plugin = ( warp_FXPlugin )myDE.Value;
                    plugin.apply();
                }
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }