Assignments Assignments

triangle.h
Go to the documentation of this file.
1#ifndef TRIANGLE_INCLUDED
2#define TRIANGLE_INCLUDED
3#include <Util/geometry.h>
4#include <Util/polynomial.h>
5#include "shape.h"
6#include "scene.h"
7
8 namespace Ray
9{
11 class TriangleIndex
12 {
14 GLuint _indices[3];
15
16 public:
18 TriangleIndex( void ){ _indices[0] = _indices[1] = _indices[2] = 0; }
19
21 TriangleIndex( unsigned int i0 , unsigned int i1 , unsigned int i2 ){ _indices[0] = i0 , _indices[1] = i1 , _indices[2] = i2; }
22
24 GLuint& operator[] ( int idx ) { return _indices[idx]; }
25
27 const GLuint &operator[] ( int idx ) const { return _indices[idx]; }
28 };
29
31 class Triangle : public Shape
32 {
34 size_t _vIndices[3];
35
37 const class Vertex* _v[3];
38
39 public:
41 static std::string Directive( void ){ return "shape_triangle"; }
42
44 Triangle( void );
45
47 // Shape methods //
49 private:
50 void _write( std::ostream &stream ) const;
51 void _read( std::istream &stream );
52 public:
53 std::string name( void ) const { return "triangle"; }
54 void init( const class LocalSceneData &data );
55 void initOpenGL( void );
56 void updateBoundingBox( void );
57 bool processFirstIntersection( const Util::Ray3D &ray , const Util::BoundingBox1D &range , const RayIntersectionFilter &rFilter , const RayIntersectionKernel &rKernel , ShapeProcessingInfo spInfo , unsigned int tIdx ) const;
58 int processAllIntersections( const Util::Ray3D &ray , const Util::BoundingBox1D &range , const RayIntersectionFilter &rFilter , const RayIntersectionKernel &rKernel , ShapeProcessingInfo spInfo , unsigned int tIdx ) const;
59 bool isInside( Util::Point3D p ) const;
60 void addTrianglesOpenGL( std::vector< TriangleIndex >& triangles );
61 void drawOpenGL( GLSLProgram * glslProgram ) const;
62 };
63}
64#endif // TRIANGLE_INCLUDED
65
66
GLSLProgram
Definition GLSLProgram.h:33
Ray::LocalSceneData
Definition scene.h:62
Ray::Shape
Definition shape.h:90
Ray::Shape::RayIntersectionFilter
std::function< bool(double) > RayIntersectionFilter
Definition shape.h:164
Ray::Shape::RayIntersectionKernel
std::function< bool(const ShapeProcessingInfo &, const class RayShapeIntersectionInfo &) > RayIntersectionKernel
Definition shape.h:165
Ray::Triangle
Definition triangle.h:32
Ray::Triangle::processFirstIntersection
bool processFirstIntersection(const Util::Ray3D &ray, const Util::BoundingBox1D &range, const RayIntersectionFilter &rFilter, const RayIntersectionKernel &rKernel, ShapeProcessingInfo spInfo, unsigned int tIdx) const
Definition triangle.todo.cpp:48
Ray::Triangle::updateBoundingBox
void updateBoundingBox(void)
Definition triangle.todo.cpp:29
Ray::Triangle::addTrianglesOpenGL
void addTrianglesOpenGL(std::vector< TriangleIndex > &triangles)
Definition triangle.cpp:26
Ray::Triangle::_write
void _write(std::ostream &stream) const
Definition triangle.cpp:18
Ray::Triangle::_vIndices
size_t _vIndices[3]
Definition triangle.h:34
Ray::Triangle::init
void init(const class LocalSceneData &data)
Definition triangle.todo.cpp:12
Ray::Triangle::drawOpenGL
void drawOpenGL(GLSLProgram *glslProgram) const
Definition triangle.todo.cpp:59
Ray::Triangle::_v
const class Vertex * _v[3]
Definition triangle.h:37
Ray::Triangle::initOpenGL
void initOpenGL(void)
Definition triangle.todo.cpp:37
Ray::Triangle::Triangle
Triangle(void)
Definition triangle.cpp:11
Ray::Triangle::processAllIntersections
int processAllIntersections(const Util::Ray3D &ray, const Util::BoundingBox1D &range, const RayIntersectionFilter &rFilter, const RayIntersectionKernel &rKernel, ShapeProcessingInfo spInfo, unsigned int tIdx) const
Definition triangle.cpp:31
Ray::Triangle::Directive
static std::string Directive(void)
Definition triangle.h:41
Ray::Triangle::name
std::string name(void) const
Definition triangle.h:53
Ray::Triangle::_read
void _read(std::istream &stream)
Definition triangle.cpp:13
Ray::Triangle::isInside
bool isInside(Util::Point3D p) const
Definition triangle.cpp:24
Ray::TriangleIndex
Definition triangle.h:12
Ray::TriangleIndex::_indices
GLuint _indices[3]
Definition triangle.h:14
Ray::TriangleIndex::operator[]
GLuint & operator[](int idx)
Definition triangle.h:24
Ray::TriangleIndex::TriangleIndex
TriangleIndex(void)
Definition triangle.h:18
Ray::TriangleIndex::TriangleIndex
TriangleIndex(unsigned int i0, unsigned int i1, unsigned int i2)
Definition triangle.h:21
Ray::Vertex
Definition scene.h:203
Util::BoundingBox
Definition geometry.h:345
Util::Point< 3 >
Util::Ray
Definition geometry.h:299
geometry.h
GLuint
unsigned int GLuint
Definition glew.h:280
data
JSAMPIMAGE data
Definition jpeglib.h:945
Ray
Definition box.h:7
polynomial.h
scene.h
shape.h