Phongo Clap RT
1.0
Simple Raytracing Renderer
|
Inherits from shape. Implements functionability for plane shape and its materials. and the ray-plane intersections algorithms. More...
#include <Plane.h>
Public Member Functions | |
Plane () | |
Default constructor for the plane. If no arguments passed it will be initialised with distance(5) n(1,1,1) More... | |
~Plane () | |
Default destructor. More... | |
Plane (float _distance, ngl::Vec3 _n, ngl::Colour _c) | |
This constructor reads some arguments and pass them to the private interface. More... | |
Plane (float _distance, ngl::Vec3 _n, ngl::Colour _c1, ngl::Colour _c2) | |
This constructor reads some arguments and pass them to the private interface. For checkerboard planes. More... | |
virtual float | getIntersection (geo::Ray &_ray) |
Virtual method that implements the ray-plane intersection. More... | |
virtual ngl::Vec3 | getNormalAt (ngl::Vec3 _p) |
Simple getter that returns the normal of the plane. More... | |
virtual ngl::Colour | getColour () |
Returns the colour for plain objects, in other words for non-checkerboard planes. More... | |
virtual ngl::Colour | getColour (ngl::Vec3 &_isect) |
Returns the colour for checker-board planes. This will imply passing an intersection point in world space so that we can make the right calculations to see whether we must return the colour1 or colour2. More... | |
![]() | |
Shape () | |
Default constructor. More... | |
~Shape () | |
Frees any memory grabbed from the heap. 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... | |
Material * | getMaterial () |
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... | |
Private Attributes | |
float | m_distance |
Distance from the origin the plane is located at. More... | |
ngl::Vec3 | m_n |
Normal of the plane. More... | |
Additional Inherited Members | |
![]() | |
char | m_type |
Type of geometric object it is. More... | |
ngl::Colour | m_colour |
Colour of the shape. More... | |
Material * | m_material |
Material attached to the Shape object. More... | |
Inherits from shape. Implements functionability for plane shape and its materials. and the ray-plane intersections algorithms.
geo::Plane::Plane | ( | ) |
Default constructor for the plane. If no arguments passed it will be initialised with distance(5) n(1,1,1)
Definition at line 11 of file Plane.cpp.
References geo::Shape::m_colour, geo::Shape::m_material, and geo::Shape::m_type.
geo::Plane::~Plane | ( | ) |
Default destructor.
geo::Plane::Plane | ( | float | _distance, |
ngl::Vec3 | _n, | ||
ngl::Colour | _c | ||
) |
This constructor reads some arguments and pass them to the private interface.
[in] | _distance | Distance from the origin the plane is located at. |
[in] | _n | Normal of the plane. |
[in] | _c | Plain colour of the plane. |
Definition at line 19 of file Plane.cpp.
References geo::Shape::m_colour, m_distance, geo::Shape::m_material, m_n, and geo::Shape::m_type.
geo::Plane::Plane | ( | float | _distance, |
ngl::Vec3 | _n, | ||
ngl::Colour | _c1, | ||
ngl::Colour | _c2 | ||
) |
This constructor reads some arguments and pass them to the private interface. For checkerboard planes.
[in] | _distance | Distance from the origin the plane is located at. |
[in] | _n | Primary colour of the checkerboard. |
[in] | _c1 | Secondary colour of the checkerboard. |
Definition at line 39 of file Plane.cpp.
References geo::Shape::m_colour, m_distance, geo::Shape::m_material, m_n, and geo::Shape::m_type.
|
virtual |
Returns the colour for plain objects, in other words for non-checkerboard planes.
Implements geo::Shape.
Definition at line 82 of file Plane.cpp.
References geo::Shape::m_material, and Material::objColour().
|
virtual |
Returns the colour for checker-board planes. This will imply passing an intersection point in world space so that we can make the right calculations to see whether we must return the colour1 or colour2.
[in] | _isect | Position in world space of the intersecting point. |
Implements geo::Shape.
Definition at line 87 of file Plane.cpp.
References Material::m_isChecker, geo::Shape::m_material, and Material::objColour().
|
virtual |
Virtual method that implements the ray-plane intersection.
[in] | _ray | Ray that will be used to solve the equation for finding the "t" parameter of the ray that satisfies that this point is shared by both ray and plane aka intersection point. |
R = O + t * d
equation form of the line, thus the intersection point. Implements geo::Shape.
Definition at line 59 of file Plane.cpp.
References geo::Ray::getDirection(), geo::Ray::getOrigin(), m_distance, and m_n.
|
virtual |
Simple getter that returns the normal of the plane.
Implements geo::Shape.
Definition at line 77 of file Plane.cpp.
References m_n.
|
private |