Ejemplo n.º 1
0
        private void withTextureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const string FILE_NAME = "./EarthTextureSmall.bmp";

            if (File.Exists(FILE_NAME))
            {
                Bitmap bitmap = (Bitmap)Image.FromFile(FILE_NAME);
                viewer3D.AddTexture(bitmap);
                Scene3D scene = new Scene3D();
                scene.LightList.Add(light);
                sphere = new Sphere3D();
                sphere.Generate(new List <double>()
                {
                    2, 64, 64
                });
                sphere.AmbientColor  = Color.FromArgb(255, 255, 255);
                sphere.DiffuseColor  = Color.FromArgb(255, 255, 255);
                sphere.SpecularColor = Color.White;
                sphere.Shininess     = 20;
                sphere.ShowVertices  = false;
                sphere.ShowWireFrame = false;
                sphere.ShowSurfaces  = true;
                sphere.UseLight      = true;
                sphere.ShadingModel  = ShadingModel.Smooth;
                sphere.SetTexture(1);
                scene.AddObject(sphere);
                viewer3D.Scene = scene;
                viewer3D.Invalidate();
            }
        }