| 31 | |
| 32 | /* Hit structure that defines complete order over hits */ |
| 33 | struct Hit |
| 34 | { |
| 35 | Hit() : opaque(false), t(0.0f), primID(RTC_INVALID_GEOMETRY_ID), geomID(RTC_INVALID_GEOMETRY_ID), instID(RTC_INVALID_GEOMETRY_ID) {} |
| 36 | |
| 37 | Hit (bool opaque, float t, unsigned int primID = 0xFFFFFFFF, unsigned int geomID = 0xFFFFFFFF, unsigned int instID = 0xFFFFFFFF) |
| 38 | : opaque(opaque), t(t), primID(primID), geomID(geomID), instID(instID) {} |
| 39 | |
| 40 | /* lexicographical order (t,instID,geomID,primID) */ |
| 41 | __forceinline friend bool operator < (const Hit& a, const Hit& b) |
| 42 | { |
| 43 | if (a.t == b.t) { |
| 44 | if (a.instID == b.instID) { |
| 45 | if (a.geomID == b.geomID) return a.primID < b.primID; |
| 46 | else return a.geomID < b.geomID; |
| 47 | } |
| 48 | else return a.instID < b.instID; |
| 49 | } |
| 50 | return a.t < b.t; |
| 51 | } |
| 52 | |
| 53 | __forceinline friend bool operator == (const Hit& a, const Hit& b) { |
| 54 | return a.t == b.t && a.primID == b.primID && a.geomID == b.geomID && a.instID == b.instID; |
| 55 | } |
| 56 | |
| 57 | __forceinline friend bool operator <= (const Hit& a, const Hit& b) |
| 58 | { |
| 59 | if (a == b) return true; |
| 60 | else return a < b; |
| 61 | } |
| 62 | |
| 63 | __forceinline friend bool operator != (const Hit& a, const Hit& b) { |
| 64 | return !(a == b); |
| 65 | } |
| 66 | |
| 67 | friend std::ostream& operator<<(std::ostream& cout, const Hit& hit) { |
| 68 | return cout << "Hit { opaque = " << hit.opaque << ", t = " << hit.t << ", instID = " << hit.instID << ", geomID = " << hit.geomID << ", primID = " << hit.primID << " }"; |
| 69 | } |
| 70 | |
| 71 | public: |
| 72 | bool opaque; |
| 73 | float t; |
| 74 | unsigned int primID; |
| 75 | unsigned int geomID; |
| 76 | unsigned int instID; |
| 77 | }; |
| 78 | |
| 79 | /* return number of gathered hits */ |
| 80 | unsigned int size() const { |
no outgoing calls
no test coverage detected