Phongo Clap RT  1.0
Simple Raytracing Renderer
Public Member Functions | Protected Attributes | List of all members
geo::Shape Class Referenceabstract

Semi abstract class with virtual methods that holds all the calls for getting intersections, getting normals, also for specifying the properties of the material that will be hold by the Material member of this class. More...

#include <Shape.h>

Inheritance diagram for geo::Shape:
Inheritance graph
Collaboration diagram for geo::Shape:
Collaboration graph

Public Member Functions

 Shape ()
 Default constructor. More...
 
 ~Shape ()
 Frees any memory grabbed from the heap. More...
 
virtual ngl::Colour getColour ()=0
 Returs colour of a Shape object. More...
 
virtual ngl::Colour getColour (ngl::Vec3 &_isect)=0
 Returns colour depending on intersection point. More...
 
virtual float getIntersection (geo::Ray &_ray)=0
 Passing a ray it will calculate the intersection in the derived class, this is purely abstract method. More...
 
virtual ngl::Vec3 getNormalAt (ngl::Vec3 _p)=0
 Returns the normal at a given point. More...
 
void hasRefraction (float _ior, float _transparency, float _diffuse_intensity)
 Sets parameters related to refraction, this will be given to the Material class. More...
 
void hasReflection (float _refl_intensity, float _diffuse_intensity)
 Sets reflection attributes. More...
 
MaterialgetMaterial ()
 Returns the material attached to a shape object. This is useful for querying or changing private interface, that's why it is not const. More...
 
char getType ()
 Derived classes will be Spheres or Planes, I will store the type of geometry in this attribute. More...
 

Protected Attributes

char m_type
 Type of geometric object it is. More...
 
ngl::Colour m_colour
 Colour of the shape. More...
 
Materialm_material
 Material attached to the Shape object. More...
 

Detailed Description

Semi abstract class with virtual methods that holds all the calls for getting intersections, getting normals, also for specifying the properties of the material that will be hold by the Material member of this class.

Author
Ramon Blanquer

Definition at line 21 of file Shape.h.

Constructor & Destructor Documentation

geo::Shape::Shape ( )
inline

Default constructor.

Definition at line 27 of file Shape.h.

27 {}
geo::Shape::~Shape ( )
inline

Frees any memory grabbed from the heap.

Definition at line 31 of file Shape.h.

References m_material.

31 {delete m_material;}
Material * m_material
Material attached to the Shape object.
Definition: Shape.h:96

Member Function Documentation

virtual ngl::Colour geo::Shape::getColour ( )
pure virtual

Returs colour of a Shape object.

Returns
Colour of the Shape object

Implemented in geo::Sphere, and geo::Plane.

virtual ngl::Colour geo::Shape::getColour ( ngl::Vec3 &  _isect)
pure virtual

Returns colour depending on intersection point.

Returns
Colour of a Shape object

Implemented in geo::Sphere, and geo::Plane.

virtual float geo::Shape::getIntersection ( geo::Ray _ray)
pure virtual

Passing a ray it will calculate the intersection in the derived class, this is purely abstract method.

Returns
Variable (mathematically speaking) **'t'** in equation R = O + t * d.

Implemented in geo::Sphere, and geo::Plane.

Material* geo::Shape::getMaterial ( )
inline

Returns the material attached to a shape object. This is useful for querying or changing private interface, that's why it is not const.

Returns
The object associated with a Shape instance.

Definition at line 77 of file Shape.h.

References m_material.

77 {return m_material;}
Material * m_material
Material attached to the Shape object.
Definition: Shape.h:96
virtual ngl::Vec3 geo::Shape::getNormalAt ( ngl::Vec3  _p)
pure virtual

Returns the normal at a given point.

Returns
Normal

Implemented in geo::Sphere, and geo::Plane.

char geo::Shape::getType ( )
inline

Derived classes will be Spheres or Planes, I will store the type of geometry in this attribute.

Returns
Whether it is a sphere or a plane, this will be expanded to other geometry in the future.

Definition at line 82 of file Shape.h.

References m_type.

82 {return m_type;}
char m_type
Type of geometric object it is.
Definition: Shape.h:88
void geo::Shape::hasReflection ( float  _refl_intensity,
float  _diffuse_intensity 
)
inline

Sets reflection attributes.

Parameters
[in]_refl_intensityHow reflective the material is.
[in]_diffuse_intensityHow non-reflective the material is.

Definition at line 68 of file Shape.h.

References m_material, and Material::setReflection().

69  {
70  m_material->setReflection(_refl_intensity, _diffuse_intensity);
71  }
Material * m_material
Material attached to the Shape object.
Definition: Shape.h:96
void setReflection(float _refl_intensity, float _diffuse_intensity)
Sets the reflection parameters.
Definition: Material.cpp:37

Here is the call graph for this function:

void geo::Shape::hasRefraction ( float  _ior,
float  _transparency,
float  _diffuse_intensity 
)
inline

Sets parameters related to refraction, this will be given to the Material class.

Parameters
[in]_iorIndex of refraction.
[in]_transparencyAmount of refraction of the object.
[in]_diffuse_intensity This is calculated automatically, but it is the complementary of transparency, I could say this is the 'opacity'.

Definition at line 59 of file Shape.h.

References m_material, and Material::setRefraction().

60  {
61  m_material->setRefraction(_ior,_transparency, _diffuse_intensity);
62  }
Material * m_material
Material attached to the Shape object.
Definition: Shape.h:96
void setRefraction(float _ior, float _transparency, float _diffuse_intensity)
Sets the refraction settings.
Definition: Material.cpp:44

Here is the call graph for this function:

Member Data Documentation

ngl::Colour geo::Shape::m_colour
protected

Colour of the shape.

Definition at line 92 of file Shape.h.

Material* geo::Shape::m_material
protected

Material attached to the Shape object.

Definition at line 96 of file Shape.h.

char geo::Shape::m_type
protected

Type of geometric object it is.

Definition at line 88 of file Shape.h.


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