Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_volume_displace.cc
| Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | openvdb::Mat4s get_index_to_texture_transform() const | ||||
| const openvdb::Mat4s index_to_object{ | const openvdb::Mat4s index_to_object{ | ||||
| base_grid.transform().baseMap()->getAffineMap()->getMat4()}; | base_grid.transform().baseMap()->getAffineMap()->getMat4()}; | ||||
| switch (vdmd.texture_map_mode) { | switch (vdmd.texture_map_mode) { | ||||
| case MOD_VOLUME_DISPLACE_MAP_LOCAL: { | case MOD_VOLUME_DISPLACE_MAP_LOCAL: { | ||||
| return index_to_object; | return index_to_object; | ||||
| } | } | ||||
| case MOD_VOLUME_DISPLACE_MAP_GLOBAL: { | case MOD_VOLUME_DISPLACE_MAP_GLOBAL: { | ||||
| const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->obmat); | const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->object_to_world); | ||||
| return index_to_object * object_to_world; | return index_to_object * object_to_world; | ||||
| } | } | ||||
| case MOD_VOLUME_DISPLACE_MAP_OBJECT: { | case MOD_VOLUME_DISPLACE_MAP_OBJECT: { | ||||
| if (vdmd.texture_map_object == nullptr) { | if (vdmd.texture_map_object == nullptr) { | ||||
| return index_to_object; | return index_to_object; | ||||
| } | } | ||||
| const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->obmat); | const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->object_to_world); | ||||
| const openvdb::Mat4s world_to_texture = matrix_to_openvdb(vdmd.texture_map_object->imat); | const openvdb::Mat4s world_to_texture = matrix_to_openvdb(vdmd.texture_map_object->imat); | ||||
| return index_to_object * object_to_world * world_to_texture; | return index_to_object * object_to_world * world_to_texture; | ||||
| } | } | ||||
| } | } | ||||
| BLI_assert(false); | BLI_assert(false); | ||||
| return {}; | return {}; | ||||
| } | } | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines | |||||