LibNoise.Unity.ModuleBase.GetValue C# (CSharp) Method

GetValue() public method

Returns the output value for the given input coordinates.
public GetValue ( Vector3 coordinate ) : double
coordinate Vector3 The input coordinate.
return double
        public double GetValue(Vector3 coordinate)
        {
            return this.GetValue((double)coordinate.x, (double)coordinate.y, (double)coordinate.z);
        }

Same methods

ModuleBase::GetValue ( double x, double y, double z ) : double

Usage Example

Ejemplo n.º 1
0
    Texture2D AltGenTex(Vector3[] verts, ModuleBase module)
    {
        Texture2D tex = new Texture2D((int) Mathf.Sqrt(verts.Length), (int) Mathf.Sqrt(verts.Length));

        int reso = (int) Mathf.Sqrt(verts.Length);
        int pixelx = 0;
        int pixely = 0;

        for (int i = 0; i < verts.Length; i++)
        {
            verts[i] = transform.TransformPoint(verts[i]);
            if (pixelx == reso)
                {
                    pixelx = 0;
                    pixely += 1;
                }
            float noiseval = (float) module.GetValue(verts[i]);
            noiseval = Mathf.Clamp(noiseval + 0.5f, 0f, 1f);
            Color pixelColor = new Color(noiseval, noiseval, noiseval, 0);
            tex.SetPixel(pixelx, pixely, pixelColor);
            tex.Apply();
            pixelx += 1;
        }

        tex.Apply();
        return tex;
    }
All Usage Examples Of LibNoise.Unity.ModuleBase::GetValue