diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2009-09-09 22:39:40 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2009-09-09 22:39:40 +0400 |
commit | 8e2d86169599d652170ebe8b2564650f00f70077 (patch) | |
tree | 2989704f3a877b652453bdbcc566417c11d75575 /source/blender/gpu | |
parent | ace94617c73651e78a8d65cbca83400f867a961e (diff) |
Smoke:
* Enable cache for high res + new preview
* Bugfix for smoke banding (in cooperation with N_T)
Hint: Work-in-progress regarding collision objects so can be broken, didn't test
Hint2: jahka enabled a general particle panel but
* bake button doesn't work
* step is not supported for cloth
* several other things there ;)
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/gpu/GPU_draw.h | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 16 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 12 |
4 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 85f4233a251..279596e5ad7 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -28,7 +28,7 @@ FILE(GLOB SRC intern/*.c) SET(INC . ../blenlib ../blenkernel ../makesdna ../include - ../../../extern/glew/include ../../../intern/guardedalloc ../imbuf) + ../../../extern/glew/include ../../../intern/guardedalloc ../../../intern/smoke/extern ../imbuf) BLENDERLIB(bf_gpu "${SRC}" "${INC}") diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 00d0e3131e5..fabe1420e83 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -115,7 +115,7 @@ void GPU_free_images(void); /* smoke drawing functions */ void GPU_free_smoke(struct SmokeModifierData *smd); -void GPU_create_smoke(struct SmokeModifierData *smd); +void GPU_create_smoke(struct SmokeModifierData *smd, int highres); #ifdef __cplusplus } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index a81c7e03455..75e8073aafd 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -64,6 +64,8 @@ #include "GPU_material.h" #include "GPU_draw.h" +#include "smoke_API.h" + /* These are some obscure rendering functions shared between the * game engine and the blender, in this module to avoid duplicaten * and abstract them away from the rest a bit */ @@ -754,13 +756,21 @@ void GPU_free_smoke(SmokeModifierData *smd) if(smd->domain->tex) GPU_texture_free(smd->domain->tex); smd->domain->tex = NULL; + + if(smd->domain->tex_shadow) + GPU_texture_free(smd->domain->tex_shadow); + smd->domain->tex_shadow = NULL; } } -void GPU_create_smoke(SmokeModifierData *smd) +void GPU_create_smoke(SmokeModifierData *smd, int highres) { - if(smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain && !smd->domain->tex) - smd->domain->tex = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smd->domain->view3d); + if(smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain && !smd->domain->tex && !highres) + smd->domain->tex = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smoke_get_density(smd->domain->fluid)); + else if(smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain && !smd->domain->tex && highres) + smd->domain->tex = GPU_texture_create_3D(smd->domain->res_wt[0], smd->domain->res_wt[1], smd->domain->res_wt[2], smoke_turbulence_get_density(smd->domain->wt)); + + smd->domain->tex_shadow = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smd->domain->shadow); } void GPU_free_image(Image *ima) diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 850b46dc28c..d7b54e425fd 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -346,17 +346,17 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels) tex->number = 0; glBindTexture(tex->target, tex->bindcode); - type = GL_UNSIGNED_BYTE; - format = GL_RGBA; - internalformat = GL_RGBA8; + type = GL_FLOAT; // GL_UNSIGNED_BYTE + format = GL_RED; + internalformat = GL_RED; - if (fpixels) - pixels = GPU_texture_convert_pixels(w*h*depth, fpixels); + //if (fpixels) + // pixels = GPU_texture_convert_pixels(w*h*depth, fpixels); glTexImage3D(tex->target, 0, internalformat, tex->w, tex->h, tex->depth, 0, format, type, 0); if (fpixels) { - glTexSubImage3D(tex->target, 0, 0, 0, 0, w, h, depth, format, type, pixels); + glTexSubImage3D(tex->target, 0, 0, 0, 0, w, h, depth, format, type, fpixels); } glTexParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, vfBorderColor); |