From dbba273371ff3e827f5b3cfc0aaf967222188611 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Thu, 30 Jul 2009 20:12:40 +0000 Subject: Smoke: fixing some compile warning reported by Ton and one compile erro for gcc 4.4.1 reported by mrunion --- intern/elbeem/intern/solver_init.cpp | 2 +- intern/smoke/extern/smoke_API.h | 8 +++---- intern/smoke/intern/FLUID_3D.cpp | 12 ++++++----- intern/smoke/intern/FLUID_3D.h | 11 +++++----- intern/smoke/intern/FLUID_3D_SOLVERS.cpp | 5 +++-- intern/smoke/intern/FLUID_3D_STATIC.cpp | 17 ++++++++++----- intern/smoke/intern/IMAGE.h | 15 +++++++++---- intern/smoke/intern/WAVELET_NOISE.h | 27 ++++++++++++------------ intern/smoke/intern/WTURBULENCE.cpp | 14 ++++++------ intern/smoke/intern/smoke_API.cpp | 11 ++++------ source/blender/blenkernel/intern/smoke.c | 23 ++++++++++---------- source/blender/editors/space_view3d/drawobject.c | 19 +++++++---------- 12 files changed, 88 insertions(+), 76 deletions(-) diff --git a/intern/elbeem/intern/solver_init.cpp b/intern/elbeem/intern/solver_init.cpp index ce54adb48ee..fee011a70ae 100644 --- a/intern/elbeem/intern/solver_init.cpp +++ b/intern/elbeem/intern/solver_init.cpp @@ -1464,7 +1464,7 @@ void LbmFsgrSolver::initMovingObstacles(bool staticInit) { obj->applyTransformation(targetTime, &mMOIVertices,NULL /* no old normals needed */, 0, mMOIVertices.size(), false ); } else { // only do transform update - obj->getMovingPoints(mMOIVertices,pNormals); + obj->getMovingPoints(mMOIVertices,pNormals); // mMOIVertices = mCachedMovPoints mMOIVerticesOld = mMOIVertices; // WARNING - assumes mSimulationTime is global!? obj->applyTransformation(targetTime, &mMOIVertices,pNormals, 0, mMOIVertices.size(), false ); diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h index 491e065d3ac..e5b2d3deab3 100644 --- a/intern/smoke/extern/smoke_API.h +++ b/intern/smoke/extern/smoke_API.h @@ -32,7 +32,7 @@ extern "C" { #endif -struct FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, float dt); +struct FLUID_3D *smoke_init(int *res, int amplify, float *p0, float dt); void smoke_free(struct FLUID_3D *fluid); void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta); @@ -48,8 +48,8 @@ float *smoke_get_velocity_z(struct FLUID_3D *fluid); unsigned char *smoke_get_obstacle(struct FLUID_3D *fluid); -size_t smoke_get_index(int x, int max_x, int y, int max_y, int z, int max_z); -size_t smoke_get_index2d(int x, int max_x, int y, int max_y, int z, int max_z); +size_t smoke_get_index(int x, int max_x, int y, int max_y, int z); +size_t smoke_get_index2d(int x, int max_x, int y); void smoke_set_noise(struct FLUID_3D *fluid, int type); @@ -59,4 +59,4 @@ void smoke_get_bigres(struct FLUID_3D *fluid, int *res); } #endif -#endif /* SMOKE_API_H_ */ +#endif /* SMOKE_API_H_ */ \ No newline at end of file diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp index 3427b32e888..2822fca3607 100644 --- a/intern/smoke/intern/FLUID_3D.cpp +++ b/intern/smoke/intern/FLUID_3D.cpp @@ -38,8 +38,8 @@ // Construction/Destruction ////////////////////////////////////////////////////////////////////// -FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float *p1, float dt) : - _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.), _dt(dt) +FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float dt) : + _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f), _dt(dt) { // set simulation consts // _dt = dt; // 0.10 @@ -486,9 +486,11 @@ void FLUID_3D::setObstacleBoundaries() const int down = _obstacles[index - _xRes]; const int left = _obstacles[index - 1]; const int right = _obstacles[index + 1]; - const bool fullz = (top && bottom); - const bool fully = (up && down); - const bool fullx = (left && right); + + // unused + // const bool fullz = (top && bottom); + // const bool fully = (up && down); + //const bool fullx = (left && right); _xVelocity[index] = _yVelocity[index] = diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h index c26ed14406a..2d212caa6d3 100644 --- a/intern/smoke/intern/FLUID_3D.h +++ b/intern/smoke/intern/FLUID_3D.h @@ -37,7 +37,7 @@ class WTURBULENCE; class FLUID_3D { public: - FLUID_3D(int *res, int amplify, float *p0, float *p1, float dt); + FLUID_3D(int *res, int amplify, float *p0, float dt); FLUID_3D() {}; virtual ~FLUID_3D(); @@ -166,11 +166,10 @@ class FLUID_3D float* oldField, float* newField, Vec3Int res, const float* obstacles, const float *oldAdvection); // output helper functions - static void writeImageSliceXY(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); - static void writeImageSliceYZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); - static void writeImageSliceXZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); - static void writeProjectedIntern(const float *field, Vec3Int res, int dir1, int dir2, string prefix, int picCnt, float scale=1.); + // static void writeImageSliceXY(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); + // static void writeImageSliceYZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); + // static void writeImageSliceXZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); + // static void writeProjectedIntern(const float *field, Vec3Int res, int dir1, int dir2, string prefix, int picCnt, float scale=1.); }; #endif - diff --git a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp index b628d48b943..5fd8f72d79d 100644 --- a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp +++ b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp @@ -78,7 +78,7 @@ void FLUID_3D::solvePressure(float* field, float* b, unsigned char* skip) deltaNew += _residual[index] * _residual[index]; // delta0 = deltaNew - float delta0 = deltaNew; + // float delta0 = deltaNew; // While deltaNew > (eps^2) * delta0 const float eps = SOLVER_ACCURACY; @@ -225,7 +225,7 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip) deltaNew += _residual[index] * _residual[index]; // delta0 = deltaNew - float delta0 = deltaNew; + // float delta0 = deltaNew; // While deltaNew > (eps^2) * delta0 const float eps = SOLVER_ACCURACY; @@ -316,3 +316,4 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip) } cout << i << " iterations converged to " << maxR << endl; } + diff --git a/intern/smoke/intern/FLUID_3D_STATIC.cpp b/intern/smoke/intern/FLUID_3D_STATIC.cpp index 7ebe987aaa2..a72009b9abf 100644 --- a/intern/smoke/intern/FLUID_3D_STATIC.cpp +++ b/intern/smoke/intern/FLUID_3D_STATIC.cpp @@ -29,6 +29,7 @@ ////////////////////////////////////////////////////////////////////// // add a test cube of density to the center ////////////////////////////////////////////////////////////////////// +/* void FLUID_3D::addSmokeColumn() { addSmokeTestCase(_density, _res, 1.0); // addSmokeTestCase(_zVelocity, _res, 1.0); @@ -37,11 +38,13 @@ void FLUID_3D::addSmokeColumn() { addSmokeTestCase(_wTurbulence->getDensityBig(), _wTurbulence->getResBig(), 1.0); } } +*/ ////////////////////////////////////////////////////////////////////// // generic static version, so that it can be applied to the // WTURBULENCE grid as well ////////////////////////////////////////////////////////////////////// +/* void FLUID_3D::addSmokeTestCase(float* field, Vec3Int res, float value) { const int slabSize = res[0]*res[1]; int maxRes = (int)MAX3V(res); @@ -69,6 +72,7 @@ void FLUID_3D::addSmokeTestCase(float* field, Vec3Int res, float value) } } } +*/ ////////////////////////////////////////////////////////////////////// // set x direction to Neumann boundary conditions @@ -114,7 +118,7 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res) for (int x = 0; x < res[0]; x++) { // top slab - int index = x + z * slabSize; + index = x + z * slabSize; index += slabSize - res[0]; if(field[index]<0.) field[index] = 0.; index -= res[0]; @@ -226,7 +230,6 @@ void FLUID_3D::copyBorderX(float* field, Vec3Int res) void FLUID_3D::copyBorderY(float* field, Vec3Int res) { const int slabSize = res[0] * res[1]; - const int totalCells = res[0] * res[1] * res[2]; int index; for (int z = 0; z < res[2]; z++) for (int x = 0; x < res[0]; x++) @@ -265,8 +268,6 @@ void FLUID_3D::advectFieldSemiLagrange(const float dt, const float* velx, const const int xres = res[0]; const int yres = res[1]; const int zres = res[2]; - static int hits = 0; - static int total = 0; const int slabSize = res[0] * res[1]; // scale dt up to grid resolution @@ -615,12 +616,16 @@ static int getOtherDir(int dir1, int dir2) { case 0: return 1; case 1: return 0; } break; + default: + return 0; } + return 0; } ////////////////////////////////////////////////////////////////////// // average densities along third spatial direction ////////////////////////////////////////////////////////////////////// +/* void FLUID_3D::writeProjectedIntern(const float *field, Vec3Int res, int dir1, int dir2, string prefix, int picCnt, float scale) { const int nitems = res[dir1]*res[dir2]; @@ -645,6 +650,8 @@ void FLUID_3D::writeProjectedIntern(const float *field, Vec3Int res, buf[bufindex] += field[index] * scale *div; } } - IMAGE::dumpNumberedPNG(picCnt, prefix, buf, res[dir1], res[dir2]); + // IMAGE::dumpNumberedPNG(picCnt, prefix, buf, res[dir1], res[dir2]); delete[] buf; } +*/ + diff --git a/intern/smoke/intern/IMAGE.h b/intern/smoke/intern/IMAGE.h index 772c0161c66..a57f164509e 100644 --- a/intern/smoke/intern/IMAGE.h +++ b/intern/smoke/intern/IMAGE.h @@ -77,7 +77,8 @@ template < class T > inline float MIN3V( T vec) { #include namespace IMAGE { - static int writePng(const char *fileName, unsigned char **rowsp, int w, int h, bool normalize) + /* + static int writePng(const char *fileName, unsigned char **rowsp, int w, int h) { // defaults const int colortype = PNG_COLOR_TYPE_RGBA; @@ -123,13 +124,14 @@ namespace IMAGE { if(png_ptr || info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr); return -1; } + */ ///////////////////////////////////////////////////////////////////////////////// // write a numbered PNG file out, padded with zeros up to three zeros ///////////////////////////////////////////////////////////////////////////////// + /* static void dumpNumberedPNG(int counter, std::string prefix, float* field, int xRes, int yRes) { - /* char buffer[256]; sprintf(buffer,"%04i", counter); std::string number = std::string(buffer); @@ -153,12 +155,13 @@ namespace IMAGE { std::string filenamePNG = prefix + number + std::string(".png"); writePng(filenamePNG.c_str(), rows, xRes, yRes, false); printf("Writing %s\n", filenamePNG.c_str()); - */ + } - +*/ ///////////////////////////////////////////////////////////////////////////////// // export pbrt volumegrid geometry object ///////////////////////////////////////////////////////////////////////////////// + /* static void dumpPBRT(int counter, std::string prefix, float* fieldOrg, int xRes, int yRes, int zRes) { char buffer[256]; @@ -213,10 +216,12 @@ namespace IMAGE { gzclose(file); delete[] field; } + */ ///////////////////////////////////////////////////////////////////////////////// // 3D df3 export ///////////////////////////////////////////////////////////////////////////////// +/* static void dumpDF3(int counter, std::string prefix, float* fieldOrg, int xRes, int yRes, int zRes) { char buffer[256]; @@ -263,8 +268,10 @@ namespace IMAGE { gzclose(file); delete[] buf; } + */ }; #endif + diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h index 72469c2b231..ccb540f6d4d 100644 --- a/intern/smoke/intern/WAVELET_NOISE.h +++ b/intern/smoke/intern/WAVELET_NOISE.h @@ -223,7 +223,7 @@ static bool loadTile(float* const noiseTileData, std::string filename) int gridSize = noiseTileSize * noiseTileSize * noiseTileSize; // noiseTileData memory is managed by caller - int bread = fread((void*)noiseTileData, sizeof(float), gridSize, file); + size_t bread = fread((void*)noiseTileData, sizeof(float), gridSize, file); fclose(file); printf("Noise tile file '%s' loaded.\n", filename.c_str()); @@ -330,22 +330,22 @@ static void generateTile_WAVELET(float* const noiseTileData, std::string filenam // x derivative of noise ////////////////////////////////////////////////////////////////////////////////////////// static inline float WNoiseDx(Vec3 p, float* data) { - int i, f[3], c[3], mid[3], n = noiseTileSize; + int c[3], mid[3], n = noiseTileSize; float w[3][3], t, result = 0; - mid[0] = ceil(p[0] - 0.5); + mid[0] = (int)ceil(p[0] - 0.5); t = mid[0] - (p[0] - 0.5); w[0][0] = -t; w[0][2] = (1.f - t); w[0][1] = 2.0f * t - 1.0f; - mid[1] = ceil(p[1] - 0.5); + mid[1] = (int)ceil(p[1] - 0.5); t = mid[1] - (p[1] - 0.5); w[1][0] = t * t / 2; w[1][2] = (1 - t) * (1 - t) / 2; w[1][1] = 1 - w[1][0] - w[1][2]; - mid[2] = ceil(p[2] - 0.5); + mid[2] = (int)ceil(p[2] - 0.5); t = mid[2] - (p[2] - 0.5); w[2][0] = t * t / 2; w[2][2] = (1 - t) * (1 - t)/2; @@ -372,22 +372,22 @@ static inline float WNoiseDx(Vec3 p, float* data) { // y derivative of noise ////////////////////////////////////////////////////////////////////////////////////////// static inline float WNoiseDy(Vec3 p, float* data) { - int i, f[3], c[3], mid[3], n=noiseTileSize; + int c[3], mid[3], n=noiseTileSize; float w[3][3], t, result =0; - mid[0] = ceil(p[0] - 0.5); + mid[0] = (int)ceil(p[0] - 0.5); t = mid[0]-(p[0] - 0.5); w[0][0] = t * t / 2; w[0][2] = (1 - t) * (1 - t) / 2; w[0][1] = 1 - w[0][0] - w[0][2]; - mid[1] = ceil(p[1] - 0.5); + mid[1] = (int)ceil(p[1] - 0.5); t = mid[1]-(p[1] - 0.5); w[1][0] = -t; w[1][2] = (1.f - t); w[1][1] = 2.0f * t - 1.0f; - mid[2] = ceil(p[2] - 0.5); + mid[2] = (int)ceil(p[2] - 0.5); t = mid[2] - (p[2] - 0.5); w[2][0] = t * t / 2; w[2][2] = (1 - t) * (1 - t)/2; @@ -415,22 +415,22 @@ static inline float WNoiseDy(Vec3 p, float* data) { // z derivative of noise ////////////////////////////////////////////////////////////////////////////////////////// static inline float WNoiseDz(Vec3 p, float* data) { - int i, f[3], c[3], mid[3], n=noiseTileSize; + int c[3], mid[3], n=noiseTileSize; float w[3][3], t, result =0; - mid[0] = ceil(p[0] - 0.5); + mid[0] = (int)ceil(p[0] - 0.5); t = mid[0]-(p[0] - 0.5); w[0][0] = t * t / 2; w[0][2] = (1 - t) * (1 - t) / 2; w[0][1] = 1 - w[0][0] - w[0][2]; - mid[1] = ceil(p[1] - 0.5); + mid[1] = (int)ceil(p[1] - 0.5); t = mid[1]-(p[1] - 0.5); w[1][0] = t * t / 2; w[1][2] = (1 - t) * (1 - t) / 2; w[1][1] = 1 - w[1][0] - w[1][2]; - mid[2] = ceil(p[2] - 0.5); + mid[2] = (int)ceil(p[2] - 0.5); t = mid[2] - (p[2] - 0.5); w[2][0] = -t; w[2][2] = (1.f - t); @@ -454,3 +454,4 @@ static inline float WNoiseDz(Vec3 p, float* data) { } #endif + diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp index 05e29442383..022c8f28252 100644 --- a/intern/smoke/intern/WTURBULENCE.cpp +++ b/intern/smoke/intern/WTURBULENCE.cpp @@ -56,7 +56,7 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify) _strength = 2.; // add the corresponding octaves of noise - _octaves = log((float)_amplify) / log(2.0f); + _octaves = (int)log((float)_amplify) / log(2.0f); // XXX DEBUG/ TODO: int casting correct? - dg // noise resolution _xResBig = _amplify * xResSm; @@ -561,7 +561,7 @@ Vec3 WTURBULENCE::WVelocityWithJacobian(Vec3 orgPos, float* xUnwarped, float* yU final[0] = WNoiseDx(p1, _noiseTile); final[1] = WNoiseDy(p1, _noiseTile); final[2] = WNoiseDz(p1, _noiseTile); - const float f1x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; + // UNUSED const float f1x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; const float f1y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; const float f1z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; @@ -569,7 +569,7 @@ Vec3 WTURBULENCE::WVelocityWithJacobian(Vec3 orgPos, float* xUnwarped, float* yU final[1] = WNoiseDy(p2, _noiseTile); final[2] = WNoiseDz(p2, _noiseTile); const float f2x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; - const float f2y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; + // UNUSED const float f2y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; const float f2z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; final[0] = WNoiseDx(p3, _noiseTile); @@ -577,7 +577,7 @@ Vec3 WTURBULENCE::WVelocityWithJacobian(Vec3 orgPos, float* xUnwarped, float* yU final[2] = WNoiseDz(p3, _noiseTile); const float f3x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; const float f3y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; - const float f3z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; + // UNUSED const float f3z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; Vec3 ret = Vec3( f3y - f2z, @@ -764,8 +764,6 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa { float maxVelMag1 = 0.; #if PARALLEL==1 const int id = omp_get_thread_num(), num = omp_get_num_threads(); -#else - const int id = 0; #endif // vector noise main loop @@ -795,8 +793,11 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa float yWarped[] = {0.0f, 1.0f, 0.0f}; float zWarped[] = {0.0f, 0.0f, 1.0f}; bool nonSingular = LU.isNonsingular(); +#if 0 + // UNUSED float eigMax = 10.0f; float eigMin = 0.1f; +#endif if (nonSingular) { solveLU3x3(LU, xUnwarped, xWarped); @@ -961,3 +962,4 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa _totalStepsBig++; } + diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp index c81d6fb8c50..cacd58fce13 100644 --- a/intern/smoke/intern/smoke_API.cpp +++ b/intern/smoke/intern/smoke_API.cpp @@ -34,7 +34,7 @@ extern "C" FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, float dt) { // smoke lib uses y as top-bottom/vertical axis where blender uses z - FLUID_3D *fluid = new FLUID_3D(res, amplify, p0, p1, dt); + FLUID_3D *fluid = new FLUID_3D(res, amplify, p0, dt); // printf("xres: %d, yres: %d, zres: %d\n", res[0], res[1], res[2]); @@ -47,7 +47,7 @@ extern "C" void smoke_free(FLUID_3D *fluid) fluid = NULL; } -extern "C" void smoke_step(FLUID_3D *fluid, float dx) +extern "C" void smoke_step(FLUID_3D *fluid) { // fluid->addSmokeColumn(); fluid->step(); @@ -105,13 +105,13 @@ extern "C" unsigned char *smoke_get_obstacle(FLUID_3D *fluid) return fluid->_obstacles; } -extern "C" size_t smoke_get_index(int x, int max_x, int y, int max_y, int z, int max_z) +extern "C" size_t smoke_get_index(int x, int max_x, int y, int max_y, int z /*, int max_z */) { // // const int index = x + y * smd->res[0] + z * smd->res[0]*smd->res[1]; return x + y * max_x + z * max_x*max_y; } -extern "C" size_t smoke_get_index2d(int x, int max_x, int y, int max_y, int z, int max_z) +extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z, int max_z */) { return x + y * max_x; } @@ -120,6 +120,3 @@ extern "C" void smoke_set_noise(FLUID_3D *fluid, int type) { fluid->_wTurbulence->setNoise(type); } - - - diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 416a208468b..fd9840f4b11 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -29,6 +29,8 @@ * ***** END GPL LICENSE BLOCK ***** */ +/* Part of the code copied from elbeem fluid library, copyright by Nils Thuerey */ + #include #include "MEM_guardedalloc.h" @@ -472,7 +474,7 @@ void smokeModifier_freeDomain(SmokeModifierData *smd) // free visualisation buffers if(smd->domain->bind) { - glDeleteTextures(smd->domain->max_textures, smd->domain->bind); + glDeleteTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); MEM_freeN(smd->domain->bind); } smd->domain->max_textures = 0; // unnecessary but let's be sure @@ -528,7 +530,7 @@ void smokeModifier_reset(struct SmokeModifierData *smd) // free visualisation buffers if(smd->domain->bind) { - glDeleteTextures(smd->domain->max_textures, smd->domain->bind); + glDeleteTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); MEM_freeN(smd->domain->bind); smd->domain->bind = NULL; } @@ -651,8 +653,6 @@ void smoke_calc_transparency(struct SmokeModifierData *smd, float *light, int bi void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm) { - int new = 0; - if(scene->r.cfra >= smd->time) smokeModifier_init(smd, ob, scene, dm); @@ -793,7 +793,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM continue; // 2. set cell values (heat, density and velocity) - index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2], sds->res[2]); + index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]); heat[index] = sfs->temp; density[index] = sfs->density; @@ -810,7 +810,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM for(j = 0; j < smd->domain->amplify; j++) for(k = 0; k < smd->domain->amplify; k++) { - index = smoke_get_index(smd->domain->amplify * cell[0] + i, bigres[0], smd->domain->amplify * cell[1] + j, bigres[1], smd->domain->amplify * cell[2] + k, bigres[2]); + index = smoke_get_index(smd->domain->amplify * cell[0] + i, bigres[0], smd->domain->amplify * cell[1] + j, bigres[1], smd->domain->amplify * cell[2] + k); bigdensity[index] = sfs->density; } } @@ -907,7 +907,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM continue; // 2. set cell values (heat, density and velocity) - index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2], sds->res[2]); + index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]); obstacles[index] = 1; @@ -964,7 +964,6 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM void smoke_prepare_View(SmokeModifierData *smd, float *light) { float *density = NULL; - size_t i = 0; int x, y, z; if(!smd->domain->tray) @@ -986,7 +985,7 @@ void smoke_prepare_View(SmokeModifierData *smd, float *light) { size_t index; - index = smoke_get_index(x, smd->domain->res[0], y, smd->domain->res[1], z, smd->domain->res[2]); + index = smoke_get_index(x, smd->domain->res[0], y, smd->domain->res[1], z); // Transparency computation // formula taken from "Visual Simulation of Smoke" / Fedkiw et al. pg. 4 // T_vox = exp(-C_ext * h) @@ -1091,7 +1090,7 @@ long long smoke_get_mem_req(int xres, int yres, int zres, int amplify) static void calc_voxel_transp(SmokeModifierData *smd, int *pixel, float *tRay) { // printf("Pixel(%d, %d, %d)\n", pixel[0], pixel[1], pixel[2]); - const size_t index = smoke_get_index(pixel[0], smd->domain->res[0], pixel[1], smd->domain->res[1], pixel[2], smd->domain->res[2]); + const size_t index = smoke_get_index(pixel[0], smd->domain->res[0], pixel[1], smd->domain->res[1], pixel[2]); // T_ray *= T_vox *tRay *= smoke_get_tvox(smd, index); @@ -1103,7 +1102,7 @@ static void calc_voxel_transp_big(SmokeModifierData *smd, int *pixel, float *tRa size_t index; smoke_get_bigres(smd->domain->fluid, bigres); - index = smoke_get_index(pixel[0], bigres[0], pixel[1], bigres[1], pixel[2], bigres[2]); + index = smoke_get_index(pixel[0], bigres[0], pixel[1], bigres[1], pixel[2]); /* if(index > bigres[0]*bigres[1]*bigres[2]) @@ -1301,7 +1300,7 @@ void smoke_calc_transparency(struct SmokeModifierData *smd, float *light, int bi int cell[3]; float tRay = 1.0; - index = smoke_get_index(x, res[0], y, res[1], z, res[2]); + index = smoke_get_index(x, res[0], y, res[1], z); // voxelCenter = m_voxelarray[i].GetCenter(); voxelCenter[0] = smd->domain->p0[0] + smd->domain->dx * bigfactor * x + smd->domain->dx * bigfactor * 0.5; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d0bee9c18f8..572759017df 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5342,12 +5342,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(smd->domain && smd->domain->fluid) { int x, y, z, i; - float *density = NULL; float viewnormal[3]; int mainaxis[3] = {0,0,0}; float align = 0; int max_textures = 0, counter_textures = 0; - int counter=0; float *buffer = NULL; int res[3]; float bigfactor = 1.0; @@ -5471,7 +5469,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(!smd->domain->viewsettings) // new frame or new start { smd->domain->max_textures = max_textures; - glGenTextures(smd->domain->max_textures, smd->domain->bind); + glGenTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); new = 1; // printf("glGenTextures\n"); } @@ -5480,9 +5478,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(new) { // printf("glDeleteTextures\n"); - glDeleteTextures(smd->domain->max_textures, smd->domain->bind); + glDeleteTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); smd->domain->max_textures = max_textures; - glGenTextures(smd->domain->max_textures, smd->domain->bind); + glGenTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); } } @@ -5501,24 +5499,23 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) size_t index; size_t image_index; float tray, tvox; + + image_index = smoke_get_index2d(y, res[mainaxis[1]], x); if(mainaxis[0] == 0) { // mainaxis[1] == 1, mainaxis[2] == 2 - image_index = smoke_get_index2d(y, res[mainaxis[1]], x, res[mainaxis[2]], z, res[mainaxis[0]]); - index = smoke_get_index(z, res[mainaxis[0]], y, res[mainaxis[1]], x, res[mainaxis[2]]); + index = smoke_get_index(z, res[mainaxis[0]], y, res[mainaxis[1]], x); } else if(mainaxis[0] == 1) { // mainaxis[1] == 2, mainaxis[2] == 0 - image_index = smoke_get_index2d(y, res[mainaxis[1]], x, res[mainaxis[2]], z, res[mainaxis[0]]); - index = smoke_get_index(x, res[mainaxis[2]], z, res[mainaxis[0]], y, res[mainaxis[1]]); + index = smoke_get_index(x, res[mainaxis[2]], z, res[mainaxis[0]], y); } else // mainaxis[0] == 2 { // mainaxis[1] == 0, mainaxis[2] == 1 - image_index = smoke_get_index2d(y, res[mainaxis[1]], x, res[mainaxis[2]], z, res[mainaxis[0]]); - index = smoke_get_index(y, res[mainaxis[1]], x, res[mainaxis[2]], z, res[mainaxis[0]]); + index = smoke_get_index(y, res[mainaxis[1]], x, res[mainaxis[2]], z); } if(!big) -- cgit v1.2.3