Beispiel #1
0
        private void Apply(RenderTexture renderTexture)
        {
            var renderer  = Parent.Root.GetComponent <Renderer>();
            var materials = renderer.sharedMaterials;
            var material  = materials[MaterialIndex];

            material.SetTexture(SlotName, OldTexture);

            P3dHelper.ReadPixels(OldTexture, renderTexture);
        }
        private void Apply(RenderTexture renderTexture)
        {
            var renderer  = Parent.Root.GetComponent <Renderer>();
            var materials = renderer.sharedMaterials;
            var material  = materials[MaterialIndex];

            material.SetTexture(SlotName, OldTexture);

            var textureImporter = P3dHelper.GetAssetImporter <TextureImporter>(OldTexture);

            if (QualitySettings.activeColorSpace == ColorSpace.Linear && textureImporter != null && textureImporter.sRGBTexture == true)
            {
                P3dHelper.ReadPixelsLinearGamma(OldTexture, renderTexture);
            }
            else
            {
                P3dHelper.ReadPixels(OldTexture, renderTexture);
            }
        }