Exemple #1
0
 private void Start()
 {
     bg.SetActive(true);
     ResetTriggers();
     videoTex.Release();
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
 }
Exemple #2
0
        public void OnDestroy()
        {
            // since we are using threads to do our work (networking, ..)
            // away of unity's default classes, we need to shutdown things
            // to avoid errors in the console while debugging

            if (ProtocolGame != null && ProtocolGame.IsGameRunning)
            {
                ProtocolGame.Disconnect(); // force disconnection (by trying to logout)
            }
            AppearanceStorage.UnloadSpriteProvider();

            OnSecondaryTimeCheck.RemoveAllListeners();
            CancelInvoke("SecondaryTimerCheck");
            CancelInvoke("SaveMiniMap");

            OptionStorage     = null;
            InputHandler      = null;
            AppearanceStorage = null;
            CreatureStorage   = null;
            MiniMapStorage    = null;
            MiniMapRenderer   = null;
            WorldMapStorage   = null;
            WorldMapRenderer  = null;
            ChatStorage       = null;
            MessageStorage    = null;

            WorldMapRenderingTexture.Release();
            MiniMapRenderingTexture.Release();
        }
    /// <summary>
    /// ペイント用テクスチャをリセット
    /// </summary>
    /// <param name="recreate">テクスチャを再生成するか</param>
    private void ResetPaintTexture(bool recreate)
    {
        if (recreate && paintTexture != null)
        {
            // CustomRenderTexture.Initialize()では_SelfTexture2Dが初期化されないため,新たにCustomRenderTextureを作成する
            var tmpTexture = new CustomRenderTexture(paintTexture.width, paintTexture.height, paintTexture.format, RenderTextureReadWrite.Default)
            {
                material              = paintTexture.material,
                initializationSource  = paintTexture.initializationSource,
                initializationColor   = paintTexture.initializationColor,
                initializationTexture = paintTexture.initializationTexture,
                initializationMode    = paintTexture.initializationMode,
                updateMode            = paintTexture.updateMode,
                doubleBuffered        = paintTexture.doubleBuffered
            };
            tmpTexture.Create();
            paintTexture.Release();
            paintTexture = tmpTexture;
        }

        paintTexture.Initialize();

        // メインテクスチャにセット
        paintRenderer.material.mainTexture = paintTexture;
    }
        public void ClearAndSetCanvasBackground(Texture2D background)
        {
            if (colorTexture)
            {
                colorTexture.Release();
            }
            if (maskTexture)
            {
                maskTexture.Release();
            }

            maskTexture = new CustomRenderTexture(1024, 1024, RenderTextureFormat.ARGB64);

            colorTexture = new CustomRenderTexture(1024, 1024, RenderTextureFormat.ARGB64);

            colorMaterial.SetTexture(SplatMap, colorTexture);

            maskMaterial.SetTexture(SplatMap, maskTexture);

            mergeMaterial.SetTexture(MaskMap, maskTexture);

            mergeMaterial.SetTexture(ColorMap, colorTexture);

            mergeMaterial.SetTexture(BaseTexture, background);

            print(background);
        }
Exemple #5
0
 private void OnDestroy()
 {
     m_Light.cookie = null;
     if (m_customRenderTexture != null)
     {
         m_customRenderTexture.Release();
     }
     if (Application.isPlaying)
     {
         if (m_customRenderTexture != null)
         {
             Destroy(m_customRenderTexture);
         }
         if (m_material != null)
         {
             Destroy(m_material);
         }
     }
     else
     {
         if (m_customRenderTexture != null)
         {
             DestroyImmediate(m_customRenderTexture);
         }
         if (m_material != null)
         {
             DestroyImmediate(m_material);
         }
     }
 }
    IEnumerator Export()
    {
        CustomRenderTexture exportRT = NoiseTexGenerator.GenerateNoise2DBlendRT(blendMaterial, width, height);

        yield return(null);

        NoiseTexGenerator.ExportNoiseRTToPNG(exportRT);
        exportRT.Release();
    }
    IEnumerator Export()
    {
        CustomRenderTexture exportRT = NoiseTexGenerator_Single.GenerateNoiseRT(t, scale, width, height, depth);

        yield return(null);

        NoiseTexGenerator.ExportNoiseRTToPNG(exportRT);
        exportRT.Release();
    }
Exemple #8
0
 /// <summary>
 /// Forces the volume map cells to be the closest possible to the specified size
 /// </summary>
 /// <param name="size">Uniform size desired for a single cell</param>
 public void ForceCellSize(float size)
 {
     volumeMap.Release();
     volumeMap.width       = Mathf.CeilToInt(transform.lossyScale.x / size);
     volumeMap.height      = Mathf.CeilToInt(transform.lossyScale.y / size);
     volumeMap.volumeDepth = Mathf.CeilToInt(transform.lossyScale.z / size);
     volumeMap.Create();
     InitializeVolumeMap();
 }
