Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        public bool SetTransparency(string name, int t)
        {
            if (_scene == null)
            {
                return(false);
            }

            warp_Material material = (warp_Material)_scene.materialData[name];

            if (material == null)
            {
                return(false);
            }

            material.setTransparency(t);

            return(true);
        }