Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-11-14 19:11:25 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-11-14 19:11:48 +0300
commit67ddc280552fea5687c84f4559216f557d81a425 (patch)
tree3204c349e4dc3e4b3057b2101e7bd89188040ee2 /intern/smoke
parent2868dcbe2bc4eb64e2667239aed7e7b18fa8c96c (diff)
Smoke: Pass non-trivial arguments by const reference
Diffstat (limited to 'intern/smoke')
-rw-r--r--intern/smoke/intern/IMAGE.h10
-rw-r--r--intern/smoke/intern/WTURBULENCE.cpp8
-rw-r--r--intern/smoke/intern/WTURBULENCE.h2
3 files changed, 10 insertions, 10 deletions
diff --git a/intern/smoke/intern/IMAGE.h b/intern/smoke/intern/IMAGE.h
index a606fcddf72..79f71c6402a 100644
--- a/intern/smoke/intern/IMAGE.h
+++ b/intern/smoke/intern/IMAGE.h
@@ -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;
diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp
index 3d712d2124a..61389201796 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -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);
diff --git a/intern/smoke/intern/WTURBULENCE.h b/intern/smoke/intern/WTURBULENCE.h
index 36635325f62..a00a818527a 100644
--- a/intern/smoke/intern/WTURBULENCE.h
+++ b/intern/smoke/intern/WTURBULENCE.h
@@ -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; }