Ejemplo n.º 1
0
        static void CreateTextureArrayAssets(SnappersHeadRenderer shr)
        {
            var inputMask   = new Texture2D[] { shr.mask1, shr.mask2, shr.mask3, shr.mask4, shr.mask5, shr.mask6, shr.mask7, shr.mask8, shr.mask9, shr.mask10, shr.mask11, shr.mask12 };
            var inputAlbedo = new Texture2D[] { shr.albedo1, shr.albedo2, shr.albedo3, shr.albedo4 };
            var inputNormal = new Texture2D[] { shr.normal1, shr.normal2, shr.normal3, shr.normal4 };
            var inputCavity = new Texture2D[] { shr.cavity1, shr.cavity2, shr.cavity3, shr.cavity4 };

            var assetPath       = shr.arrayAssetPath.Trim('/');
            var assetPathMask   = assetPath + "/_Tex2DArray_Mask.asset";
            var assetPathAlbedo = assetPath + "/_Tex2DArray_Albedo.asset";
            var assetPathNormal = assetPath + "/_Tex2DArray_Normal.asset";
            var assetPathCavity = assetPath + "/_Tex2DArray_Cavity.asset";

            shr.arrayMask   = CreateTextureArrayAsset(inputMask, linear: true, assetPathMask);
            shr.arrayAlbedo = CreateTextureArrayAsset(inputAlbedo, linear: false, assetPathAlbedo);
            shr.arrayNormal = CreateTextureArrayAsset(inputNormal, linear: true, assetPathNormal);
            shr.arrayCavity = CreateTextureArrayAsset(inputCavity, linear: true, assetPathCavity);

            EditorUtility.SetDirty(shr);
            AssetDatabase.SaveAssets();
        }
Ejemplo n.º 2
0
        static void BuildTextureArrays(SnappersHeadRenderer shr)
        {
            var textureSets = shr.materials;

            if (textureSets == null)
            {
                return;
            }

            for (int i = 0; i != textureSets.Length; i++)
            {
                ref var ts = ref textureSets[i];

                var inputMask   = new Texture2D[] { ts.mask1, ts.mask2, ts.mask3, ts.mask4, ts.mask5, ts.mask6, ts.mask7, ts.mask8, ts.mask9, ts.mask10, ts.mask11, ts.mask12 };
                var inputAlbedo = new Texture2D[] { ts.albedo1, ts.albedo2, ts.albedo3, ts.albedo4 };
                var inputNormal = new Texture2D[] { ts.normal1, ts.normal2, ts.normal3, ts.normal4 };
                var inputCavity = new Texture2D[] { ts.cavity1, ts.cavity2, ts.cavity3, ts.cavity4 };

                ts.maskArray   = CreateTextureArrayAsset(inputMask, linear: true);
                ts.albedoArray = CreateTextureArrayAsset(inputAlbedo, linear: false);
                ts.normalArray = CreateTextureArrayAsset(inputNormal, linear: true);
                ts.cavityArray = CreateTextureArrayAsset(inputCavity, linear: true);
            }