本文整理汇总了C++中ImageBuf::ymin方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageBuf::ymin方法的具体用法?C++ ImageBuf::ymin怎么用?C++ ImageBuf::ymin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageBuf
的用法示例。
在下文中一共展示了ImageBuf::ymin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DASSERT
static void
interppixel_NDC_clamped (const ImageBuf &buf, float x, float y, float *pixel,
bool envlatlmode)
{
int fx = buf.spec().full_x;
int fy = buf.spec().full_y;
int fw = buf.spec().full_width;
int fh = buf.spec().full_height;
x = static_cast<float>(fx) + x * static_cast<float>(fw);
y = static_cast<float>(fy) + y * static_cast<float>(fh);
const int maxchannels = 64; // Reasonable guess
float p[4][maxchannels];
DASSERT (buf.spec().nchannels <= maxchannels &&
"You need to increase maxchannels");
int n = std::min (buf.spec().nchannels, maxchannels);
x -= 0.5f;
y -= 0.5f;
int xtexel, ytexel;
float xfrac, yfrac;
xfrac = floorfrac (x, &xtexel);
yfrac = floorfrac (y, &ytexel);
// Clamp
int xnext = Imath::clamp (xtexel+1, buf.xmin(), buf.xmax());
int ynext = Imath::clamp (ytexel+1, buf.ymin(), buf.ymax());
xnext = Imath::clamp (xnext, buf.xmin(), buf.xmax());
ynext = Imath::clamp (ynext, buf.ymin(), buf.ymax());
// Get the four texels
buf.getpixel (xtexel, ytexel, p[0], n);
buf.getpixel (xnext, ytexel, p[1], n);
buf.getpixel (xtexel, ynext, p[2], n);
buf.getpixel (xnext, ynext, p[3], n);
if (envlatlmode) {
// For latlong environment maps, in order to conserve energy, we
// must weight the pixels by sin(t*PI) because pixels closer to
// the pole are actually less area on the sphere. Doing this
// wrong will tend to over-represent the high latitudes in
// low-res MIP levels. We fold the area weighting into our
// linear interpolation by adjusting yfrac.
float w0 = (1.0f - yfrac) * sinf ((float)M_PI * (ytexel+0.5f)/(float)fh);
float w1 = yfrac * sinf ((float)M_PI * (ynext+0.5f)/(float)fh);
yfrac = w0 / (w0 + w1);
}
// Bilinearly interpolate
bilerp (p[0], p[1], p[2], p[3], xfrac, yfrac, n, pixel);
}