Пример #1
0
        static void Main(string[] args)
        {
            Camera camera = new Camera(0, 0, Vector3D.Zero);
            World world = new World(camera, new Viewport(640, 640));

            BasicMaterialProperties bmp1 = new BasicMaterialProperties(Color.Red, 0.2f, 0.8f);
            BasicMaterialProperties bmp2 = new BasicMaterialProperties(Color.Blue, 0.2f, 0.8f);
            BasicMaterialProperties bmp3 = new BasicMaterialProperties(Color.White, 0.2f, 0.8f);
            Material red = new Material(bmp1, true, world);
            Material blue = new Material(bmp2, true, world);
            Material white = new Material(bmp3, true, true, 3f, world);
            SceneObject s1 = new SceneObject(new Sphere(50, new Vector3D(50, 0, 100)), red);
            SceneObject s2 = new SceneObject(new Sphere(50, new Vector3D(0, -30, 100)), white);
            SceneObject s3 = new SceneObject(new Sphere(50, new Vector3D(-50, 0, 100)), blue);
            BasicMaterialProperties bmp4 = new BasicMaterialProperties(Color.White, 0, 1);
            Material green = new Material(bmp4, true, world);
            SceneObject pl = new SceneObject(new CircularFrame(new Vector3D(0, 0, 180), 200,
                new Plane(new Vector3D(0, 0, 160), new Vector3D(0, 1, 1))), green);

            world.AddLight(new Light(new Vector3D(0, 60, 100f)));
            world.AddSceneObject(s1);
            world.AddSceneObject(s2);
            world.AddSceneObject(s3);
            world.AddSceneObject(pl);

            world.Render().Save("rendered3.png");
        }
Пример #2
0
 public SceneObject(Geometry geometry, Material material)
 {
     this.geometry = geometry;
     this.material = material;
     this.material.SceneObject = this;
 }
Пример #3
0
 public VoidMaterial()
 {
     this.material = new Material(new BasicMaterialProperties(Color.Black, 0f, 0f), false, true, 1f, null);
 }