equal
deleted
inserted
replaced
293 #endif |
293 #endif |
294 }; |
294 }; |
295 public: |
295 public: |
296 Vertex *A, *B, *C; |
296 Vertex *A, *B, *C; |
297 |
297 |
|
298 Triangle() {}; |
298 Triangle(Vertex *aA, Vertex *aB, Vertex *aC, Material *amaterial); |
299 Triangle(Vertex *aA, Vertex *aB, Vertex *aC, Material *amaterial); |
299 bool intersect(const Ray &ray, Float &dist) const; |
300 bool intersect(const Ray &ray, Float &dist) const; |
300 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const {return false;}; |
301 bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const {return false;}; |
301 bool intersect_bbox(const BBox &bbox) const; |
302 bool intersect_bbox(const BBox &bbox) const; |
302 const Vector3 normal(const Vector3 &P) const { return (smooth ? smooth_normal(P) : N); }; |
303 const Vector3 normal(const Vector3 &P) const { return (smooth ? smooth_normal(P) : N); }; |
305 void setFlat() { smooth = false; }; |
306 void setFlat() { smooth = false; }; |
306 bool getSmooth() const { return smooth; }; |
307 bool getSmooth() const { return smooth; }; |
307 BBox get_bbox() const; |
308 BBox get_bbox() const; |
308 }; |
309 }; |
309 |
310 |
310 #endif |
311 template <class T> class Array |
|
312 { |
|
313 T *array; |
|
314 public: |
|
315 Array(int n) { array = new T[n]; }; |
|
316 ~Array() { delete[] array; }; |
|
317 const T &operator[](int i) const { return array[i]; }; |
|
318 }; |
|
319 |
|
320 typedef Array<Vertex> VertexArray; |
|
321 typedef Array<NormalVertex> NormalVertexArray; |
|
322 typedef Array<Triangle> TriangleArray; |
|
323 |
|
324 #endif |