Exemplo n.º 1
0
        public static void SetupStereoMaterial(Material material, StereoPacking packing, bool displayDebugTinting)
        {
            material.DisableKeyword("STEREO_CUSTOM_UV");
            material.DisableKeyword("STEREO_TOP_BOTTOM");
            material.DisableKeyword("STEREO_LEFT_RIGHT");
            material.DisableKeyword("MONOSCOPIC");

            // Enable the required mode
            switch (packing)
            {
            case StereoPacking.None:
                break;

            case StereoPacking.TopBottom:
                material.EnableKeyword("STEREO_TOP_BOTTOM");
                break;

            case StereoPacking.LeftRight:
                material.EnableKeyword("STEREO_LEFT_RIGHT");
                break;

            case StereoPacking.CustomUV:
                material.EnableKeyword("STEREO_CUSTOM_UV");
                break;
            }

            if (displayDebugTinting)
            {
                material.EnableKeyword("STEREO_DEBUG");
            }
            else
            {
                material.DisableKeyword("STEREO_DEBUG");
            }
        }
Exemplo n.º 2
0
        public static void GetResolveTextureSize(AlphaPacking alphaPacking, StereoPacking stereoPacking, StereoEye eyeMode, ref int width, ref int height)
        {
            switch (alphaPacking)
            {
            case AlphaPacking.LeftRight:
                width /= 2;
                break;

            case AlphaPacking.TopBottom:
                height /= 2;
                break;
            }
            if (eyeMode != StereoEye.Both)
            {
                switch (stereoPacking)
                {
                case StereoPacking.LeftRight:
                    width /= 2;
                    break;

                case StereoPacking.TopBottom:
                    height /= 2;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public StereoPacking GetTextureStereoPacking()
        {
            StereoPacking result = InternalGetTextureStereoPacking();

            if (result == StereoPacking.Unknown)
            {
                // If stereo is unknown, fall back to media hints or no packing
                result = _mediaHints.stereoPacking;
            }
            return(result);
        }
Exemplo n.º 4
0
        public static void SetupStereoMaterial(Material material, StereoPacking packing)
        {
            switch (packing)
            {
            case StereoPacking.None:
                material.DisableKeyword(Keyword_StereoTopBottom);
                material.DisableKeyword(Keyword_StereoLeftRight);
                material.DisableKeyword(Keyword_StereoCustomUV);
                material.DisableKeyword(Keyword_StereoTwoTextures);
                material.EnableKeyword(Keyword_StereoNone);
                break;

            case StereoPacking.TopBottom:
                material.DisableKeyword(Keyword_StereoNone);
                material.DisableKeyword(Keyword_StereoLeftRight);
                material.DisableKeyword(Keyword_StereoCustomUV);
                material.DisableKeyword(Keyword_StereoTwoTextures);
                material.EnableKeyword(Keyword_StereoTopBottom);
                break;

            case StereoPacking.LeftRight:
                material.DisableKeyword(Keyword_StereoNone);
                material.DisableKeyword(Keyword_StereoTopBottom);
                material.DisableKeyword(Keyword_StereoTwoTextures);
                material.DisableKeyword(Keyword_StereoCustomUV);
                material.EnableKeyword(Keyword_StereoLeftRight);
                break;

            case StereoPacking.CustomUV:
                material.DisableKeyword(Keyword_StereoNone);
                material.DisableKeyword(Keyword_StereoTopBottom);
                material.DisableKeyword(Keyword_StereoLeftRight);
                material.DisableKeyword(Keyword_StereoTwoTextures);
                material.EnableKeyword(Keyword_StereoCustomUV);
                break;

            case StereoPacking.TwoTextures:
                material.DisableKeyword(Keyword_StereoNone);
                material.DisableKeyword(Keyword_StereoTopBottom);
                material.DisableKeyword(Keyword_StereoLeftRight);
                material.DisableKeyword(Keyword_StereoCustomUV);
                material.EnableKeyword(Keyword_StereoTwoTextures);
                break;
            }
        }
Exemplo n.º 5
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
        }