Assignments
Assignments
Ray::Shape Class Referenceabstract

#include <shape.h>

Inheritance diagram for Ray::Shape:
Ray::AffineShape Ray::Box Ray::Cone Ray::Cylinder Ray::Difference Ray::FileInstance Ray::Intersection Ray::SceneGeometry Ray::ShapeList Ray::Sphere Ray::Torus Ray::Triangle Ray::Union

Classes

struct  ShapeProcessingInfo
 

Public Types

typedef std::function< ShapeProcessingInfo::ProcessingType(const ShapeProcessingInfo &, const Shape &) > Filter
 
typedef std::function< void(const ShapeProcessingInfo &, const Shape &) > Kernel
 
typedef std::function< bool(double) > RayIntersectionFilter
 
typedef std::function< void(const ShapeProcessingInfo &, const class RayShapeIntersectionInfo &) > RayIntersectionKernel
 

Public Member Functions

virtual ~Shape (void)
 
ShapeBoundingBox boundingBox (void) const
 
virtual void init (const class LocalSceneData &data)=0
 
virtual void initOpenGL (void)=0
 
virtual void updateBoundingBox (void)=0
 
virtual std::string name (void) const =0
 
virtual bool isInside (Util::Point3D p) const =0
 
virtual void drawOpenGL (GLSLProgram *glslProgram) const =0
 
virtual void addTrianglesOpenGL (std::vector< class TriangleIndex > &triangles)
 
size_t primitiveNum (void) const
 
virtual void processOverlapping (const Filter &filter, const Kernel &kernel, ShapeProcessingInfo spInfo) const
 
virtual bool processFirstIntersection (const Util::Ray3D &ray, const Util::BoundingBox1D &range, const RayIntersectionFilter &rFilter, const RayIntersectionKernel &rKernel, ShapeProcessingInfo spInfo, unsigned int tIdx) const =0
 
virtual int processAllIntersections (const Util::Ray3D &ray, const Util::BoundingBox1D &range, const RayIntersectionFilter &rFilter, const RayIntersectionKernel &rKernel, ShapeProcessingInfo spInfo, unsigned int tIdx) const =0
 

Static Public Member Functions

static void WriteInset (std::ostream &stream)
 

Static Public Attributes

static unsigned int OpenGLTessellationComplexity
 
static unsigned int WriteInsetSize = 0
 

Protected Attributes

ShapeBoundingBox _bBox
 
size_t _primitiveNum
 

Private Member Functions

virtual void _write (std::ostream &stream) const =0
 
virtual void _read (std::istream &stream)=0
 

Detailed Description

This is the abstract class that all ray-traceable objects must implement.

Member Typedef Documentation

◆ Filter

typedef std::function< ShapeProcessingInfo::ProcessingType ( const ShapeProcessingInfo & , const Shape & ) > Ray::Shape::Filter

◆ Kernel

typedef std::function< void ( const ShapeProcessingInfo & , const Shape & ) > Ray::Shape::Kernel

◆ RayIntersectionFilter

typedef std::function< bool ( double ) > Ray::Shape::RayIntersectionFilter

◆ RayIntersectionKernel

typedef std::function< void ( const ShapeProcessingInfo & , const class RayShapeIntersectionInfo & ) > Ray::Shape::RayIntersectionKernel

Constructor & Destructor Documentation

◆ ~Shape()

virtual Ray::Shape::~Shape ( void  )
inlinevirtual

The destructor

Member Function Documentation

◆ _read()

virtual void Ray::Shape::_read ( std::istream &  stream)
privatepure virtual

◆ _write()

virtual void Ray::Shape::_write ( std::ostream &  stream) const
privatepure virtual

◆ addTrianglesOpenGL()

virtual void Ray::Shape::addTrianglesOpenGL ( std::vector< class TriangleIndex > &  triangles)
inlinevirtual

This method adds a triangle to the list of triangles (if the object is of type RayTriangle).

Reimplemented in Ray::ShapeList, and Ray::Triangle.

◆ boundingBox()

ShapeBoundingBox Shape::boundingBox ( void  ) const

The method returns the bounding box of the shape

◆ drawOpenGL()

virtual void Ray::Shape::drawOpenGL ( GLSLProgram glslProgram) const
pure virtual

◆ init()

virtual void Ray::Shape::init ( const class LocalSceneData data)
pure virtual

◆ initOpenGL()

