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


C# Counter.Incriment方法代码示例

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


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

示例1: OneRenderThread

 private void OneRenderThread(int threadCount, int threadId, PixelMap scrpix, Color[] screen, List<ColorIntensity>[] shadings, int[] successive, Counter completed)
 {
     int localAAn = AAn;
     int localAAcomr = AAcomr;
     if (!antialias)
     {
         localAAn = 0;
         localAAcomr = 1;
     }
     int tries = 0;
     int localCompleted = 0;
     Random localRnd = new Random();
     while (tries <= localAAn)
     {
         int scrIdx = 0;
         for (int y = 0; y < viewport.ScreenY; y++)
         {
             if (y % threadCount != threadId)
             {
                 scrIdx += viewport.ScreenX;
                 continue;
             }
             for (int x = 0; x < viewport.ScreenX; x++)
             {
                 if (successive[scrIdx] < localAAcomr)
                 {
                     ColorIntensity newshading;
                     double rndx = 0.0;
                     double rndy = 0.0;
                     if (antialias)
                     {
                         rndx = localRnd.NextDouble() - 0.5;
                         rndy = localRnd.NextDouble() - 0.5;
                     }
                     Line ray = viewport.RayThrough(x + rndx, y + rndy);
                     SetIn(ref ray.Start, threadId);
                     HitInfo found = scene.Intersect(ray, threadId);
                     List<ColorIntensity> shades = shadings[scrIdx];
                     if (!(found.HitDist == -1))
                     {
                         newshading = Shade(found.GetReal(ray), ray, threadId);
                         shades.Add(newshading);
                     }
                     else
                     {
                         newshading.R = 0.0;
                         newshading.G = 0.0;
                         newshading.B = 0.0;
                         shades.Add(newshading);
                     }
                     if (tries > 0)
                     {
                         ColorIntensity before = Colorav(shades, shades.Count - 1);
                         ColorIntensity after = Colorav(shades, shades.Count);
                         double total = 0.0;
                         total += Math.Abs(before.R - after.R);
                         total += Math.Abs(before.G - after.G);
                         total += Math.Abs(before.B - after.B);
                         if (total < AAco)
                         {
                             successive[scrIdx]++;
                         }
                         else
                             successive[scrIdx] = 0;
                         if (successive[scrIdx] >= AAcomr)
                             localCompleted = completed.Incriment();
                     }
                     if (!antialias)
                         localCompleted = completed.Incriment();
                     Color final = Stochav(shades);
                     screen[scrIdx] = final;
                 }
                 scrIdx++;
             }
             if (OnProgress != null)
             {
                 OnProgress(scrpix, y + 1, localCompleted);
             }
         }
         tries++;
     }
 }
开发者ID:Tilps,项目名称:Stash,代码行数:82,代码来源:ToyTracer.cs


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