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