コード例 #1
0
 public void Update()
 {
     if (isDistanceMapReady)
     {
         if (m_font_Atlas != null)
         {
             m_destination_Atlas = new Texture2D(m_font_Atlas.width / font_scaledownFactor, m_font_Atlas.height / font_scaledownFactor, TextureFormat.Alpha8, false, true);
             m_destination_Atlas.SetPixels(Output);
             m_destination_Atlas.Apply(false, true);
         }
         isDistanceMapReady = false;
         Repaint();
     }
     if (isRepaintNeeded)
     {
         isRepaintNeeded = false;
         Repaint();
     }
     if (isProcessing)
     {
         m_renderingProgress = TMPro_FontPlugin.Check_RenderProgress();
         isRepaintNeeded     = true;
     }
     if (isRenderingDone)
     {
         isProcessing    = false;
         isRenderingDone = false;
         UpdateRenderFeedbackWindow();
         CreateFontTexture();
     }
 }
コード例 #2
0
        public void Update()
        {
            if (isDistanceMapReady)
            {
                if (m_font_Atlas != null)
                {
                    m_destination_Atlas = new Texture2D(m_font_Atlas.width / font_scaledownFactor, m_font_Atlas.height / font_scaledownFactor, TextureFormat.Alpha8, false, true);
                    m_destination_Atlas.SetPixels(Output);
                    m_destination_Atlas.Apply(false, true);
                }
                //else if (m_texture_Atlas != null)
                //{
                //    m_destination_Atlas = new Texture2D(m_texture_Atlas.width / font_scaledownFactor, m_texture_Atlas.height / font_scaledownFactor, TextureFormat.Alpha8, false, true);
                //    m_destination_Atlas.SetPixels(Output);
                //    m_destination_Atlas.Apply(false, true);
                //}

                isDistanceMapReady = false;
                Repaint();

                // Saving File for Debug
                //var pngData = destination_Atlas.EncodeToPNG();
                //File.WriteAllBytes("Assets/Textures/Debug SDF.png", pngData);
            }

            if (isRepaintNeeded)
            {
                //Debug.Log("Repainting...");
                isRepaintNeeded = false;
                Repaint();
            }

            // Update Progress bar is we are Rendering a Font.
            if (isProcessing)
            {
                m_renderingProgress = TMPro_FontPlugin.Check_RenderProgress();

                isRepaintNeeded = true;
            }

            // Update Feedback Window & Create Font Texture once Rendering is done.
            if (isRenderingDone)
            {
                isProcessing    = false;
                isRenderingDone = false;
                UpdateRenderFeedbackWindow();
                CreateFontTexture();
            }
        }