Exemple #1
0
        public Generator()
        {
            for (int i = 0; i < 6; i++)
            {
                myElevationTex[i] = new Texture(WorldParameters.theWorldTextureSize, WorldParameters.theWorldTextureSize, PixelInternalFormat.R32f);
                myElevationTex[i].setName(String.Format("Elevation Tex {0}", i));
                myBiomeTex[i] = new Texture(WorldParameters.theWorldTextureSize, WorldParameters.theWorldTextureSize, PixelInternalFormat.Rgba32f);
                myBiomeTex[i].setName(String.Format("Biome Tex {0}", i));
            }

            myElevationMap = new CubemapTexture(WorldParameters.theWorldTextureSize, WorldParameters.theWorldTextureSize, PixelInternalFormat.R32f);
            myElevationMap.setName("Elevation Cubemap");

            myBiomeMap = new CubemapTexture(WorldParameters.theWorldTextureSize, WorldParameters.theWorldTextureSize, PixelInternalFormat.Rgba32f);
            myBiomeMap.setName("Biome Cubemap");

            List <ShaderDescriptor> shadersDesc = new List <ShaderDescriptor>();

            shadersDesc.Add(new ShaderDescriptor(ShaderType.ComputeShader, "World Editor.shaders.applyElevation-cs.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(shadersDesc);

            myApplyElevationShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            shadersDesc = new List <ShaderDescriptor>();
            shadersDesc.Add(new ShaderDescriptor(ShaderType.ComputeShader, "World Editor.shaders.applyHeat-cs.glsl"));
            sd = new ShaderProgramDescriptor(shadersDesc);
            myApplyHeatShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            shadersDesc = new List <ShaderDescriptor>();
            shadersDesc.Add(new ShaderDescriptor(ShaderType.ComputeShader, "World Editor.shaders.applyMoisture-cs.glsl"));
            sd = new ShaderProgramDescriptor(shadersDesc);
            myApplyMoistureShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            shadersDesc = new List <ShaderDescriptor>();
            shadersDesc.Add(new ShaderDescriptor(ShaderType.ComputeShader, "World Editor.shaders.applyBiome-cs.glsl"));
            sd = new ShaderProgramDescriptor(shadersDesc);
            myGenerateBiomeShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            //setup generators
            myElevationGenerator   = new ModuleTree(WorldParameters.theWorldTextureSize, WorldParameters.theWorldTextureSize);
            myElevationFractals[0] = myElevationGenerator.addModule(Module.Type.Fractal, "fractal0") as Fractal;
            myElevationFractals[1] = myElevationGenerator.addModule(Module.Type.Fractal, "fractal") as Fractal;
            myElevationFractals[2] = myElevationGenerator.addModule(Module.Type.Fractal, "fractal2") as Fractal;
            myElevationFractals[3] = myElevationGenerator.addModule(Module.Type.Fractal, "fractal3") as Fractal;
            myElevationFractals[4] = myElevationGenerator.addModule(Module.Type.Fractal, "fractal4") as Fractal;
            myElevationFractals[5] = myElevationGenerator.addModule(Module.Type.Fractal, "fractal5") as Fractal;
            AutoCorrect Eac = myElevationGenerator.addModule(Module.Type.AutoCorect, "autocorrect") as AutoCorrect;

            myHeatGenerator     = createHeatGenerator();
            myMoistureGenerator = createMoistureGenerator();
        }
Exemple #2
0
        public GpuNoiseCubeMap(int width, int height, float seed = 0.0f)
        {
            myWidth  = width;
            myHeight = height;
            mySeed   = seed;

            for (int i = 0; i < 6; i++)
            {
                myTextures[i]     = new Texture(myWidth, myHeight, PixelInternalFormat.R32f);
                myFractal[i]      = new Fractal(myWidth, myHeight);
                myFractal[i].face = i;
            }

            myCubemap = new CubemapTexture(width, height, PixelInternalFormat.R32f);
            myCubemap.setName("Terrain Cubemap");

            myAutoCorrect = new AutoCorrect(myWidth, myHeight);

            generateTextures();
        }