示例#1
0
    private Texture2D RenderNorm(IModule module)
    {
        RendererNormal render = new RendererNormal();

        switch ((MAPTYPE)popMapTypes)
        {
        case MAPTYPE.Cylindirical:
            NoiseMapBuilderCylinder buildCylindirical = new NoiseMapBuilderCylinder(textureWidth, textureHeight);
            buildCylindirical.SetBounds(lowerXBound, upperXBound, lowerZBound, upperZBound);
            buildCylindirical.Build(module);
            render.SourceNoiseMap = buildCylindirical.Map;
            break;

        case MAPTYPE.Spherical:
            NoiseMapBuilderSphere buildSpherical = new NoiseMapBuilderSphere(textureWidth, textureHeight);
            buildSpherical.SetBounds(lowerXBound, upperXBound, lowerZBound, upperZBound);
            buildSpherical.Build(module);
            render.SourceNoiseMap = buildSpherical.Map;
            break;

        case MAPTYPE.Planar:
            NoiseMapBuilderPlane buildPlanar = new NoiseMapBuilderPlane(textureWidth, textureHeight);
            buildPlanar.SetBounds(lowerXBound, upperXBound, lowerZBound, upperZBound);
            buildPlanar.Build(module);
            render.SourceNoiseMap = buildPlanar.Map;
            break;

        default:
            break;
        }

        render.BumpHeight = bumpHeight;
        render.Render();
        return(render.GetTexture());
    }
示例#2
0
    private Texture2D RenderTex(IModule module)
    {
        switch ((MAPTYPE)popMapTypes)
        {
        case MAPTYPE.Cylindirical:
            NoiseMapBuilderCylinder buildCylindirical = new NoiseMapBuilderCylinder(textureWidth, textureHeight);
            buildCylindirical.SetBounds(lowerXBound, upperXBound, lowerZBound, upperZBound);
            buildCylindirical.Build(module);
            render.SourceNoiseMap = buildCylindirical.Map;
            break;

        case MAPTYPE.Spherical:
            NoiseMapBuilderSphere buildSpherical = new NoiseMapBuilderSphere(textureWidth, textureHeight);
            buildSpherical.SetBounds(lowerXBound, upperXBound, lowerZBound, upperZBound);
            buildSpherical.Build(module);
            render.SourceNoiseMap = buildSpherical.Map;
            break;

        case MAPTYPE.Planar:
            NoiseMapBuilderPlane buildPlanar = new NoiseMapBuilderPlane(textureWidth, textureHeight);
            buildPlanar.SetBounds(lowerXBound, upperXBound, lowerZBound, upperZBound);
            buildPlanar.IsSeamless = seamlessEnabled;
            buildPlanar.Build(module);
            render.SourceNoiseMap = buildPlanar.Map;
            break;

        default:
            break;
        }

        ImageMap backMap = null;

        if (backgroundTexture != null)
        {
            backMap = new ImageMap(backgroundTexture, Color.gray);
        }

        if (backMap != null)
        {
            render.BackgroundImage = backMap;
        }

        render.IsWrapEnabled   = wrapEnabled;
        render.IsLightEnabled  = lightEnabled;
        render.LightContrast   = lightContrast;
        render.LightAzimuth    = lightAzimuth;
        render.LightBrightness = lightBrightness;
        render.LightColor      = lightColor;
        render.LightContrast   = lightContrast;
        render.LightElev       = lightElevation;
        render.LightIntensity  = lightIntensity;
        render.Render();
        return(render.GetTexture());
    }