Cleanup: Use float4x4 matrix type in volume displace modifier
This commit is contained in:
@@ -119,12 +119,12 @@ static void panel_register(ARegionType *region_type)
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
|
||||
static openvdb::Mat4s matrix_to_openvdb(const float m[4][4])
|
||||
static openvdb::Mat4s matrix_to_openvdb(const blender::float4x4 &m)
|
||||
{
|
||||
/* OpenVDB matrices are transposed Blender matrices, i.e. the translation is in the last row
|
||||
* instead of in the last column. However, the layout in memory is the same, because OpenVDB
|
||||
* matrices are row major (compared to Blender's column major matrices). */
|
||||
openvdb::Mat4s new_matrix{reinterpret_cast<const float *>(m)};
|
||||
openvdb::Mat4s new_matrix{m.base_ptr()};
|
||||
return new_matrix;
|
||||
}
|
||||
|
||||
@@ -250,18 +250,16 @@ struct DisplaceGridOp {
|
||||
return index_to_object;
|
||||
}
|
||||
case MOD_VOLUME_DISPLACE_MAP_GLOBAL: {
|
||||
const openvdb::Mat4s object_to_world = matrix_to_openvdb(
|
||||
ctx.object->object_to_world().ptr());
|
||||
const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->object_to_world());
|
||||
return index_to_object * object_to_world;
|
||||
}
|
||||
case MOD_VOLUME_DISPLACE_MAP_OBJECT: {
|
||||
if (vdmd.texture_map_object == nullptr) {
|
||||
return index_to_object;
|
||||
}
|
||||
const openvdb::Mat4s object_to_world = matrix_to_openvdb(
|
||||
ctx.object->object_to_world().ptr());
|
||||
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->world_to_object().ptr());
|
||||
vdmd.texture_map_object->world_to_object());
|
||||
return index_to_object * object_to_world * world_to_texture;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user