Ejemplo n.º 1
0
        private void surfacesWireframeAndVerticesSmoothShadingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            sphere = new Sphere3D();
            sphere.Generate(new List <double>()
            {
                2, 64, 64
            });
            Scene3D scene = new Scene3D();

            scene.LightList.Add(light);
            scene.AddObject(sphere);
            sphere.AmbientColor  = Color.FromArgb(0, 255, 0);
            sphere.DiffuseColor  = Color.FromArgb(0, 255, 0);
            sphere.SpecularColor = Color.White;
            sphere.Shininess     = 20;
            sphere.SetUniformColor(Color.White); // This color is used ONLY for the wireframe.
            sphere.ShowVertices   = true;
            sphere.ShowWireFrame  = true;
            sphere.ShowSurfaces   = true;
            sphere.WireFrameWidth = 1.5f;
            sphere.VertexSize     = 2.5f;
            sphere.UseLight       = true;
            sphere.ShadingModel   = ShadingModel.Smooth;
            sphere.Alpha          = 0.5f;
            viewer3D.Scene        = scene;
        }
Ejemplo n.º 2
0
        private void noLightToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Scene3D scene = new Scene3D();

            scene.AddObject(sphere);
            sphere = new Sphere3D();
            sphere.Generate(new List <double>()
            {
                2, 64, 64
            });
            sphere.SetUniformColor(Color.FromArgb(0, 255, 0));
            scene.LightList           = new List <Light>();
            viewer3D.Scene            = scene;
            viewer3D.UseSmoothShading = false;
        }
Ejemplo n.º 3
0
        private void wireframeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            sphere = new Sphere3D();
            sphere.Generate(new List <double>()
            {
                2, 64, 64
            });
            Scene3D scene = new Scene3D();

            scene.AddObject(sphere);
            sphere.SetUniformColor(Color.FromArgb(255, 255, 255));
            sphere.ShowVertices   = false;
            sphere.ShowWireFrame  = true;
            sphere.ShowSurfaces   = false;
            sphere.WireFrameWidth = 1f;
            viewer3D.Scene        = scene;
        }
Ejemplo n.º 4
0
        private void surfacesNoLightToolStripMenuItem_Click(object sender, EventArgs e)
        {
            sphere = new Sphere3D();
            sphere.Generate(new List <double>()
            {
                2, 64, 64
            });
            Scene3D scene = new Scene3D();

            scene.LightList.Add(light);
            scene.AddObject(sphere);
            sphere.SetUniformColor(Color.FromArgb(0, 255, 0));
            sphere.ShowVertices  = false;
            sphere.ShowWireFrame = false;
            sphere.ShowSurfaces  = true;
            sphere.UseLight      = false;
            sphere.ShadingModel  = ShadingModel.Flat;
            scene.LightList      = new List <Light>();
            viewer3D.Scene       = scene;
        }
Ejemplo n.º 5
0
        private void translucentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            sphere = new Sphere3D();
            sphere.Generate(new List <double>()
            {
                2, 64, 64
            });
            Scene3D scene = new Scene3D();

            scene.LightList.Add(light);
            scene.AddObject(sphere);
            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.SetAlpha(0.5f);
            Sphere3D smallSphere = new Sphere3D();

            smallSphere.Generate(new List <double>()
            {
                1.5, 64, 64
            });
            smallSphere.AmbientColor  = Color.FromArgb(0, 0, 255);
            smallSphere.DiffuseColor  = Color.FromArgb(0, 0, 255);
            smallSphere.SpecularColor = Color.White;
            smallSphere.Shininess     = 20;
            smallSphere.SetUniformColor(Color.White); // This color is used ONLY for the wireframe.
            smallSphere.ShowVertices  = false;
            smallSphere.ShowWireFrame = false;
            smallSphere.ShowSurfaces  = true;
            smallSphere.UseLight      = true;
            smallSphere.ShadingModel  = ShadingModel.Smooth;
            scene.AddObject(smallSphere);
            scene.SortForTranslucence();
            viewer3D.Scene = scene;
        }