Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_volume.h
| Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
| /* Grids | /* Grids | ||||
| * | * | ||||
| * For volumes referencing a file, the list of grids and metadata must be | * For volumes referencing a file, the list of grids and metadata must be | ||||
| * loaded before it can be accessed. This happens on-demand, only when needed | * loaded before it can be accessed. This happens on-demand, only when needed | ||||
| * by the user interface, dependency graph or render engine. */ | * by the user interface, dependency graph or render engine. */ | ||||
| typedef struct VolumeGrid VolumeGrid; | typedef struct VolumeGrid VolumeGrid; | ||||
| bool BKE_volume_load(struct Volume *volume, struct Main *bmain); | bool BKE_volume_load(const struct Volume *volume, const struct Main *bmain); | ||||
| void BKE_volume_unload(struct Volume *volume); | void BKE_volume_unload(struct Volume *volume); | ||||
| bool BKE_volume_is_loaded(const struct Volume *volume); | bool BKE_volume_is_loaded(const struct Volume *volume); | ||||
| int BKE_volume_num_grids(const struct Volume *volume); | int BKE_volume_num_grids(const struct Volume *volume); | ||||
| const char *BKE_volume_grids_error_msg(const struct Volume *volume); | const char *BKE_volume_grids_error_msg(const struct Volume *volume); | ||||
| const char *BKE_volume_grids_frame_filepath(const struct Volume *volume); | const char *BKE_volume_grids_frame_filepath(const struct Volume *volume); | ||||
| VolumeGrid *BKE_volume_grid_get(const struct Volume *volume, int grid_index); | const VolumeGrid *BKE_volume_grid_get_for_read(const struct Volume *volume, int grid_index); | ||||
| VolumeGrid *BKE_volume_grid_active_get(const struct Volume *volume); | VolumeGrid *BKE_volume_grid_get_for_write(struct Volume *volume, int grid_index); | ||||
| VolumeGrid *BKE_volume_grid_find(const struct Volume *volume, const char *name); | const VolumeGrid *BKE_volume_grid_active_get_for_read(const struct Volume *volume); | ||||
| const VolumeGrid *BKE_volume_grid_find_for_read(const struct Volume *volume, const char *name); | |||||
| /* Grid | /* Grid | ||||
| * | * | ||||
| * By default only grid metadata is loaded, for access to the tree and voxels | * By default only grid metadata is loaded, for access to the tree and voxels | ||||
| * BKE_volume_grid_load must be called first. */ | * BKE_volume_grid_load must be called first. */ | ||||
| typedef enum VolumeGridType { | typedef enum VolumeGridType { | ||||
| VOLUME_GRID_UNKNOWN = 0, | VOLUME_GRID_UNKNOWN = 0, | ||||
| VOLUME_GRID_BOOLEAN, | VOLUME_GRID_BOOLEAN, | ||||
| VOLUME_GRID_FLOAT, | VOLUME_GRID_FLOAT, | ||||
| VOLUME_GRID_DOUBLE, | VOLUME_GRID_DOUBLE, | ||||
| VOLUME_GRID_INT, | VOLUME_GRID_INT, | ||||
| VOLUME_GRID_INT64, | VOLUME_GRID_INT64, | ||||
| VOLUME_GRID_MASK, | VOLUME_GRID_MASK, | ||||
| VOLUME_GRID_STRING, | VOLUME_GRID_STRING, | ||||
| VOLUME_GRID_VECTOR_FLOAT, | VOLUME_GRID_VECTOR_FLOAT, | ||||
| VOLUME_GRID_VECTOR_DOUBLE, | VOLUME_GRID_VECTOR_DOUBLE, | ||||
| VOLUME_GRID_VECTOR_INT, | VOLUME_GRID_VECTOR_INT, | ||||
| VOLUME_GRID_POINTS, | VOLUME_GRID_POINTS, | ||||
| } VolumeGridType; | } VolumeGridType; | ||||
| bool BKE_volume_grid_load(const struct Volume *volume, struct VolumeGrid *grid); | bool BKE_volume_grid_load(const struct Volume *volume, const struct VolumeGrid *grid); | ||||
| void BKE_volume_grid_unload(const struct Volume *volume, struct VolumeGrid *grid); | void BKE_volume_grid_unload(const struct Volume *volume, const struct VolumeGrid *grid); | ||||
| bool BKE_volume_grid_is_loaded(const struct VolumeGrid *grid); | bool BKE_volume_grid_is_loaded(const struct VolumeGrid *grid); | ||||
| /* Metadata */ | /* Metadata */ | ||||
| const char *BKE_volume_grid_name(const struct VolumeGrid *grid); | const char *BKE_volume_grid_name(const struct VolumeGrid *grid); | ||||
| VolumeGridType BKE_volume_grid_type(const struct VolumeGrid *grid); | VolumeGridType BKE_volume_grid_type(const struct VolumeGrid *grid); | ||||
| int BKE_volume_grid_channels(const struct VolumeGrid *grid); | int BKE_volume_grid_channels(const struct VolumeGrid *grid); | ||||
| void BKE_volume_grid_transform_matrix(const struct VolumeGrid *grid, float mat[4][4]); | void BKE_volume_grid_transform_matrix(const struct VolumeGrid *grid, float mat[4][4]); | ||||
| /* Bounds */ | |||||
| bool BKE_volume_grid_bounds(const struct VolumeGrid *grid, float min[3], float max[3]); | |||||
| /* Volume Editing | /* Volume Editing | ||||
| * | * | ||||
| * These are intended for modifiers to use on evaluated datablocks. | * These are intended for modifiers to use on evaluated datablocks. | ||||
| * | * | ||||
| * new_for_eval creates a volume datablock with no grids or file path, but | * new_for_eval creates a volume datablock with no grids or file path, but | ||||
| * preserves other settings such as viewport display options. | * preserves other settings such as viewport display options. | ||||
| * | * | ||||
| * copy_for_eval creates a volume datablock preserving everything except the | * copy_for_eval creates a volume datablock preserving everything except the | ||||
| * file path. Grids are shared with the source datablock, not copied. */ | * file path. Grids are shared with the source datablock, not copied. */ | ||||
| struct Volume *BKE_volume_new_for_eval(const struct Volume *volume_src); | struct Volume *BKE_volume_new_for_eval(const struct Volume *volume_src); | ||||
| struct Volume *BKE_volume_copy_for_eval(struct Volume *volume_src, bool reference); | struct Volume *BKE_volume_copy_for_eval(struct Volume *volume_src, bool reference); | ||||
| struct VolumeGrid *BKE_volume_grid_add(struct Volume *volume, | struct VolumeGrid *BKE_volume_grid_add(struct Volume *volume, | ||||
| const char *name, | const char *name, | ||||
| VolumeGridType type); | VolumeGridType type); | ||||
| void BKE_volume_grid_remove(struct Volume *volume, struct VolumeGrid *grid); | void BKE_volume_grid_remove(struct Volume *volume, struct VolumeGrid *grid); | ||||
| /* Simplify */ | /* Simplify */ | ||||
| int BKE_volume_simplify_level(const struct Depsgraph *depsgraph); | int BKE_volume_simplify_level(const struct Depsgraph *depsgraph); | ||||
| float BKE_volume_simplify_factor(const struct Depsgraph *depsgraph); | float BKE_volume_simplify_factor(const struct Depsgraph *depsgraph); | ||||
| /* File Save */ | /* File Save */ | ||||
| bool BKE_volume_save(struct Volume *volume, | bool BKE_volume_save(const struct Volume *volume, | ||||
| struct Main *bmain, | const struct Main *bmain, | ||||
| struct ReportList *reports, | struct ReportList *reports, | ||||
| const char *filepath); | const char *filepath); | ||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| #endif | #endif | ||||
| /* OpenVDB Grid Access | /* OpenVDB Grid Access | ||||
| * | * | ||||
| * Access to OpenVDB grid for C++. These will automatically load grids from | * Access to OpenVDB grid for C++. These will automatically load grids from | ||||
| * file or copy shared grids to make them writeable. */ | * file or copy shared grids to make them writeable. */ | ||||
| #if defined(__cplusplus) && defined(WITH_OPENVDB) | #ifdef __cplusplus | ||||
| # include "BLI_float3.hh" | |||||
| # include "BLI_float4x4.hh" | |||||
| bool BKE_volume_min_max(const Volume *volume, blender::float3 &r_min, blender::float3 &r_max); | |||||
| # ifdef WITH_OPENVDB | |||||
| # include <openvdb/openvdb.h> | # include <openvdb/openvdb.h> | ||||
| # include <openvdb/points/PointDataGrid.h> | # include <openvdb/points/PointDataGrid.h> | ||||
| bool BKE_volume_grid_bounds(openvdb::GridBase::ConstPtr grid, | |||||
| blender::float3 &r_min, | |||||
| blender::float3 &r_max); | |||||
| openvdb::GridBase::ConstPtr BKE_volume_grid_shallow_transform(openvdb::GridBase::ConstPtr grid, | |||||
| const blender::float4x4 &transform); | |||||
| openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_metadata(const struct VolumeGrid *grid); | openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_metadata(const struct VolumeGrid *grid); | ||||
| openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(const struct Volume *volume, | openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(const struct Volume *volume, | ||||
| struct VolumeGrid *grid); | const struct VolumeGrid *grid); | ||||
| openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const struct Volume *volume, | openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const struct Volume *volume, | ||||
| struct VolumeGrid *grid, | struct VolumeGrid *grid, | ||||
| const bool clear); | const bool clear); | ||||
| VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase &grid); | VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase &grid); | ||||
| template<typename OpType> | template<typename OpType> | ||||
| auto BKE_volume_grid_type_operation(const VolumeGridType grid_type, OpType &&op) | auto BKE_volume_grid_type_operation(const VolumeGridType grid_type, OpType &&op) | ||||
| Show All 30 Lines | auto BKE_volume_grid_type_operation(const VolumeGridType grid_type, OpType &&op) | ||||
| return op.template operator()<openvdb::FloatGrid>(); | return op.template operator()<openvdb::FloatGrid>(); | ||||
| } | } | ||||
| openvdb::GridBase::Ptr BKE_volume_grid_create_with_changed_resolution( | openvdb::GridBase::Ptr BKE_volume_grid_create_with_changed_resolution( | ||||
| const VolumeGridType grid_type, | const VolumeGridType grid_type, | ||||
| const openvdb::GridBase &old_grid, | const openvdb::GridBase &old_grid, | ||||
| const float resolution_factor); | const float resolution_factor); | ||||
| #endif | # endif | ||||
| #endif | |||||