diff options
author | Sriharsha Kotcharlakot <k.venkatsriharsha@gmail.com> | 2020-09-15 18:51:14 +0300 |
---|---|---|
committer | Sriharsha Kotcharlakot <k.venkatsriharsha@gmail.com> | 2020-09-15 20:43:01 +0300 |
commit | f137022f9919f4dd315ec6b325a08e1bf5aec6fb (patch) | |
tree | 4b15aa230eb100e77b41dfffb8ef5e7501c55db5 /source/blender/gpu/intern/gpu_texture.cc | |
parent | bedbd8655ed1d331aeaf756874c46dbed93168a1 (diff) |
Liquid Simulation Display Options (GSoC 2020)
All the changes made in the branch `soc-2020-fluid-tools` are included in this patch.
**Major changes:**
=== Viewport Display ===
- //Raw voxel display// or //closest (nearest-neighbor)// interpolation for displaying the underlying voxel data of the simulation grids more clearly.
- An option to display //gridlines// when the slicing method is //single//.
==== Grid Display ====
- Visualization for flags, pressure and level-set representation grids with a fixed color coding based on Manta GUI.
==== Vector Display ====
- //**M**arker **A**nd **C**ell// grid visualization options for vector grids like velocity or external forces.
- Made vector display options available for external forces.
==== Coloring options for //gridlines// ====
- Range highlighting and cell filtering options for displaying the simulation grid data more precisely.
- Color gridlines with flags.
- Also, made slicing and interpolation options available for Volume Object.
Reviewed By: JacquesLucke, sebbas
Differential Revision: https://developer.blender.org/D8705
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.cc | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index eb6881164b2..f7f29c7cece 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -199,7 +199,8 @@ static inline GPUTexture *gpu_texture_create(const char *name, const eGPUTextureType type, int UNUSED(mips), eGPUTextureFormat tex_format, - const float *fpixels) + eGPUDataFormat data_format, + const void *pixels) { Texture *tex = GPUBackend::get()->texture_alloc(name); bool success = false; @@ -227,8 +228,8 @@ static inline GPUTexture *gpu_texture_create(const char *name, delete tex; return NULL; } - if (fpixels) { - tex->update(GPU_DATA_FLOAT, fpixels); + if (pixels) { + tex->update(data_format, pixels); } return reinterpret_cast<GPUTexture *>(tex); } @@ -236,43 +237,53 @@ static inline GPUTexture *gpu_texture_create(const char *name, GPUTexture *GPU_texture_create_1d( const char *name, int w, int mips, eGPUTextureFormat format, const float *data) { - return gpu_texture_create(name, w, 0, 0, GPU_TEXTURE_1D, mips, format, data); + return gpu_texture_create(name, w, 0, 0, GPU_TEXTURE_1D, mips, format, GPU_DATA_FLOAT, data); } GPUTexture *GPU_texture_create_1d_array( const char *name, int w, int h, int mips, eGPUTextureFormat format, const float *data) { - return gpu_texture_create(name, w, h, 0, GPU_TEXTURE_1D_ARRAY, mips, format, data); + return gpu_texture_create( + name, w, h, 0, GPU_TEXTURE_1D_ARRAY, mips, format, GPU_DATA_FLOAT, data); } GPUTexture *GPU_texture_create_2d( const char *name, int w, int h, int mips, eGPUTextureFormat format, const float *data) { - return gpu_texture_create(name, w, h, 0, GPU_TEXTURE_2D, mips, format, data); + return gpu_texture_create(name, w, h, 0, GPU_TEXTURE_2D, mips, format, GPU_DATA_FLOAT, data); } GPUTexture *GPU_texture_create_2d_array( const char *name, int w, int h, int d, int mips, eGPUTextureFormat format, const float *data) { - return gpu_texture_create(name, w, h, d, GPU_TEXTURE_2D_ARRAY, mips, format, data); + return gpu_texture_create( + name, w, h, d, GPU_TEXTURE_2D_ARRAY, mips, format, GPU_DATA_FLOAT, data); } -GPUTexture *GPU_texture_create_3d( - const char *name, int w, int h, int d, int mips, eGPUTextureFormat format, const float *data) +GPUTexture *GPU_texture_create_3d(const char *name, + int w, + int h, + int d, + int mips, + eGPUTextureFormat texture_format, + eGPUDataFormat data_format, + const void *data) { - return gpu_texture_create(name, w, h, d, GPU_TEXTURE_3D, mips, format, data); + return gpu_texture_create( + name, w, h, d, GPU_TEXTURE_3D, mips, texture_format, data_format, data); } GPUTexture *GPU_texture_create_cube( const char *name, int w, int mips, eGPUTextureFormat format, const float *data) { - return gpu_texture_create(name, w, w, 0, GPU_TEXTURE_CUBE, mips, format, data); + return gpu_texture_create(name, w, w, 0, GPU_TEXTURE_CUBE, mips, format, GPU_DATA_FLOAT, data); } GPUTexture *GPU_texture_create_cube_array( const char *name, int w, int d, int mips, eGPUTextureFormat format, const float *data) { - return gpu_texture_create(name, w, w, d, GPU_TEXTURE_CUBE_ARRAY, mips, format, data); + return gpu_texture_create( + name, w, w, d, GPU_TEXTURE_CUBE_ARRAY, mips, format, GPU_DATA_FLOAT, data); } /* DDS texture loading. Return NULL if support is not available. */ @@ -326,7 +337,7 @@ GPUTexture *GPU_texture_create_error(int dimension, bool is_array) type = (dimension == 2) ? (is_array ? GPU_TEXTURE_2D_ARRAY : GPU_TEXTURE_2D) : type; type = (dimension == 1) ? (is_array ? GPU_TEXTURE_1D_ARRAY : GPU_TEXTURE_1D) : type; - return gpu_texture_create("invalid_tex", w, h, d, type, 1, GPU_RGBA8, pixel); + return gpu_texture_create("invalid_tex", w, h, d, type, 1, GPU_RGBA8, GPU_DATA_FLOAT, pixel); } /* ------ Update ------ */ |