示例#1
0
        /// <summary>
        /// Metoda slouzi k automatickemu vygenerovani svetel na scenu v pozadovanem poctu
        /// </summary>
        /// <param name="random">Random generator cisel</param>
        private void CreateLights(Random random)
        {
            Lights = new List <Light>();

            for (int i = 0; i < lightCount; ++i)
            {
                Sphere sphere = new Sphere(new Material(Vector.RandomColor),
                                           new Vector(0.0, 1.0, 0.0) + Vector.RandomPointInSphere(radius),
                                           0.5 + random.NextDouble());
                Lights.Add(new Light(sphere));
            }
        }
示例#2
0
        /// <summary>
        /// Metoda slouzi k automatickemu vygenerovani objektu na scenu v pozadovanem poctu
        /// </summary>
        /// <param name="random">Random generator cisel</param>
        private void CreateShapes(Random random)
        {
            Shapes = new List <Shape>();

            double width, height, depth;
            int    randInt = 0;

            for (int i = 0; i < shapeCount; ++i)
            {
                randInt = random.Next(2);

                if (randInt == 0)
                {
                    Sphere tmpS = new Sphere(new Material(Vector.RandomColor),
                                             Vector.RandomPointInSphere(radius), 0.5 + random.NextDouble());
                    Shapes.Add(tmpS);
                }
                else if (randInt == 1)
                {
                    width  = 0.5 + random.NextDouble();
                    height = 0.5 + random.NextDouble();
                    depth  = 0.5 + random.NextDouble();

                    Cuboid c = new Cuboid(new Material(Vector.RandomColor),
                                          Vector.RandomPointInCuboid(width, height, depth), width,
                                          height, depth);
                    Shapes.Add(c);
                }

                /*else
                 * {
                 *  depth = 0.5 + random.NextDouble();
                 *
                 *  shapes[i] = new Plane(new Material(Vector.RandomColor),
                 *      Vector.RandomPointInPlane(depth), depth);
                 * }*/
            }
        }