Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/volume_render.cc
| Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | static void create_texture_to_object_matrix(const openvdb::Mat4d &grid_transform, | ||||
| copy_v3_v3(texture_to_index[3], loc.asV()); | copy_v3_v3(texture_to_index[3], loc.asV()); | ||||
| mul_m4_m4m4(r_texture_to_object, index_to_object, texture_to_index); | mul_m4_m4m4(r_texture_to_object, index_to_object, texture_to_index); | ||||
| } | } | ||||
| #endif | #endif | ||||
| bool BKE_volume_grid_dense_floats(const Volume *volume, | bool BKE_volume_grid_dense_floats(const Volume *volume, | ||||
| VolumeGrid *volume_grid, | const VolumeGrid *volume_grid, | ||||
| DenseFloatVolumeGrid *r_dense_grid) | DenseFloatVolumeGrid *r_dense_grid) | ||||
| { | { | ||||
| #ifdef WITH_OPENVDB | #ifdef WITH_OPENVDB | ||||
| const VolumeGridType grid_type = BKE_volume_grid_type(volume_grid); | const VolumeGridType grid_type = BKE_volume_grid_type(volume_grid); | ||||
| openvdb::GridBase::ConstPtr grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); | openvdb::GridBase::ConstPtr grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); | ||||
| const openvdb::CoordBBox bbox = grid->evalActiveVoxelBoundingBox(); | const openvdb::CoordBBox bbox = grid->evalActiveVoxelBoundingBox(); | ||||
| if (bbox.empty()) { | if (bbox.empty()) { | ||||
| ▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | for (int i = 0; i < boxes.size(); i++) { | ||||
| vert_offset += 8; | vert_offset += 8; | ||||
| tri_offset += 12; | tri_offset += 12; | ||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| void BKE_volume_grid_wireframe(const Volume *volume, | void BKE_volume_grid_wireframe(const Volume *volume, | ||||
| VolumeGrid *volume_grid, | const VolumeGrid *volume_grid, | ||||
| BKE_volume_wireframe_cb cb, | BKE_volume_wireframe_cb cb, | ||||
| void *cb_userdata) | void *cb_userdata) | ||||
| { | { | ||||
| if (volume->display.wireframe_type == VOLUME_WIREFRAME_NONE) { | if (volume->display.wireframe_type == VOLUME_WIREFRAME_NONE) { | ||||
| cb(cb_userdata, nullptr, nullptr, 0, 0); | cb(cb_userdata, nullptr, nullptr, 0, 0); | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | static void grow_triangles(blender::MutableSpan<blender::float3> verts, | ||||
| /* Apply the computed offsets. */ | /* Apply the computed offsets. */ | ||||
| for (const int i : verts.index_range()) { | for (const int i : verts.index_range()) { | ||||
| verts[i] += offsets[i]; | verts[i] += offsets[i]; | ||||
| } | } | ||||
| } | } | ||||
| #endif /* WITH_OPENVDB */ | #endif /* WITH_OPENVDB */ | ||||
| void BKE_volume_grid_selection_surface(const Volume *volume, | void BKE_volume_grid_selection_surface(const Volume *volume, | ||||
| VolumeGrid *volume_grid, | const VolumeGrid *volume_grid, | ||||
| BKE_volume_selection_surface_cb cb, | BKE_volume_selection_surface_cb cb, | ||||
| void *cb_userdata) | void *cb_userdata) | ||||
| { | { | ||||
| #ifdef WITH_OPENVDB | #ifdef WITH_OPENVDB | ||||
| openvdb::GridBase::ConstPtr grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); | openvdb::GridBase::ConstPtr grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); | ||||
| blender::Vector<openvdb::CoordBBox> boxes = get_bounding_boxes( | blender::Vector<openvdb::CoordBBox> boxes = get_bounding_boxes( | ||||
| BKE_volume_grid_type(volume_grid), *grid, true); | BKE_volume_grid_type(volume_grid), *grid, true); | ||||
| Show All 29 Lines | |||||