Exemplo n.º 1
0
    void Start()
    {
        /*switch (QualitySettings.GetQualityLevel())
         * {
         *      case 0:
         *              TextureSize = 512;
         *              SubdivisionLevel = 6;
         *              break;
         *      case 1:
         *              TextureSize = 512;
         *              SubdivisionLevel = 7;
         *              break;
         *      case 2:
         *              TextureSize = 1024;
         *              SubdivisionLevel = 7;
         *              break;
         * }*/

        fbmgpu = new FBMGPU(FBMGPUProgram, MethodName);
        fbmgpu.Setup(NoiseOctaves, NoisePersistence);
        fbmgpu.Iterations = NoiseIterations;
        fbmgpu.Gamma      = 2f;

        texfbmgpu = new FBMGPU(FBMGPUProgram, TexMethodName);
        texfbmgpu.Setup(TexNoiseOctaves, TexNoisePersistence);
        texfbmgpu.Iterations = TexNoiseIterations;
        texfbmgpu.Gamma      = 2f;

        nmapgpu = new GPUTextureProcessor <Vector3, Vector3>(NormalMapGPUProgram, "NormalMap3x3", 1, 3, 3);

        geo                        = new GeoSphere();
        geo.Noise                  = fbmgpu;
        geo.NoiseScale             = NoiseScale;
        geo.NoiseGenFrames         = NoiseGenFrames;
        geo.TargetSubdivisionLevel = SubdivisionLevel;
        geo.NoiseSpaceScale        = NoiseSpaceScale;
        geo.TexNoiseSpaceScale     = TexNoiseSpaceScale;
        geo.BuildAtmosphere        = BuildAtmosphere;

        geo.TexNoises[0] = texfbmgpu;
        geo.TextureSize  = TextureSize;

        geo.NormalMapGenerator = nmapgpu;

        ProgressText = GameObject.Find("ProgressText").GetComponent <GUIText>() as GUIText;

        geo.StartBuilding();
    }
Exemplo n.º 2
0
    void Start()
    {
        fbmgpu = new FBMGPU(FBMGPUProgram, MethodName);

        Vector3[] points = new Vector3[Width * Height];
        for (int x = 0; x < Width; x++)
        {
            for (int y = 0; y < Height; y++)
            {
                points[x + y * Height] = new Vector3((x / (float)(Width) - 0.5f + 10f) * Scale, (y / (float)(Height) - 0.5f) * Scale, 0f);
            }
        }

        fbmgpu.Start(points, 32);
        fbmgpu.Setup(Octaves, Persistence);
        fbmgpu.Gamma      = Gamma;
        fbmgpu.Iterations = Iterations;
    }