Beispiel #1
0
 /// <summary>
 /// Posts process filled pixel buffers. Call after Fill or FillRows with the same pixel data.
 /// </summary>
 /// <param name="buffers">The buffers.</param>
 /// <param name="width">Width.</param>
 /// <param name="height">Height.</param>
 /// <param name="normalFormat">Normal format.</param>
 public void PostProcess(Color[][] buffers, int width, int height, DiagramNormalFormat normalFormat)
 {
     for (int i = 0; i < outputs.Length; i++)
     {
         DiagramOutput o = outputs[i];
         if (o.type == DiagramTextureType.NormalMap)
         {
             o.GenerateNormalMap(width, height, buffers[i], normalFormat);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Posts process filled pixel buffer. Call after Fill or FillRows with the same pixel data.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name='outputIndex'>Index of the output to use.</param>
        /// <param name="width">Width.</param>
        /// <param name="height">Height.</param>
        /// <param name="normalFormat">Normal format.</param>
        public void PostProcess(Color[] buffer, int outputIndex, int width, int height, DiagramNormalFormat normalFormat)
        {
            if (outputIndex >= outputs.Length)
            {
                return;
            }
            DiagramOutput o = outputs[outputIndex];

            if (o.type == DiagramTextureType.NormalMap)
            {
                o.GenerateNormalMap(width, height, buffer, normalFormat);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Initialize the diagram.
 ///
 /// Used internally and by editor scripts. Do not invoke it.
 /// </summary>
 public void Init()
 {
     prepared = false;
     if (nodes == null)
     {
         nodes = new DiagramNode[0];
     }
     else
     {
         foreach (DiagramNode node in nodes)
         {
             node.Init(this);
         }
     }
     if (outputs == null || outputs.Length == 0)
     {
         // Generate missing output data.
         if (outputs == null)
         {
             outputs = new DiagramOutput[0];
         }
         for (int i = 0; i < nodes.Length; i++)
         {
             if (nodes[i].Function.type == FunctionType.Output)
             {
                 Array.Resize(ref outputs, outputs.Length + 1);
                 DiagramOutput d = outputs[outputs.Length - 1] = new DiagramOutput();
                 d.name      = "_MainTex";
                 d.nodeIndex = i;
                 d.type      = DiagramTextureType.ARGB;
             }
         }
     }
     if (functionLibraries == null)
     {
         functionLibraries = new FunctionLibrary[0];
     }
 }