예제 #1
0
    public void Update()
    {
        // ----- These Filter.Set calls are an editor thing ----
        //    In most cases, you'll have a point in your code when a value changes.
        //    Set them then rather than spamming them like this
        //    (we just unfortunately don't get any events when the inspector changes).

        // Update properties (note that this can be sped up by caching the property references - they don't do all that much anyway):
        Filter.Set("contours", Contours);
        Filter.Set("uniformity", Uniformity);
        Filter.Set("frequency", Frequency);

        // Render it now:
        // Filter.Draw renders it 'live' meaning the result is a RenderTexture.
        // This is better than constantly going from a RT to a Tex2D (but note that it only actually redraws when you call Draw).
        Texture newResult = Filter.Draw(DrawInfo);

        if (Result != newResult)
        {
            Result = newResult;

            // Update element (getById is short for obtaining it as a HtmlElement):
            PowerUI.UI.document.getById("loonim-image").image = Result;
        }
    }