Ejemplo n.º 1
0
    public float getNoise(Vector3 p, String channelName)
    {
        //Get the noise value at a certain point on a certain channel
        int channelID = -1;

        for (int n = 0; n < channel.Count; n++) //Convert channelName to channelID
        {
            if (channel[n].name == channelName)
            {
                channelID = n;
            }
        }
        if (channelID == -1)
        {
            ErrorOutput.error("The channel: \"" + channelName + "\" could not be found.");
            return(0.0f);
        }

        float result = getRawNoise(p, channelID);      //Calculate the noise value

        if (channel[channelID].edge == Edge.Sharp)     //If the edge is sharp check whether or not the value is above the threshold
        {
            if (result > channel[channelID].edge_threshold)
            {
                return(channel[channelID].max);
            }
            else
            {
                return(0.0f);
            }
        }
        return(result);
    }