Пример #1
0
        protected override void OnRenderUI(CanvasRenderer renderer)
        {
            //base.OnRenderUI( renderer );

            var videoTexture = videoBuffer.GetUpdatedTexture();
            var texture      = videoTexture?.Result;

            //!!!!
            //bool backColorZero = BackColor == new ColorValue( 0, 0, 0, 0 );

            {
                //!!!!
                Rectangle texCoord = new Rectangle(0, 0, 1, 1);
                //Rect texCoord = BackTextureCoord;

                //correct tex coord round2 texture
                if (texture != null)
                {
                    Vector2 textureSize = texture.ResultSize.ToVector2F();
                    Vector2 videoSize   = oggFile.VideoDriver.GetSize().ToVector2F();
                    Vector2 coef        = videoSize / textureSize;

                    texCoord.Right  *= coef.X;
                    texCoord.Bottom *= coef.Y;
                }

                //!!!!было
                //if( BackTextureTile && texture != null )
                //{
                //	Vec2 tileCount = GetScreenTextureBaseSize() / texture.Size.ToVec2F() * GetScreenSize();
                //	texCoord = new Rect( -tileCount * .5f, tileCount * .5f ) + new Vec2( .5f, .5f );
                //}

                //!!!!
                ColorValue color = new ColorValue(1, 1, 1);
                //ColorValue color = backColorZero ? new ColorValue( 1, 1, 1 ) : BackColor;
                if (texture == null)
                {
                    color = new ColorValue(0, 0, 0, color.Alpha);
                }
                //color *= GetTotalColorMultiplier();

                color.Clamp(new ColorValue(0, 0, 0, 0), new ColorValue(1, 1, 1, 1));

                GetScreenRectangle(out var rect);

                //!!!!
                renderer.AddQuad(rect, texCoord, videoTexture, color, true);
                //renderer.AddQuad( rect, texCoord, videoTexture, color, BackTextureTile ? false : true );
            }
        }