16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-20 03:19:19 +02:00

mouse picking improvements: filter out backfacing; include near plane in ray origin computation

This commit is contained in:
Wls50
2025-11-28 22:01:27 +01:00
committed by Hirek
parent a22f449ecd
commit aa0b6e9965
2 changed files with 18 additions and 7 deletions

View File

@@ -137,7 +137,9 @@ const TSubModel* Rt::RtModel::Intersect(
[&](size_t const begin, size_t const end) {
for (size_t i = begin; i < end; ++i) {
size_t const j = submodel.bvh.prim_ids[i];
if (auto hit = submodel.tris[j].intersect(ray)) {
if (auto hit = submodel.tris[j].intersect(ray);
!!hit && dot(rd_local, glm::make_vec3(
submodel.tris[j].n.values)) > 0.) {
prim_id = i;
std::tie(ray.tmax, u, v) = *hit;
result = submodel.submodel;