Пример #1
0
        private void ResizeSplatControlMaps()
        {
            for (int i = 0; i < SplatControlMapCount; ++i)
            {
                Texture2D t = GetSplatControl(i);
                if (t == null)
                {
                    return;
                }
                Texture2D     tmp = GCommon.CreateTexture(SplatControlResolution, Color.clear);
                RenderTexture rt  = new RenderTexture(SplatControlResolution, SplatControlResolution, 32, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
                GCommon.CopyToRT(t, rt);
                GCommon.CopyFromRT(tmp, rt);
                rt.Release();
                Object.DestroyImmediate(rt);

                tmp.name       = t.name;
                tmp.filterMode = t.filterMode;
                tmp.wrapMode   = t.wrapMode;
                Object.DestroyImmediate(t, true);
                SplatControls[i] = tmp;
                GCommon.TryAddObjectToAsset(tmp, TerrainData);
            }

            UpdateMaterials();
        }
Пример #2
0
        private void ResampleMaskMap()
        {
            if (maskMap == null)
            {
                return;
            }
            Texture2D     tmp = new Texture2D(MaskMapResolution, MaskMapResolution, TextureFormat.RGBA32, false);
            RenderTexture rt  = new RenderTexture(MaskMapResolution, MaskMapResolution, 32, RenderTextureFormat.ARGB32);

            GCommon.CopyToRT(maskMap, rt);
            GCommon.CopyFromRT(tmp, rt);
            rt.Release();
            Object.DestroyImmediate(rt);

            tmp.name       = maskMap.name;
            tmp.filterMode = maskMap.filterMode;
            tmp.wrapMode   = maskMap.wrapMode;
            Object.DestroyImmediate(maskMap, true);
            maskMap = tmp;
            GCommon.TryAddObjectToAsset(maskMap, TerrainData);
        }
Пример #3
0
        private void ResizeMetallicMap()
        {
            if (metallicMap == null)
            {
                return;
            }
            Texture2D     tmp = GCommon.CreateTexture(MetallicMapResolution, Color.black);
            RenderTexture rt  = new RenderTexture(MetallicMapResolution, MetallicMapResolution, 32, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);

            GCommon.CopyToRT(metallicMap, rt);
            GCommon.CopyFromRT(tmp, rt);
            rt.Release();
            Object.DestroyImmediate(rt);

            tmp.name       = metallicMap.name;
            tmp.filterMode = metallicMap.filterMode;
            tmp.wrapMode   = metallicMap.wrapMode;
            Object.DestroyImmediate(metallicMap, true);
            metallicMap = tmp;
            GCommon.TryAddObjectToAsset(metallicMap, TerrainData);
            UpdateMaterials();
        }
Пример #4
0
        private void ResampleHeightMap()
        {
            if (heightMap == null)
            {
                return;
            }
            Texture2D     tmp = new Texture2D(HeightMapResolution, HeightMapResolution, HeightMapFormat, false);
            RenderTexture rt  = new RenderTexture(HeightMapResolution, HeightMapResolution, 32, HeightMapRTFormat);

            GCommon.CopyToRT(heightMap, rt);
            GCommon.CopyFromRT(tmp, rt);
            rt.Release();
            Object.DestroyImmediate(rt);

            tmp.name       = heightMap.name;
            tmp.filterMode = heightMap.filterMode;
            tmp.wrapMode   = heightMap.wrapMode;
            Object.DestroyImmediate(heightMap, true);
            heightMap = tmp;
            GCommon.TryAddObjectToAsset(heightMap, TerrainData);

            Internal_CreateNewSubDivisionMap();
            SetRegionDirty(GCommon.UnitRect);
        }
Пример #5
0
 private void CopyTo(Texture2D heightMap, RenderTexture targetRt)
 {
     GCommon.CopyToRT(heightMap, targetRt);
 }