当前位置: 首页>>代码示例>>C#>>正文


C# Texture2D.SetCS方法代码示例

本文整理汇总了C#中Texture2D.SetCS方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.SetCS方法的具体用法?C# Texture2D.SetCS怎么用?C# Texture2D.SetCS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Texture2D的用法示例。


在下文中一共展示了Texture2D.SetCS方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildVisibilityMap

        private void BuildVisibilityMap( Texture2D _Source, Texture3D _Target )
        {
            if ( !m_CS_GenerateVisibilityMap.Use() )
                throw new Exception( "Can't generate translucency map as visibility map compute shader failed to compile!" );

            _Target.RemoveFromLastAssignedSlots();

            _Source.SetCS( 0 );
            _Target.SetCSUAV( 0 );

            m_CB_Visibility.m._Width = (uint) W;
            m_CB_Visibility.m._Height = (uint) H;
            m_CB_Visibility.m._Thickness_mm = Thickness_mm;
            m_CB_Visibility.m._TexelSize_mm = TextureSize_mm / Math.Max( W, H );
            m_CB_Visibility.m._DiscRadius = 32;

            uint	h = Math.Max( 1, MAX_LINES*1024 / W );
            uint	callsCount = (uint) Math.Ceiling( (float) H / h );
            for ( uint i=0; i < callsCount; i++ ) {
                m_CB_Visibility.m._Y0 = i * h;
                m_CB_Visibility.UpdateData();

                m_CS_GenerateVisibilityMap.Dispatch( W, h, 1 );

                m_Device.Present( true );

                progressBar.Value = (int) (0.01f * (BILATERAL_PROGRESS + (VISIBILITY_PROGRESS - BILATERAL_PROGRESS) * (i+1) / callsCount) * progressBar.Maximum);
                Application.DoEvents();
            }

            _Target.RemoveFromLastAssignedSlotUAV();	// So we can use it as input for next stage
        }
开发者ID:Patapom,项目名称:GodComplex,代码行数:32,代码来源:GeneratorForm.cs

示例2: ApplyBilateralFiltering

        private void ApplyBilateralFiltering( Texture2D _Source, Texture2D _Target, float _BilateralRadius, float _BilateralTolerance, bool _Wrap )
        {
            _Source.SetCS( 0 );
            _Target.SetCSUAV( 0 );

            m_CB_Filter.m.Radius = _BilateralRadius;
            m_CB_Filter.m.Tolerance = _BilateralTolerance;
            m_CB_Filter.m.Tile = (uint) (_Wrap ? 1 : 0);

            m_CS_BilateralFilter.Use();

            uint	h = Math.Max( 1, MAX_LINES*1024 / W );
            uint	callsCount = (uint) Math.Ceiling( (float) H / h );
            for ( uint i=0; i < callsCount; i++ ) {
                m_CB_Filter.m.Y0 = i * h;
                m_CB_Filter.UpdateData();

                m_CS_BilateralFilter.Dispatch( W, h, 1 );

                m_device.Present( true );

                progressBar.Value = (int) (0.01f * (0 + BILATERAL_PROGRESS * (i+1) / callsCount) * progressBar.Maximum);
            //				for ( int a=0; a < 10; a++ )
                    Application.DoEvents();
            }

            // Single gulp (crashes the driver on large images!)
            //			m_CS_BilateralFilter.Dispatch( W, H, 1 );

            _Target.RemoveFromLastAssignedSlotUAV();	// So we can use it as input for next stage
        }
开发者ID:Patapom,项目名称:GodComplex,代码行数:31,代码来源:GeneratorForm.cs


注:本文中的Texture2D.SetCS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。