本文整理匯總了C#中Procedurality.Channel.putPixelClip方法的典型用法代碼示例。如果您正苦於以下問題:C# Channel.putPixelClip方法的具體用法?C# Channel.putPixelClip怎麽用?C# Channel.putPixelClip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Procedurality.Channel
的用法示例。
在下文中一共展示了Channel.putPixelClip方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: bump
public Channel bump(Channel bumpmap, float lx, float ly, float shadow, float light, float ambient) {
if(!(bumpmap.getWidth() == width && bumpmap.getHeight() == height))
throw new Exception("bumpmap does not match channel size");
Channel channel = new Channel(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float nx = bumpmap.getPixelWrap(x + 1, y) - bumpmap.getPixelWrap(x - 1, y);
float ny = bumpmap.getPixelWrap(x, y + 1) - bumpmap.getPixelWrap(x, y - 1);
float brightness = nx*lx + ny*ly;
if (brightness >= 0) {
channel.putPixelClip(x, y, (getPixel(x, y) + brightness*light)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow));
} else {
channel.putPixelClip(x, y, (getPixel(x, y) + brightness*(1 - ambient))*(bumpmap.getPixel(x, y)*shadow + 1 - shadow));
}
}
}
pixels = channel.getPixels();
return this;
}