Пример #1
0
        public RT.Scene createScene()
        {
            float kd = 0.6f;
            float ka = 0.4f;
            int maxr = 15;

            RT.Scene scene = new RT.Scene();
            RT.Group world = new RT.Group();
            System.Random rand = new System.Random();
            for (int i = 0; i < 60; i++)
            {

                float x = (float)((i * 300) % (maxr * 1000)) / 1000;
                float y = (float)((i * 600) % (maxr * 1000)) / 1000;
                float z = (float)((i * 900) % (maxr * 1000)) / 3000;

                world.addObject(new RT.Sphere(
                   new RT.LambertianMaterial(new RT.Color(0.4f, 0.9f, 0.3f), kd, ka),
                   new RT.Point(-(float)maxr * 0.5f + x, -(float)maxr * 0.5f + y, z), 0.3f));

            }

            world.addObject(new RT.Plane(new RT.LambertianMaterial(
               new RT.Color(0.8f, 0.8f, 0.8f), kd, ka), new RT.Vector(0, 0, 1),
               new RT.Point(0, 0, -0.1f)));

            scene.setObject(world);

            scene.setBackground(new RT.ConstantBackground(
               new RT.Color(0.0f, 0.0f, 0.0f)));

            scene.setAmbient(new RT.Color(ka, ka, ka));

            scene.addLight(new RT.PointLight(new RT.Point(20, -30, 100),
               new RT.Color(0.9f, 0.9f, 0.9f)));

            scene.setCamera(new RT.PinholeCamera(new RT.Point(12, -12, 7),
               new RT.Point(1, 1, 2), new RT.Vector(0, 0, 1), 60));

            return scene;
        }