void min(float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w, float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w) { res[0] = minvec(tmp0x, tmp1x); res[1] = minvec(tmp0y, tmp1y); res[2] = minvec(tmp0z, tmp1z); res[3] = minvec(tmp0w, tmp1w); }
bool ImageBufAlgo::clamp (ImageBuf &dst, const ImageBuf &src, float min, float max, bool clampalpha01, ROI roi, int nthreads) { std::vector<float> minvec (src.nchannels(), min); std::vector<float> maxvec (src.nchannels(), max); return clamp (dst, src, &minvec[0], &maxvec[0], clampalpha01, roi, nthreads); }
bool ImageBufAlgo::clamp (ImageBuf &dst, float min, float max, bool clampalpha01, ROI roi, int nthreads) { IBAprep (roi, &dst); std::vector<float> minvec (dst.nchannels(), min); std::vector<float> maxvec (dst.nchannels(), max); OIIO_DISPATCH_TYPES ("clamp", clamp_, dst.spec().format, dst, &minvec[0], &maxvec[0], clampalpha01, roi, nthreads); return false; }
void lit(float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w) { const float4 zerovec = (float4) {0.0, 0.0, 0.0, 0.0}; const float4 min128 = (float4) {-128.f, -128.f, -128.f, -128.f}; const float4 plus128 = (float4) {128.f, 128.f, 128.f, 128.f}; res[0] = (float4){1.0, 1.0, 1.0, 1.0}; if (tmp0x.x > 0) { float4 tmpy = maxvec(tmp0y, zerovec); float4 tmpw = minvec(tmp0w, plus128); tmpw = maxvec(tmpw, min128); res[1] = tmp0x; res[2] = powvec(tmpy, tmpw); } else { res[1] = zerovec; res[2] = zerovec; } res[3] = (float4){1.0, 1.0, 1.0, 1.0}; }
void CameraTool::setCameraConstraint ( int nodeid, float percentOfView ) { float minarr[3], maxarr[3]; get_bbox ( nodeid, minarr, maxarr ); SGR::vec3f minvec(minarr), maxvec(maxarr); SGR::vec3f sz = (maxvec - minvec) / percentOfView; SGR::vec3f center = ( minvec + maxvec ) / 2.0f; QSize wndsize ( _pview->getWidth(), _pview->getHeight() ); if ( wndsize.width() > wndsize.height() ) sz.x ( (wndsize.width() / wndsize.height()) * sz.y () ); else sz.y ( (wndsize.height() / wndsize.width()) * sz.x () ); _minTranslate = center - (sz / 2.0f); _maxTranslate = center + (sz / 2.0f); _minScale = calcScale ( _minTranslate, _maxTranslate ); _maxScale = 1; _isInConstraintMode = true; }