Пример #1
0
        public void Eval(RenderTexture src, RenderTexture dest, RenderTextureCollection rtCollection)
        {
            int count = filters.Count;

            RenderTexture prev = RenderTexture.active;

            RenderTexture[] rts = new RenderTexture[2];

            int srcIndex  = 0;
            int destIndex = 1;

            rts[0] = RenderTexture.GetTemporary(src.descriptor);
            rts[1] = RenderTexture.GetTemporary(src.descriptor);

            Graphics.Blit(src, rts[0]);

            for (int i = 0; i < count; ++i)
            {
                if (filters[i].enabled)
                {
                    filters[i].Eval(rts[srcIndex], rts[destIndex], rtCollection);

                    destIndex += srcIndex;
                    srcIndex   = destIndex - srcIndex;
                    destIndex  = destIndex - srcIndex;
                }
            }

            Graphics.Blit(rts[srcIndex], dest);

            RenderTexture.ReleaseTemporary(rts[0]);
            RenderTexture.ReleaseTemporary(rts[1]);

            RenderTexture.active = prev;
        }
Пример #2
0
        public FilterContext(Terrain t, Vector3 brushPos, float brushSize, float brushRotation)
        {
            terrain                  = t;
            sourceRenderTexture      = null;
            destinationRenderTexture = null;
            renderTextureCollection  = new RenderTextureCollection();
            properties               = new Dictionary <string, float>();

            this.brushPos      = brushPos;
            this.brushSize     = brushSize;
            this.brushRotation = brushRotation;
        }
Пример #3
0
        private void Init()
        {
            if (!m_initialized)
            {
                LoadSettings();

                m_rtCollection = new RenderTextureCollection();
                m_rtCollection.AddRenderTexture(RenderTextureIDs.cameraView, "cameraView", GraphicsFormat.R8G8B8A8_SRGB);
                m_rtCollection.AddRenderTexture(RenderTextureIDs.meshStamp, "meshStamp", GraphicsFormat.R16_SFloat);
                m_rtCollection.AddRenderTexture(RenderTextureIDs.sourceHeight, "sourceHeight", GraphicsFormat.R16_UNorm);
                m_rtCollection.AddRenderTexture(RenderTextureIDs.combinedHeight, "combinedHeight", GraphicsFormat.R16_UNorm);

                m_rtCollection.debugSize = EditorWindow.GetWindow <SceneView>().position.height / 4;

                m_initialized = true;
            }
        }
Пример #4
0
 public override void Eval(RenderTexture src, RenderTexture dest, RenderTextureCollection rtCollection)
 {
     Graphics.Blit(src, dest, FilterUtility.builtinMaterial, ( int )FilterUtility.BuiltinPasses.Negate);
 }
Пример #5
0
        public override void Eval(RenderTexture src, RenderTexture dest, RenderTextureCollection rtCollection)
        {
            FilterUtility.builtinMaterial.SetFloat("_Add", value);

            Graphics.Blit(src, dest, FilterUtility.builtinMaterial, ( int )FilterUtility.BuiltinPasses.Add);
        }
Пример #6
0
        public override void Eval(RenderTexture src, RenderTexture dest, RenderTextureCollection rtCollection)
        {
            FilterUtility.builtinMaterial.SetVector("_ClampRange", range);

            Graphics.Blit(src, dest, FilterUtility.builtinMaterial, ( int )FilterUtility.BuiltinPasses.Clamp);
        }
Пример #7
0
 public virtual void     Eval(RenderTexture src, RenderTexture dest, RenderTextureCollection rtCollection)
 {
 }
Пример #8
0
        public override void Eval(RenderTexture src, RenderTexture dest, RenderTextureCollection rtCollection)
        {
            FilterUtility.builtinMaterial.SetVector("_RemapRanges", new Vector4(fromRange.x, fromRange.y, toRange.x, toRange.y));

            Graphics.Blit(src, dest, FilterUtility.builtinMaterial, ( int )FilterUtility.BuiltinPasses.Remap);
        }