Exemple #9
0
 void OnEnable()
 {
     _instance = this;
     renderTexture.Release();
     renderTexture.width  = Screen.width;
     renderTexture.height = Screen.height;
     renderTexture.Initialize();
     // _renderer = GetComponent<Renderer>();
     // renderTexture = new RenderTexture(Screen.width, Screen.height, 0);
     // renderTexture.Create();
     // RenderPipelineManager.endFrameRendering += BlitTexture;
 }
Exemple #10
0
        public void Dispose()
        {
            if (writableTexture != null)
            {
                writableTexture.DiscardContents();
                writableTexture.Release();
            }

            Destroy(ref material);
            Destroy(ref writableTexture);
            Destroy(ref readableTexture);
        }
Exemple #11
0
        public override void Disable()
        {
            buffer0.Release();
            buffer1.Release();
            DestroyImmediate(buffer0);
            DestroyImmediate(buffer1);

            DestroyImmediate(updateMat);
            buffer0   = null;
            buffer1   = null;
            updateMat = null;
        }
Exemple #12
0
    IEnumerator Export()
    {
        CustomRenderTexture exportRT = NoiseTexGenerator.GenerateNoise2DBlendRT(blendMaterial, width, height);

        yield return(null);

        NoiseTexGenerator.ExportNoiseRTToPNG(exportRT);
        exportRT.Release();
        for (int i = 0; i < NoiseTexGenerator.NOISE_NUM; i++)
        {
            oldType[i] = NoiseTexGenerator.Noise2DType.NeedChange;
        }
        win.Repaint();
    }
Exemple #13
0
        private void OnValidate()
        {
            height = (int)Mathf.Max(height, 1f);

            if (cachedHeight == height)
            {
                return;
            }

            if (screen == null)
            {
                return;
            }

            screen.Release();

            screen = new CustomRenderTexture((int)(height * mainCamera.aspect), height)
            {
                filterMode = FilterMode.Point
            };
            screen.Create();

            cachedHeight = height;
        }
    IEnumerator ExportTex3D(bool isPNG)
    {
        CustomRenderTexture exportRT = NoiseTexGenerator_Single.GenerateNoiseRT(t, scale, width, height, depth);

        yield return(null);

        if (isPNG)
        {
            NoiseTexGenerator.SaveRTToPNG(exportRT, width, height, depth);
        }
        else
        {
            NoiseTexGenerator.SaveToTex3D(exportRT, width, height, depth);
        }
        NoiseTexGenerator.SetMaterial();
        exportRT.Release();
    }
Exemple #15
0
    /// <summary>
    /// Creates a render texture for use with the compute shader
    /// </summary>
    private void initRenderTexture()
    {
        if (_target == null || _target.width != Screen.width || _target.height != Screen.height)
        {
            // Release render texture if we already have one
            if (_target != null)
            {
                _target.Release();
            }

            // Get a render target for Ray Tracing
            _target                   = new CustomRenderTexture(Screen.width, Screen.height, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear);
            _target.material          = renderMaterial;
            _target.enableRandomWrite = true;
            _target.Create();
        }
    }
    IEnumerator ExportTex3D(bool isPNG)
    {
        CustomRenderTexture exportRT = NoiseTexGenerator.GenerateNoise3DBlendRT(blendMaterial, width, height, depth);

        yield return(null);

        if (isPNG)
        {
            NoiseTexGenerator.SaveRTToPNG(exportRT, width, height, depth);
        }
        else
        {
            NoiseTexGenerator.SaveToTex3D(exportRT, width, height, depth);
        }
        exportRT.Release();
        for (int i = 0; i < NoiseTexGenerator.NOISE_NUM; i++)
        {
            oldType[i] = NoiseTexGenerator.Noise3DType.NeedChange;
        }
        win.Repaint();
    }
    public static void Clear()
    {
        if (t_Blend2D != null)
        {
            t_Blend2D.Release();
        }
        if (t_Blend3D != null)
        {
            t_Blend3D.Release();
        }

        for (int i = 0; i < crtList.Length; i++)
        {
            if (crtList[i] != null)
            {
                crtList[i].Release();
                crtList[i] = null;
            }
        }
        for (int i = 0; i < crtMatList.Length; i++)
        {
            if (crtMatList[i] != null)
            {
                Object.DestroyImmediate(crtMatList[i]);
                crtMatList[i] = null;
            }
        }

        if (m_Blend2D != null)
        {
            Object.DestroyImmediate(m_Blend2D);
        }
        if (m_Blend3D != null)
        {
            Object.DestroyImmediate(m_Blend3D);
        }
    }
 private void OnDestroy()
 {
     _brushes.Clear();
     maskTexture.Release();
 }
 void OnDestroy()
 {
     render_texture.Release();
     compute_buffer.Release();
 }