GenerateToTexture() public method

Generates to a texture of the given size.
public GenerateToTexture ( int width, int height, TextureFormat fmt = TextureFormat.RGBAFloat, FilterMode filtering = FilterMode.Bilinear, bool mipmaps = true ) : Texture2D
width int
height int
fmt TextureFormat
filtering FilterMode
mipmaps bool
return UnityEngine.Texture2D
Example #1
0
        /// <summary>
        /// Updates the preview texture of the graph's noise.
        /// </summary>
        private void UpdatePreviewTex(RuntimeGraph graph)
        {
            //Make sure the Texture2D is up to date.
            if (graph._PreviewTex == null)
            {
                graph._PreviewTex = new Texture2D(graph._PreviewTexWidth,
                                                  graph._PreviewTexHeight);
            }
            else if (graph._PreviewTex.width != graph._PreviewTexWidth ||
                     graph._PreviewTex.height != graph._PreviewTexHeight)
            {
                graph._PreviewTex.Resize(graph._PreviewTexWidth, graph._PreviewTexHeight);
            }

            graph.GenerateToTexture(graph._PreviewTex, true);
        }
Example #2
0
        /// <summary>
        /// Updates the preview texture of the graph's noise.
        /// </summary>
        private void UpdatePreviewTex(RuntimeGraph graph)
        {
            //Make sure the Texture2D is up to date.
            if (graph._PreviewTex == null)
            {
                graph._PreviewTex = new Texture2D(graph._PreviewTexWidth,
                                                  graph._PreviewTexHeight);
            }
            else if (graph._PreviewTex.width != graph._PreviewTexWidth ||
                     graph._PreviewTex.height != graph._PreviewTexHeight)
            {
                graph._PreviewTex.Resize(graph._PreviewTexWidth, graph._PreviewTexHeight);
            }

            graph.UpdateAllParams();

            //TODO: Maybe using the instance's private fields like this is the cause of some display bugs?
            graph.GenerateToTexture(graph._PreviewTex);
        }