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:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2018-02-22 18:26:50 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2018-02-24 15:37:58 +0300
commit4403ca80bda690c0ac44e4a6db0cddf4b2428006 (patch)
tree3a68b34c75f4f831840403950b4bde7f4ad938ce /intern/openvdb
parent6d8a4c10b65c45b2bcc2eca7779cc541af0562fb (diff)
Smoke: expose empty space clipping property to the UI.
This is used to determine which voxels are to be considered empty space. Previously it was hardcoded for converting dense grids to OpenVDB grids to reduce disk space usage. This value is also useful for rendering engines to know, i.e. to optimize ray marching.
Diffstat (limited to 'intern/openvdb')
-rw-r--r--intern/openvdb/intern/openvdb_dense_convert.cc9
-rw-r--r--intern/openvdb/intern/openvdb_dense_convert.h25
-rw-r--r--intern/openvdb/openvdb_capi.cc18
-rw-r--r--intern/openvdb/openvdb_capi.h24
4 files changed, 38 insertions, 38 deletions
diff --git a/intern/openvdb/intern/openvdb_dense_convert.cc b/intern/openvdb/intern/openvdb_dense_convert.cc
index 10d5fb6402a..76fbbf88079 100644
--- a/intern/openvdb/intern/openvdb_dense_convert.cc
+++ b/intern/openvdb/intern/openvdb_dense_convert.cc
@@ -79,7 +79,8 @@ openvdb::GridBase *OpenVDB_export_vector_grid(
const int res[3],
float fluid_mat[4][4],
openvdb::VecType vec_type,
- const bool is_color,
+ const bool is_color,
+ const float clipping,
const openvdb::FloatGrid *mask)
{
using namespace openvdb;
@@ -92,15 +93,15 @@ openvdb::GridBase *OpenVDB_export_vector_grid(
grid[0] = FloatGrid::create(0.0f);
tools::Dense<const float, tools::LayoutXYZ> dense_grid_x(bbox, data_x);
- tools::copyFromDense(dense_grid_x, grid[0]->tree(), TOLERANCE);
+ tools::copyFromDense(dense_grid_x, grid[0]->tree(), clipping);
grid[1] = FloatGrid::create(0.0f);
tools::Dense<const float, tools::LayoutXYZ> dense_grid_y(bbox, data_y);
- tools::copyFromDense(dense_grid_y, grid[1]->tree(), TOLERANCE);
+ tools::copyFromDense(dense_grid_y, grid[1]->tree(), clipping);
grid[2] = FloatGrid::create(0.0f);
tools::Dense<const float, tools::LayoutXYZ> dense_grid_z(bbox, data_z);
- tools::copyFromDense(dense_grid_z, grid[2]->tree(), TOLERANCE);
+ tools::copyFromDense(dense_grid_z, grid[2]->tree(), clipping);
Vec3SGrid::Ptr vecgrid = Vec3SGrid::create(Vec3s(0.0f));
diff --git a/intern/openvdb/intern/openvdb_dense_convert.h b/intern/openvdb/intern/openvdb_dense_convert.h
index 7882cafa06e..e5e2965e708 100644
--- a/intern/openvdb/intern/openvdb_dense_convert.h
+++ b/intern/openvdb/intern/openvdb_dense_convert.h
@@ -36,8 +36,6 @@
#include <cstdio>
-#define TOLERANCE 1e-3f
-
namespace internal {
/* Verify that the name does not correspond to the old format, in which case we
@@ -52,7 +50,8 @@ GridType *OpenVDB_export_grid(
const openvdb::Name &name,
const T *data,
const int res[3],
- float fluid_mat[4][4],
+ float fluid_mat[4][4],
+ const float clipping,
const openvdb::FloatGrid *mask)
{
using namespace openvdb;
@@ -64,7 +63,7 @@ GridType *OpenVDB_export_grid(
typename GridType::Ptr grid = GridType::create(T(0));
tools::Dense<const T, openvdb::tools::LayoutXYZ> dense_grid(bbox, data);
- tools::copyFromDense(dense_grid, grid->tree(), (T)TOLERANCE);
+ tools::copyFromDense(dense_grid, grid->tree(), static_cast<T>(clipping));
grid->setTransform(transform);
@@ -119,15 +118,15 @@ void OpenVDB_import_grid(
}
}
-openvdb::GridBase *OpenVDB_export_vector_grid(
- OpenVDBWriter *writer,
- const openvdb::Name &name,
- const float *data_x, const float *data_y, const float *data_z,
- const int res[3],
- float fluid_mat[4][4],
- openvdb::VecType vec_type,
- const bool is_color,
- const openvdb::FloatGrid *mask);
+openvdb::GridBase *OpenVDB_export_vector_grid(OpenVDBWriter *writer,
+ const openvdb::Name &name,
+ const float *data_x, const float *data_y, const float *data_z,
+ const int res[3],
+ float fluid_mat[4][4],
+ openvdb::VecType vec_type,
+ const bool is_color,
+ const float clipping,
+ const openvdb::FloatGrid *mask);
void OpenVDB_import_grid_vector(
diff --git a/intern/openvdb/openvdb_capi.cc b/intern/openvdb/openvdb_capi.cc
index ef4f8c8820f..1c8b51a23c4 100644
--- a/intern/openvdb/openvdb_capi.cc
+++ b/intern/openvdb/openvdb_capi.cc
@@ -39,7 +39,7 @@ int OpenVDB_getVersionHex()
OpenVDBFloatGrid *OpenVDB_export_grid_fl(
OpenVDBWriter *writer,
const char *name, float *data,
- const int res[3], float matrix[4][4],
+ const int res[3], float matrix[4][4], const float clipping,
OpenVDBFloatGrid *mask)
{
Timer(__func__);
@@ -53,6 +53,7 @@ OpenVDBFloatGrid *OpenVDB_export_grid_fl(
data,
res,
matrix,
+ clipping,
mask_grid);
return reinterpret_cast<OpenVDBFloatGrid *>(grid);
@@ -61,7 +62,7 @@ OpenVDBFloatGrid *OpenVDB_export_grid_fl(
OpenVDBIntGrid *OpenVDB_export_grid_ch(
OpenVDBWriter *writer,
const char *name, unsigned char *data,
- const int res[3], float matrix[4][4],
+ const int res[3], float matrix[4][4], const float clipping,
OpenVDBFloatGrid *mask)
{
Timer(__func__);
@@ -76,17 +77,17 @@ OpenVDBIntGrid *OpenVDB_export_grid_ch(
data,
res,
matrix,
+ clipping,
mask_grid);
return reinterpret_cast<OpenVDBIntGrid *>(grid);
}
-OpenVDBVectorGrid *OpenVDB_export_grid_vec(
- struct OpenVDBWriter *writer,
- const char *name,
- const float *data_x, const float *data_y, const float *data_z,
- const int res[3], float matrix[4][4], short vec_type,
- const bool is_color, OpenVDBFloatGrid *mask)
+OpenVDBVectorGrid *OpenVDB_export_grid_vec(struct OpenVDBWriter *writer,
+ const char *name,
+ const float *data_x, const float *data_y, const float *data_z,
+ const int res[3], float matrix[4][4], short vec_type, const float clipping,
+ const bool is_color, OpenVDBFloatGrid *mask)
{
Timer(__func__);
@@ -105,6 +106,7 @@ OpenVDBVectorGrid *OpenVDB_export_grid_vec(
matrix,
static_cast<VecType>(vec_type),
is_color,
+ clipping,
mask_grid);
return reinterpret_cast<OpenVDBVectorGrid *>(grid);
diff --git a/intern/openvdb/openvdb_capi.h b/intern/openvdb/openvdb_capi.h
index 2d2feeadcf1..fe7af82769b 100644
--- a/intern/openvdb/openvdb_capi.h
+++ b/intern/openvdb/openvdb_capi.h
@@ -49,22 +49,20 @@ enum {
struct OpenVDBFloatGrid *OpenVDB_export_grid_fl(
struct OpenVDBWriter *writer,
const char *name, float *data,
- const int res[3], float matrix[4][4],
+ const int res[3], float matrix[4][4], const float clipping,
struct OpenVDBFloatGrid *mask);
-struct OpenVDBIntGrid *OpenVDB_export_grid_ch(
- struct OpenVDBWriter *writer,
- const char *name, unsigned char *data,
- const int res[3], float matrix[4][4],
- struct OpenVDBFloatGrid *mask);
+struct OpenVDBIntGrid *OpenVDB_export_grid_ch(struct OpenVDBWriter *writer,
+ const char *name, unsigned char *data,
+ const int res[3], float matrix[4][4], const float clipping,
+ struct OpenVDBFloatGrid *mask);
-struct OpenVDBVectorGrid *OpenVDB_export_grid_vec(
- struct OpenVDBWriter *writer,
- const char *name,
- const float *data_x, const float *data_y, const float *data_z,
- const int res[3], float matrix[4][4], short vec_type,
- const bool is_color,
- struct OpenVDBFloatGrid *mask);
+struct OpenVDBVectorGrid *OpenVDB_export_grid_vec(struct OpenVDBWriter *writer,
+ const char *name,
+ const float *data_x, const float *data_y, const float *data_z,
+ const int res[3], float matrix[4][4], short vec_type, const float clipping,
+ const bool is_color,
+ struct OpenVDBFloatGrid *mask);
void OpenVDB_import_grid_fl(
struct OpenVDBReader *reader,