本文整理汇总了C#中IDisplay.imagePrepare方法的典型用法代码示例。如果您正苦于以下问题:C# IDisplay.imagePrepare方法的具体用法?C# IDisplay.imagePrepare怎么用?C# IDisplay.imagePrepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDisplay
的用法示例。
在下文中一共展示了IDisplay.imagePrepare方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: renderBucket
private void renderBucket(IDisplay display, int bx, int by, int threadID, IntersectionState istate, ShadingCache cache)
{
// pixel sized extents
int x0 = bx * bucketSize;
int y0 = by * bucketSize;
int bw = Math.Min(bucketSize, imageWidth - x0);
int bh = Math.Min(bucketSize, imageHeight - y0);
// prepare bucket
display.imagePrepare(x0, y0, bw, bh, threadID);
Color[] bucketRGB = new Color[bw * bh];
float[] bucketAlpha = new float[bw * bh];
for (int y = 0, i = 0, cy = imageHeight - 1 - y0; y < bh; y++, cy--) {
for (int x = 0, cx = x0; x < bw; x++, i++, cx++) {
// sample pixel
Color c = Color.black();
float a = 0;
int instance = ((cx & ((1 << QMC.MAX_SIGMA_ORDER) - 1)) << QMC.MAX_SIGMA_ORDER) + QMC.sigma(cy & ((1 << QMC.MAX_SIGMA_ORDER) - 1), QMC.MAX_SIGMA_ORDER);
double jitterX = QMC.halton(0, instance);
double jitterY = QMC.halton(1, instance);
double jitterT = QMC.halton(2, instance);
double jitterU = QMC.halton(3, instance);
double jitterV = QMC.halton(4, instance);
for (int s = 0; s < numSamples; s++) {
float rx = cx + 0.5f + (float) warpCubic(QMC.mod1(jitterX + s * invNumSamples));
float ry = cy + 0.5f + (float) warpCubic(QMC.mod1(jitterY + QMC.halton(0, s)));
double time = QMC.mod1(jitterT + QMC.halton(1, s));
double lensU = QMC.mod1(jitterU + QMC.halton(2, s));
double lensV = QMC.mod1(jitterV + QMC.halton(3, s));
ShadingState state = scene.getRadiance(istate, rx, ry, lensU, lensV, time, instance + s, 5, cache);
if (state != null) {
c.add(state.getResult());
a++;
}
}
bucketRGB[i] = c.mul(invNumSamples);
bucketAlpha[i] = a * invNumSamples;
if (cache != null)
cache.reset();
}
}
// update pixels
display.imageUpdate(x0, y0, bw, bh, bucketRGB, bucketAlpha);
}