コード例 #1
0
        public TexInfo GetRenderTarget(DX11RenderContext context)
        {
            TexInfo ti = new TexInfo();

            if (this.currentmode == eRenderFormatMode.Inherit)
            {
                if (this.texinputpin.IOObject.IsConnected)
                {
                    DX11Texture2D t = this.texinputpin.IOObject[0][context];

                    if (t.Resource != null)
                    {
                        ti.w = t.Width;
                        ti.h = t.Height;
                        if (DX11EnumFormatHelper.NullDeviceFormats.GetAllowedFormats(FormatSupport.RenderTarget).Contains(t.Format.ToString()))
                        {
                            ti.format = t.Format;
                        }
                        else
                        {
                            ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
                        }

                    }
                    else
                    {
                        ti.w = (int)this.FInTextureSize.IOObject[0].x;
                        ti.h = (int)this.FInTextureSize.IOObject[0].y;
                        ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
                    }
                }
                else
                {
                    ti.w = (int)this.FInTextureSize.IOObject[0].x;
                    ti.h = (int)this.FInTextureSize.IOObject[0].y;
                    ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
                }
            }

            if (this.currentmode == eRenderFormatMode.InheritSize)
            {
                if (this.texinputpin.IOObject.IsConnected)
                {
                    DX11Texture2D t = this.texinputpin.IOObject[0][context];

                    if (t.Resource != null)
                    {
                        ti.w = t.Width;
                        ti.h = t.Height;
                    }
                    else
                    {
                        ti.w = (int)this.FInTextureSize.IOObject[0].x;
                        ti.h = (int)this.FInTextureSize.IOObject[0].y;
                    }
                }
                else
                {
                    ti.w = (int)this.FInTextureSize.IOObject[0].x;
                    ti.h = (int)this.FInTextureSize.IOObject[0].y;
                }

                ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
            }

            if (this.currentmode == eRenderFormatMode.Manual)
            {
                ti.w = (int)this.FInTextureSize.IOObject[0].x;
                ti.h = (int)this.FInTextureSize.IOObject[0].y;
                ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
            }

            ti.w = Convert.ToInt32((double)ti.w * this.FInTextureScale.IOObject[0].x);
            ti.h = Convert.ToInt32((double)ti.h * this.FInTextureScale.IOObject[0].y);

            return ti;
        }
コード例 #2
0
        public TexInfo GetRenderTarget(DX11RenderContext context)
        {
            TexInfo ti = new TexInfo();

            if (this.currentmode == eRenderFormatMode.Inherit)
            {
                if (this.texinputpin.IOObject.PluginIO.IsConnected)
                {
                    DX11Texture2D t = this.texinputpin.IOObject[0][context];

                    if (t.Resource != null)
                    {
                        ti.w = t.Width;
                        ti.h = t.Height;
                        if (DX11EnumFormatHelper.NullDeviceFormats.GetAllowedFormats(FormatSupport.RenderTarget).Contains(t.Format.ToString()))
                        {
                            ti.format = t.Format;
                        }
                        else
                        {
                            ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
                        }
                    }
                    else
                    {
                        ti.w      = (int)this.FInTextureSize.IOObject[0].x;
                        ti.h      = (int)this.FInTextureSize.IOObject[0].y;
                        ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
                    }
                }
                else
                {
                    ti.w      = (int)this.FInTextureSize.IOObject[0].x;
                    ti.h      = (int)this.FInTextureSize.IOObject[0].y;
                    ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
                }
            }

            if (this.currentmode == eRenderFormatMode.InheritSize)
            {
                if (this.texinputpin.IOObject.PluginIO.IsConnected)
                {
                    DX11Texture2D t = this.texinputpin.IOObject[0][context];

                    if (t.Resource != null)
                    {
                        ti.w = t.Width;
                        ti.h = t.Height;
                    }
                    else
                    {
                        ti.w = (int)this.FInTextureSize.IOObject[0].x;
                        ti.h = (int)this.FInTextureSize.IOObject[0].y;
                    }
                }
                else
                {
                    ti.w = (int)this.FInTextureSize.IOObject[0].x;
                    ti.h = (int)this.FInTextureSize.IOObject[0].y;
                }

                ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
            }

            if (this.currentmode == eRenderFormatMode.Manual)
            {
                ti.w      = (int)this.FInTextureSize.IOObject[0].x;
                ti.h      = (int)this.FInTextureSize.IOObject[0].y;
                ti.format = DeviceFormatHelper.GetFormat(this.FInFormat.IOObject[0]);
            }

            ti.w = Convert.ToInt32((double)ti.w * this.FInTextureScale.IOObject[0].x);
            ti.h = Convert.ToInt32((double)ti.h * this.FInTextureScale.IOObject[0].y);

            return(ti);
        }