Rev | Line | |
---|
[2197] | 1 | #pragma once
|
---|
| 2 | #include "Intersectable.hpp"
|
---|
| 3 |
|
---|
| 4 | class Triangle : public Intersectable { |
---|
| 5 | // const Material* material; |
---|
| 6 | const Vector* a, *b, *c; // the 3 vertices |
---|
| 7 | Vector normal; // surface normal |
---|
| 8 | enum DominantAxis{X_DOMINANT, Y_DOMINANT, Z_DOMINANT} dominantAxis; |
---|
| 9 | // pre computed values for faster intersection testing: |
---|
| 10 | float hyperPlaneShiftOffset; |
---|
| 11 | float d1, d2, d3, d4, d5, d6; |
---|
| 12 | public: |
---|
| 13 | Triangle(const Vector* a, const Vector* b, const Vector* c, const Material* material); |
---|
| 14 | bool intersect(const Ray& ray, float& depth, float rayMin, float rayMax); |
---|
| 15 | bool intersectBackSide(const Ray& ray, float& depth, float rayMin, float rayMax); |
---|
| 16 | Vector getShadingNormal(const Vector& point) |
---|
| 17 | { |
---|
| 18 | return normal; |
---|
| 19 | } |
---|
| 20 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.