Assignments Assignments

sphere.h
Go to the documentation of this file.
1#ifndef SPHERE_INCLUDED
2#define SPHERE_INCLUDED
3#include <Util/geometry.h>
4#include <Util/polynomial.h>
5#include "shape.h"
6
7 namespace Ray
8{
10 class Sphere : public Shape
11 {
13 GLuint _vertexBufferID = 0;
14
16 GLuint _elementBufferID = 0;
17
19 int _materialIndex;
20
22 const class Material *_material;
23 public:
25 Util::Point3D center;
27 double radius;
28
30 static std::string Directive( void ){ return "shape_sphere"; }
31
33 Sphere( void );
34
36 // Shape methods //
38 private:
39 void _write( std::ostream &stream ) const;
40 void _read( std::istream &stream );
41 public:
42 std::string name( void ) const { return "sphere"; }
43 void init( const class LocalSceneData &data );
44 void initOpenGL( void );
45 void updateBoundingBox( void );
46 bool processFirstIntersection( const Util::Ray3D &ray , const Util::BoundingBox1D &range , const RayIntersectionFilter &rFilter , const RayIntersectionKernel &rKernel , ShapeProcessingInfo spInfo , unsigned int tIdx ) const;
47 int processAllIntersections( const Util::Ray3D &ray , const Util::BoundingBox1D &range , const RayIntersectionFilter &rFilter , const RayIntersectionKernel &rKernel , ShapeProcessingInfo spInfo , unsigned int tIdx ) const;
48 bool isInside( Util::Point3D p ) const;
49 void drawOpenGL( GLSLProgram * glslProgram ) const;
50 };
51}
52#endif // SPHERE_INCLUDED
53
GLSLProgram
Definition GLSLProgram.h:33
Ray::LocalSceneData
Definition scene.h:62
Ray::Material
Definition scene.h:249
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::Sphere::Directive
static std::string Directive(void)
Definition sphere.h:30
Ray::Sphere::radius
double radius
Definition sphere.h:27
Ray::Sphere::drawOpenGL
void drawOpenGL(GLSLProgram *glslProgram) const
Definition sphere.todo.cpp:77
Ray::Sphere::isInside
bool isInside(Util::Point3D p) const
Definition sphere.todo.cpp:68
Ray::Sphere::_vertexBufferID
GLuint _vertexBufferID
Definition sphere.h:13
Ray::Sphere::center
Util::Point3D center
Definition sphere.h:25
Ray::Sphere::_write
void _write(std::ostream &stream) const
Definition sphere.cpp:19
Ray::Sphere::processFirstIntersection
bool processFirstIntersection(const Util::Ray3D &ray, const Util::BoundingBox1D &range, const RayIntersectionFilter &rFilter, const RayIntersectionKernel &rKernel, ShapeProcessingInfo spInfo, unsigned int tIdx) const
Definition sphere.todo.cpp:44
Ray::Sphere::Sphere
Sphere(void)
Definition sphere.cpp:12
Ray::Sphere::_materialIndex
int _materialIndex
Definition sphere.h:19
Ray::Sphere::processAllIntersections
int processAllIntersections(const Util::Ray3D &ray, const Util::BoundingBox1D &range, const RayIntersectionFilter &rFilter, const RayIntersectionKernel &rKernel, ShapeProcessingInfo spInfo, unsigned int tIdx) const
Definition sphere.todo.cpp:56
Ray::Sphere::_material
const class Material * _material
Definition sphere.h:22
Ray::Sphere::updateBoundingBox
void updateBoundingBox(void)
Definition sphere.todo.cpp:26
Ray::Sphere::_elementBufferID
GLuint _elementBufferID
Definition sphere.h:16
Ray::Sphere::init
void init(const class LocalSceneData &data)
Definition sphere.todo.cpp:13
Ray::Sphere::initOpenGL
void initOpenGL(void)
Definition sphere.todo.cpp:33
Ray::Sphere::name
std::string name(void) const
Definition sphere.h:42
Ray::Sphere::_read
void _read(std::istream &stream)
Definition sphere.cpp:14
geometry.h
GLuint
unsigned int GLuint
Definition glew.h:280
data
JSAMPIMAGE data
Definition jpeglib.h:945
Ray
Definition box.h:7
Util::Point3D
Point< 3 > Point3D
Definition geometry.h:526
Util::BoundingBox1D
BoundingBox< 1 > BoundingBox1D
Definition geometry.h:568
Util::Ray3D
Ray< 3 > Ray3D
Definition geometry.h:562
polynomial.h
shape.h