本文整理汇总了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++;
}
}