9 #include <ngl/Colour.h>
Material * m_material
Material attached to the Shape object.
void setCenter(ngl::Vec3 _center)
Setter for the center.
virtual ngl::Vec3 getNormalAt(ngl::Vec3 _p)
Calculates what the normal is at a given point of a sphere. It doesn't check whether it is on the sur...
virtual ngl::Colour getColour()
Gets colour of the sphere through its material object.
Class that hold an implicit definition of a sphere through center and radius parameters. It also implements a method for finding intersections.
This will be used to return the colour when queried from the Shape derived classes.
virtual float getIntersection(geo::Ray &_ray)
Calculates the intersection of the passed ray with the sphere according to the parametric form of a r...
void setRadius(float _radius)
Setter for the radius.
virtual ngl::Colour getColour(ngl::Vec3 &_isect)
Gets colour of the sphere through its material object.
float getRadius() const
Returns radius of a sphere.
ngl::Vec3 getCenter() const
Returns center of a sphere.
ngl::Colour m_colour
Colour of the shape.
ngl::Vec3 m_center
Center of the sphere, in world space coordinates.
ngl::Colour m_colour1
Colour of the object.
~Sphere()
Destructor so that all memory is freed.
Sphere()
Sphere constructor, by default it will instanciate a 1 unit radius sphere in the origin (0...
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.
char m_type
Type of geometric object it is.
Sphere(ngl::Vec3 _center, float _radius, ngl::Colour _colour)
Sphere ctor using a radius and a center.
This class handles the implementation of ray: an object with an origin and a direction.
double m_radius
Radius of the sphere.