Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/volume.cc
| Show All 30 Lines | |||||
| #include "BLI_float3.hh" | #include "BLI_float3.hh" | ||||
| #include "BLI_float4x4.hh" | #include "BLI_float4x4.hh" | ||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_index_range.hh" | #include "BLI_index_range.hh" | ||||
| #include "BLI_map.hh" | #include "BLI_map.hh" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_ref.hh" | |||||
| #include "BLI_task.hh" | #include "BLI_task.hh" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_anim_data.h" | #include "BKE_anim_data.h" | ||||
| #include "BKE_geometry_set.hh" | #include "BKE_geometry_set.hh" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| Show All 19 Lines | |||||
| static CLG_LogRef LOG = {"bke.volume"}; | static CLG_LogRef LOG = {"bke.volume"}; | ||||
| #endif | #endif | ||||
| #define VOLUME_FRAME_NONE INT_MAX | #define VOLUME_FRAME_NONE INT_MAX | ||||
| using blender::float3; | using blender::float3; | ||||
| using blender::float4x4; | using blender::float4x4; | ||||
| using blender::IndexRange; | using blender::IndexRange; | ||||
| using blender::StringRef; | |||||
| #ifdef WITH_OPENVDB | #ifdef WITH_OPENVDB | ||||
| # include <atomic> | # include <atomic> | ||||
| # include <list> | # include <list> | ||||
| # include <mutex> | # include <mutex> | ||||
| # include <unordered_set> | # include <unordered_set> | ||||
| # include <openvdb/openvdb.h> | # include <openvdb/openvdb.h> | ||||
| ▲ Show 20 Lines • Show All 1,364 Lines • ▼ Show 20 Lines | #ifdef WITH_OPENVDB | ||||
| grids.emplace_back(vdb_grid); | grids.emplace_back(vdb_grid); | ||||
| return &grids.back(); | return &grids.back(); | ||||
| #else | #else | ||||
| UNUSED_VARS(volume, name, type); | UNUSED_VARS(volume, name, type); | ||||
| return nullptr; | return nullptr; | ||||
| #endif | #endif | ||||
| } | } | ||||
| #ifdef WITH_OPENVDB | |||||
| VolumeGrid *BKE_volume_grid_add_vdb(Volume &volume, | |||||
| const StringRef name, | |||||
| openvdb::GridBase::Ptr vdb_grid) | |||||
| { | |||||
| VolumeGridVector &grids = *volume.runtime.grids; | |||||
| BLI_assert(BKE_volume_grid_find_for_read(&volume, name.data()) == nullptr); | |||||
| BLI_assert(BKE_volume_grid_type_openvdb(*vdb_grid) != VOLUME_GRID_UNKNOWN); | |||||
| vdb_grid->setName(name); | |||||
| grids.emplace_back(vdb_grid); | |||||
| return &grids.back(); | |||||
| } | |||||
| #endif | |||||
| void BKE_volume_grid_remove(Volume *volume, VolumeGrid *grid) | void BKE_volume_grid_remove(Volume *volume, VolumeGrid *grid) | ||||
| { | { | ||||
| #ifdef WITH_OPENVDB | #ifdef WITH_OPENVDB | ||||
| VolumeGridVector &grids = *volume->runtime.grids; | VolumeGridVector &grids = *volume->runtime.grids; | ||||
| for (VolumeGridVector::iterator it = grids.begin(); it != grids.end(); it++) { | for (VolumeGridVector::iterator it = grids.begin(); it != grids.end(); it++) { | ||||
| if (&*it == grid) { | if (&*it == grid) { | ||||
| grids.erase(it); | grids.erase(it); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines | |||||