DHART
Loading...
Searching...
No Matches
HitStruct.h
Go to the documentation of this file.
1#pragma once
2
3
4namespace HF::RayTracer {
6 template <typename numeric_type = double>
7 struct HitStruct {
8 numeric_type distance;
9 int meshid;
10
11 HitStruct() : distance(-1), meshid(-1) {}
12
13 HitStruct(numeric_type in_distance, int in_meshid) : distance(in_distance), meshid(in_meshid) {}
14
17 inline bool DidHit() const {
18 return DidIntersect(this->meshid);
19 }
20 };
21
22 const int FAIL_ID = ((unsigned int)-1);
23 inline bool DidIntersect(int mesh_id) {
24 return mesh_id != FAIL_ID;
25 }
26}
Cast rays to determine if and where they intersect geometry.
const int FAIL_ID
Definition: HitStruct.h:22
bool DidIntersect(int mesh_id)
Definition: HitStruct.h:23
A simple hit struct to carry all relevant information about hits.
Definition: HitStruct.h:7
bool DidHit() const
Determine whether or not this hitstruct contains a hit.
Definition: HitStruct.h:17
numeric_type distance
Distance from the origin point to the hit point. Set to -1 if no hit was recorded.
Definition: HitStruct.h:8
int meshid
The ID of the hit mesh. Set to -1 if no hit was recorded.
Definition: HitStruct.h:9
HitStruct(numeric_type in_distance, int in_meshid)
Definition: HitStruct.h:13