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
7namespace Ray
8{
10 class Sphere : public Shape
11 {
13 GLuint _vertexBufferID = 0;
14
16 GLuint _elementBufferID = 0;
17
20
22 const class Material *_material;
23 public:
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
Definition: GLSLProgram.h:33
Definition: scene.h:62
Definition: scene.h:249
Definition: shape.h:89
std::function< bool(double) > RayIntersectionFilter
Definition: shape.h:163
std::function< void(const ShapeProcessingInfo &, const class RayShapeIntersectionInfo &) > RayIntersectionKernel
Definition: shape.h:164
Definition: sphere.h:11
static std::string Directive(void)
Definition: sphere.h:30
double radius
Definition: sphere.h:27
void drawOpenGL(GLSLProgram *glslProgram) const
Definition: sphere.todo.cpp:77
bool isInside(Util::Point3D p) const
Definition: sphere.todo.cpp:68
GLuint _vertexBufferID
Definition: sphere.h:13
Util::Point3D center
Definition: sphere.h:25
void _write(std::ostream &stream) const
Definition: sphere.cpp:19
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
Sphere(void)
Definition: sphere.cpp:12
int _materialIndex
Definition: sphere.h:19
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
const class Material * _material
Definition: sphere.h:22
void updateBoundingBox(void)
Definition: sphere.todo.cpp:26
GLuint _elementBufferID
Definition: sphere.h:16
void init(const class LocalSceneData &data)
Definition: sphere.todo.cpp:13
void initOpenGL(void)
Definition: sphere.todo.cpp:33
std::string name(void) const
Definition: sphere.h:42
void _read(std::istream &stream)
Definition: sphere.cpp:14
Definition: geometry.h:345
Definition: geometry.h:299
Definition: box.h:7