Exemplo n.º 1
0
        public void GlobalSetUp()
        {
            randomTriangles = new Vector3[TRIANGLE_COUNT * 3];
            for (int i = 0; i < TRIANGLE_COUNT * 3; i++)
            {
                randomTriangles[i] = RNG.RandomVector3();
            }

            origin = RNG.RandomVector3();
            direction = RNG.RandomVector3();
            direction.Normalize();
            testRay = new Ray(origin, direction);

            randomRays = new Ray[RAY_COUNT];
            for (int i = 0; i < RAY_COUNT; i++)
            {
                Vector3 thisOrigin = RNG.RandomVector3();
                Vector3 thisDirection = RNG.RandomVector3();
                thisDirection.Normalize();
                randomRays[i] = new Ray(thisOrigin, thisDirection);
            }

            heightmap = new float[256 * 256];
            for (int y = 0; y < 256; y++)
            {
                for (int x = 0; x < 256; x++)
                {
                    heightmap[y * 256 + x] = (float)Math.Max(RNG.NextGaussian(25.0, 10.0), 0);
                }
            }
        }
Exemplo n.º 2
0
        public void GlobalSetUp()
        {
            randomTriangles = new Vector3[TRIANGLE_COUNT * 3];
            for (int i = 0; i < TRIANGLE_COUNT * 3; i++)
            {
                randomTriangles[i] = RNG.RandomVector3();
            }

            origin    = RNG.RandomVector3();
            direction = RNG.RandomVector3();
            direction.Normalize();
            testRay = new Ray(origin, direction);

            randomRays = new Ray[RAY_COUNT];
            for (int i = 0; i < RAY_COUNT; i++)
            {
                Vector3 thisOrigin    = RNG.RandomVector3();
                Vector3 thisDirection = RNG.RandomVector3();
                thisDirection.Normalize();
                randomRays[i] = new Ray(thisOrigin, thisDirection);
            }

            heightmap = new float[256 * 256];
            for (int y = 0; y < 256; y++)
            {
                for (int x = 0; x < 256; x++)
                {
                    heightmap[y * 256 + x] = (float)Math.Max(RNG.NextGaussian(25.0, 10.0), 0);
                }
            }
        }