Fix add emboss volume on reflected
This commit is contained in:
parent
d653cc6ab5
commit
9c70ed01e5
2 changed files with 6 additions and 7 deletions
|
@ -3462,15 +3462,12 @@ bool priv::start_create_volume_on_surface_job(
|
|||
if (!hit.has_value())
|
||||
return false;
|
||||
|
||||
// priv::reset_skew(hit_to_world);
|
||||
Transform3d instance = gl_volume->get_instance_transformation().get_matrix();
|
||||
|
||||
// Create result volume transformation
|
||||
Transform3d surface_trmat = create_transformation_onto_surface(hit->position, hit->normal, priv::up_limit);
|
||||
const FontProp &font_prop = emboss_data.text_configuration.style.prop;
|
||||
apply_transformation(font_prop, surface_trmat);
|
||||
// new transformation in world coor is surface_trmat
|
||||
Transform3d volume_trmat = instance.inverse() * surface_trmat;
|
||||
Transform3d instance = gl_volume->get_instance_transformation().get_matrix();
|
||||
Transform3d volume_trmat = instance.inverse() * surface_trmat;
|
||||
start_create_volume_job(obj, volume_trmat, emboss_data, volume_type);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -153,6 +153,8 @@ std::optional<RaycastManager::Hit> RaycastManager::first_hit(const Vec3d& point,
|
|||
for (int i = 0; i < 3; ++i)
|
||||
pts[i] = tr * hit_mesh->vertices(tri[i]).cast<double>();
|
||||
Vec3d normal_world = (pts[1] - pts[0]).cross(pts[2] - pts[1]);
|
||||
if (has_reflection(*hit_tramsformation))
|
||||
normal_world *= -1;
|
||||
normal_world.normalize();
|
||||
|
||||
SurfacePoint<double> point_world{hit_world, normal_world};
|
||||
|
@ -298,8 +300,8 @@ RaycastManager::TrItems::const_iterator find(const RaycastManager::TrItems &item
|
|||
|
||||
template<typename VecType> inline void erase(std::vector<VecType> &vec, const std::vector<bool> &flags)
|
||||
{
|
||||
assert(vec.size() == flags.size());
|
||||
if (flags.empty()) return;
|
||||
if (vec.size() < flags.size() || flags.empty())
|
||||
return;
|
||||
|
||||
// reverse iteration over flags to erase indices from back to front.
|
||||
for (int i = static_cast<int>(flags.size()) - 1; i >= 0; --i)
|
||||
|
|
Loading…
Reference in a new issue