Smoke: Pass non-trivial arguments by const reference
This commit is contained in:
parent
2868dcbe2b
commit
67ddc28055
|
@ -48,27 +48,27 @@ template < class T > inline void CLAMP( T &a, T b=0., T c=1.) {
|
|||
if(a>c) { a=c; return; }
|
||||
}
|
||||
|
||||
template < class T > inline T MIN( T a, T b) {
|
||||
template < class T > inline T MIN( const T& a, const T& b) {
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
template < class T > inline T MAX( T a, T b) {
|
||||
template < class T > inline T MAX( const T& a, const T& b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
template < class T > inline T MAX3( T a, T b, T c) {
|
||||
template < class T > inline T MAX3( const T& a, const T& b, const T& c) {
|
||||
T max = (a > b) ? a : b;
|
||||
max = (max > c) ? max : c;
|
||||
return max;
|
||||
}
|
||||
|
||||
template < class T > inline float MAX3V( T vec) {
|
||||
template < class T > inline float MAX3V( const T& vec) {
|
||||
float max = (vec[0] > vec[1]) ? vec[0] : vec[1];
|
||||
max = (max > vec[2]) ? max : vec[2];
|
||||
return max;
|
||||
}
|
||||
|
||||
template < class T > inline float MIN3V( T vec) {
|
||||
template < class T > inline float MIN3V( const T& vec) {
|
||||
float min = (vec[0] < vec[1]) ? vec[0] : vec[1];
|
||||
min = (min < vec[2]) ? min : vec[2];
|
||||
return min;
|
||||
|
|
|
@ -245,7 +245,7 @@ void WTURBULENCE::initBlenderRNA(float *strength)
|
|||
// Takes the one-sided finite difference in both directions and
|
||||
// selects the smaller of the two
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
static float minDx(int x, int y, int z, float* input, Vec3Int res)
|
||||
static float minDx(int x, int y, int z, float* input, const Vec3Int& res)
|
||||
{
|
||||
const int index = x + y * res[0] + z * res[0] * res[1];
|
||||
const int maxx = res[0]-2;
|
||||
|
@ -280,7 +280,7 @@ static float minDx(int x, int y, int z, float* input, Vec3Int res)
|
|||
// Takes the one-sided finite difference in both directions and
|
||||
// selects the smaller of the two
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
static float minDy(int x, int y, int z, float* input, Vec3Int res)
|
||||
static float minDy(int x, int y, int z, float* input, const Vec3Int& res)
|
||||
{
|
||||
const int index = x + y * res[0] + z * res[0] * res[1];
|
||||
const int maxy = res[1]-2;
|
||||
|
@ -314,7 +314,7 @@ static float minDy(int x, int y, int z, float* input, Vec3Int res)
|
|||
// Takes the one-sided finite difference in both directions and
|
||||
// selects the smaller of the two
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
static float minDz(int x, int y, int z, float* input, Vec3Int res)
|
||||
static float minDz(int x, int y, int z, float* input, const Vec3Int& res)
|
||||
{
|
||||
const int slab = res[0]*res[1];
|
||||
const int index = x + y * res[0] + z * slab;
|
||||
|
@ -605,7 +605,7 @@ Vec3 WTURBULENCE::WVelocity(Vec3 orgPos)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Evaluate derivatives with Jacobian
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
Vec3 WTURBULENCE::WVelocityWithJacobian(Vec3 orgPos, float* xUnwarped, float* yUnwarped, float* zUnwarped)
|
||||
Vec3 WTURBULENCE::WVelocityWithJacobian(const Vec3& orgPos, float* xUnwarped, float* yUnwarped, float* zUnwarped)
|
||||
{
|
||||
// arbitrarily offset evaluation points
|
||||
const Vec3 p1 = orgPos + Vec3(NOISE_TILE_SIZE/2.0,0,0);
|
||||
|
|
|
@ -62,7 +62,7 @@ struct WTURBULENCE
|
|||
|
||||
// evaluate wavelet noise function
|
||||
Vec3 WVelocity(Vec3 p);
|
||||
Vec3 WVelocityWithJacobian(Vec3 p, float* xUnwarped, float* yUnwarped, float* zUnwarped);
|
||||
Vec3 WVelocityWithJacobian(const Vec3& p, float* xUnwarped, float* yUnwarped, float* zUnwarped);
|
||||
|
||||
// access functions
|
||||
inline float* getDensityBig() { return _densityBig; }
|
||||
|
|
Loading…
Reference in New Issue