Beispiel #1
0
        public static void SetupLayoutMaterial(Material material, VideoMapping mapping)
        {
            material.DisableKeyword("LAYOUT_NONE");
            material.DisableKeyword("LAYOUT_EQUIRECT180");

            switch (mapping)
            {
            // Only EquiRectangular180 currently does anything in the shader
            case VideoMapping.EquiRectangular180:
                material.EnableKeyword("LAYOUT_EQUIRECT180");
                break;
            }
        }
Beispiel #2
0
        public static void SetupLayoutMaterial(Material material, VideoMapping mapping)
        {
            switch (mapping)
            {
            default:
                material.DisableKeyword(Keyword_LayoutEquirect180);
                material.EnableKeyword(Keyword_LayoutNone);
                break;

            // Only EquiRectangular180 currently does anything in the shader
            case VideoMapping.EquiRectangular180:
                material.DisableKeyword(Keyword_LayoutNone);
                material.EnableKeyword(Keyword_LayoutEquirect180);
                break;
            }
        }
Beispiel #3
0
        internal static void SetupMaterial(Material material, bool flipVertically, bool playerSupportsLinear, Matrix4x4 ycbcrTransform, Texture ycbcrTexture = null, float[] textureTransform = null,
                                           VideoMapping mapping = VideoMapping.Normal, StereoPacking stereoPacking = StereoPacking.None, AlphaPacking alphaPacking = AlphaPacking.None)
        {
            SetupVerticalFlipMaterial(material, flipVertically);

            // Apply changes for layout
            if (material.HasProperty(VideoRender.PropLayout.Id))
            {
                VideoRender.SetupLayoutMaterial(material, mapping);
            }

            // Apply changes for stereo videos
            if (material.HasProperty(VideoRender.PropStereo.Id))
            {
                VideoRender.SetupStereoMaterial(material, stereoPacking);
            }

            // Apply changes for alpha videos
            if (material.HasProperty(VideoRender.PropAlphaPack.Id))
            {
                VideoRender.SetupAlphaPackedMaterial(material, alphaPacking);
            }

            // Apply gamma correction
                        #if UNITY_PLATFORM_SUPPORTS_LINEAR
            if (material.HasProperty(VideoRender.PropApplyGamma.Id))
            {
                VideoRender.SetupGammaMaterial(material, playerSupportsLinear);
            }
                        #endif

            // Adjust for cropping (when the decoder decodes in blocks that overrun the video frame size, it pads), OES only as we apply this lower down for none-OES
                        #if (!UNITY_EDITOR && UNITY_ANDROID)
// STE: HasProperty doesn't work on Matrix'
//			if (material.HasProperty(VideoRender.PropTextureMatrix.Id))
            {
                VideoRender.SetupTextureMatrix(material, textureTransform);
            }
                        #endif

                        #if UNITY_PLATFORM_SUPPORTS_YPCBCR
            VideoRender.SetupYpCbCrMaterial(material, ycbcrTexture != null, ycbcrTransform, ycbcrTexture);
                        #endif
        }