virtual void Ray::Shape::initOpenGL ( void  )
pure virtual

◆ isInside()

virtual bool Ray::Shape::isInside ( Util::Point3D  p) const
pure virtual

This method determines if a point is inside a shape. It is assumed that if the shape is not water-tight, the method returns false.

Implemented in Ray::Box, Ray::Cone, Ray::Cylinder, Ray::FileInstance, Ray::SceneGeometry, Ray::AffineShape, Ray::Difference, Ray::ShapeList, Ray::Union, Ray::Intersection, Ray::Sphere, Ray::Torus, and Ray::Triangle.

◆ name()

virtual std::string Ray::Shape::name ( void  ) const
pure virtual

◆ primitiveNum()

size_t Shape::primitiveNum ( void  ) const

This method returns the count of basic shapes contained within the Shape.

◆ processAllIntersections()

virtual int Ray::Shape::processAllIntersections ( const Util::Ray3D ray,
const Util::BoundingBox1D range,
const RayIntersectionFilter rFilter,
const RayIntersectionKernel rKernel,
ShapeProcessingInfo  spInfo,
unsigned int  tIdx 
) const
pure virtual

This method processes all shapes which intersect the ray within the prescribed range and passing the rFilter test, invoking the rKernel kernel with the intersection information. The processing terminates early if the kernel returns false. The function returns the number of valid intersections.

Implemented in Ray::Box, Ray::Cone, Ray::Cylinder, Ray::FileInstance, Ray::SceneGeometry, Ray::Scene, Ray::AffineShape, Ray::Difference, Ray::ShapeList, Ray::TriangleList, Ray::Union, Ray::Intersection, Ray::Sphere, Ray::Torus, and Ray::Triangle.

◆ processFirstIntersection()

virtual bool Ray::Shape::processFirstIntersection ( const Util::Ray3D ray,
const Util::BoundingBox1D range,
const RayIntersectionFilter rFilter,
const RayIntersectionKernel rKernel,
ShapeProcessingInfo  spInfo,
unsigned int  tIdx 
) const
pure virtual

This method processes the first shape which intersect the ray within the prescribed range and passing the rFilter test, invoking the rKernel kernel with the intersection information. The function returns true if there was an intersection.

Implemented in Ray::Box, Ray::Cone, Ray::Cylinder, Ray::FileInstance, Ray::SceneGeometry, Ray::Scene, Ray::AffineShape, Ray::Difference, Ray::ShapeList, Ray::TriangleList, Ray::Union, Ray::Intersection, Ray::Sphere, Ray::Torus, and Ray::Triangle.

◆ processOverlapping()

void Shape::processOverlapping ( const Filter filter,
const Kernel kernel,
ShapeProcessingInfo  spInfo 
) const
virtual

This method process Shapes by calling the "kernel" function on every shape whose bounding box passes the "filter" test. The tInfo parameter stores the accumulation of transformations encountered when traversing the scene-graph. Note that the bounding box is in the coordinate frame of the node.

Reimplemented in Ray::FileInstance, Ray::SceneGeometry, Ray::AffineShape, Ray::ShapeList, and Ray::TriangleList.

◆ updateBoundingBox()

virtual void Ray::Shape::updateBoundingBox ( void  )
pure virtual

This method should be called to update the bounding boxes in the scene

Implemented in Ray::Box, Ray::Cone, Ray::Cylinder, Ray::FileInstance, Ray::SceneGeometry, Ray::AffineShape, Ray::Difference, Ray::ShapeList, Ray::Union, Ray::Intersection, Ray::Sphere, Ray::Torus, and Ray::Triangle.

◆ WriteInset()

void Shape::WriteInset ( std::ostream &  stream)
static

This static method insets for writing.

Member Data Documentation

◆ _bBox

ShapeBoundingBox Ray::Shape::_bBox
protected

This member represents the bounding box of the shape.

◆ _primitiveNum

size_t Ray::Shape::_primitiveNum
protected

This member represents the number of primitives describing the shape.

◆ OpenGLTessellationComplexity

unsigned int Shape::OpenGLTessellationComplexity
static

A global variable representing how finely shapes should be tessellated for rendering as triangle meshes.

◆ WriteInsetSize

unsigned int Shape::WriteInsetSize = 0
static

A global variable representing how inset the next shape should be when writing to a stream.


The documentation for this class was generated from the following files: