DHART
Loading...
Searching...
No Matches
MultiRT.cpp
Go to the documentation of this file.
1#include <MultiRT.h>
2#include <embree_raytracer.h>
3#include <ray_data.h>
4#include <cassert>
5
6#include <stdio.h>
7namespace HF::RayTracer {
8
9 inline void Log(MultiRT::RT_Type type, std::string Message = "") {
10 std::cout << "SHooting Ray. Type is";
11 std::string name = "";
12 switch (type) {
13 case(MultiRT::EMBREE):
14 name = "embree";
15 break;
16 case(MultiRT::NANO_RT):
17 name = "nano_rt";
18 break;
19 default:
20 "NoType!";
21 break;
22 }
23
24 std::cout << name << "'" << Message << "'" << std::endl;
25 }
26
27
29 assert(ert != NULL);
30 this->RayTracer = ert;
31 this->type = EMBREE;
32 }
33
35 assert(nrt != NULL);
36 this->RayTracer = nrt;
37 this->type = NANO_RT;
38 }
39
41 if (this->type == EMBREE)
42 return reinterpret_cast<HF::RayTracer::EmbreeRayTracer*>(this->RayTracer)->Intersect(origin, direction);
43 else if (this->type == NANO_RT)
44 return reinterpret_cast<HF::RayTracer::NanoRTRayTracer*>(this->RayTracer)->Intersect(origin, direction);
45 else
46 assert(false);
47 }
48
49 bool MultiRT::Occluded(const MultiRT::real3& origin, const MultiRT::real3& direction, MultiRT::real_t distance) {
50 if (this->type == EMBREE)
51 return reinterpret_cast<HF::RayTracer::EmbreeRayTracer*>(this->RayTracer)->Occluded(origin, direction, distance);
52 else if (this->type == NANO_RT)
53 return reinterpret_cast<HF::RayTracer::NanoRTRayTracer*>(this->RayTracer)->Occluded(origin, direction, distance);
54 else
55 assert(false);
56 }
57}
Contains definitions for the EmbreeRayTracer
Cast rays to determine if and where they intersect geometry.
void Log(MultiRT::RT_Type type, std::string Message="")
Definition: MultiRT.cpp:9
A wrapper for Intel's Embree Library.
A simple hit struct to carry all relevant information about hits.
Definition: HitStruct.h:7
bool Occluded(const real3 &origin, const real3 &direction, real_t distance)
Definition: MultiRT.cpp:49
HitStruct< real_t > Intersect(const real3 &origin, const real3 &direction)
Definition: MultiRT.cpp:40
std::array< real_t, 3 > real3
Definition: MultiRT.h:12