light: ray stream api: allow getting hit face
This commit is contained in:
parent
902fe7073c
commit
63e8f42c87
|
|
@ -66,6 +66,7 @@ public:
|
|||
virtual float getPushedRayDist(size_t j) = 0;
|
||||
virtual float getPushedRayHitDist(size_t j) = 0;
|
||||
virtual hittype_t getPushedRayHitType(size_t j) = 0;
|
||||
virtual const bsp2_dface_t *getPushedRayHitFace(size_t j) = 0;
|
||||
virtual void getPushedRayDir(size_t j, vec3_t out) = 0;
|
||||
virtual int getPushedRayPointIndex(size_t j) = 0;
|
||||
virtual void getPushedRayColor(size_t j, vec3_t out) = 0;
|
||||
|
|
|
|||
|
|
@ -800,6 +800,7 @@ public:
|
|||
// hit info
|
||||
float _hitdist;
|
||||
hittype_t _hittype;
|
||||
const bsp2_dface_t *_hitface;
|
||||
bool _hit_occluded;
|
||||
|
||||
bsp_ray_t(int i, const vec_t *origin, const vec3_t dir, float dist, const dmodel_t *selfshadow, const vec_t *color, const vec_t *normalcontrib) :
|
||||
|
|
@ -808,6 +809,7 @@ public:
|
|||
_selfshadow{selfshadow},
|
||||
_hitdist{dist},
|
||||
_hittype{hittype_t::NONE},
|
||||
_hitface(nullptr),
|
||||
_hit_occluded{false} {
|
||||
VectorCopy(origin, _origin);
|
||||
VectorCopy(dir, _dir);
|
||||
|
|
@ -857,7 +859,7 @@ public:
|
|||
return;
|
||||
|
||||
for (bsp_ray_t &ray : _rays) {
|
||||
ray._hittype = BSP_DirtTrace(ray._origin, ray._dir, ray._maxdist, ray._selfshadow, &ray._hitdist, nullptr, nullptr);
|
||||
ray._hittype = BSP_DirtTrace(ray._origin, ray._dir, ray._maxdist, ray._selfshadow, &ray._hitdist, nullptr, &ray._hitface);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -877,6 +879,10 @@ public:
|
|||
return _rays.at(j)._hittype;
|
||||
}
|
||||
|
||||
virtual const bsp2_dface_t *getPushedRayHitFace(size_t j) {
|
||||
return _rays.at(j)._hitface;
|
||||
}
|
||||
|
||||
virtual void getPushedRayDir(size_t j, vec3_t out) {
|
||||
for (int i=0; i<3; i++) {
|
||||
out[i] = _rays.at(j)._dir[i];
|
||||
|
|
|
|||
|
|
@ -869,6 +869,21 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual const bsp2_dface_t *getPushedRayHitFace(size_t j) {
|
||||
Q_assert(j < _maxrays);
|
||||
|
||||
const RTCRay &ray = _rays[j];
|
||||
|
||||
if (ray.geomID == RTC_INVALID_GEOMETRY_ID)
|
||||
return nullptr;
|
||||
|
||||
const sceneinfo &si = Embree_SceneinfoForGeomID(ray.geomID);
|
||||
const bsp2_dface_t *face = si.triToFace.at(ray.primID);
|
||||
Q_assert(face != nullptr);
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
virtual void getPushedRayDir(size_t j, vec3_t out) {
|
||||
Q_assert(j < _maxrays);
|
||||
for (int i=0; i<3; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue