INFO804 Introduction à l'informatique graphique
Loading...
Searching...
No Matches
GraphicalObject.h
Go to the documentation of this file.
1/**
2@file GraphicalObject.h
3@author JOL
4*/
5#pragma once
6#ifndef _GRAPHICAL_OBJECT_H_
7#define _GRAPHICAL_OBJECT_H_
8
9// In order to call opengl commands in all graphical objects
10#include "Viewer.h"
11#include "PointVector.h"
12#include "Material.h"
13#include "Ray.h"
14
15/// Namespace RayTracer
16namespace rt {
17
18 /// This is an interface specifying methods that any graphical
19 /// object should have. It is also drawable to be seen in QGLViewer
20 /// window.
21 /// Concrete exemples of a GraphicalObject include spheres.
23
24 /// Default constructor. Nothing to do.
26
27 /// Virtual destructor since object contains virtual methods.
28 virtual ~GraphicalObject() {}
29
30 /// This method is called by Scene::init() at the beginning of the
31 /// display in the OpenGL window. May be useful for some
32 /// precomputations.
33 virtual void init( Viewer& /* viewer */ ) = 0;
34
35 /// This method is called by Scene::draw() at each frame to
36 /// redisplay objects in the OpenGL window.
37 virtual void draw( Viewer& /* viewer */ ) = 0;
38
39 /// @return the normal vector at point \a p on the object (\a p
40 /// should be on or close to the sphere).
41 virtual Vector3 getNormal( Point3 p ) = 0;
42
43 /// @return the material associated to this part of the object
44 virtual Material getMaterial( Point3 p ) = 0;
45
46 /// @param[in] ray the incoming ray
47 /// @param[out] returns the point of intersection with the object
48 /// (if any), or the closest point to it.
49 ///
50 /// @return either a real < 0.0 if there is an intersection, or a
51 /// kind of distance to the closest point of intersection.
52 virtual Real rayIntersection( const Ray& ray, Point3& p ) = 0;
53
54
55 };
56
57} // namespace rt
58
59#endif // #define _GRAPHICAL_OBJECT_H_
Namespace RayTracer.
Definition Color.h:11
float Real
the type for representing a real number.
virtual Real rayIntersection(const Ray &ray, Point3 &p)=0
virtual Material getMaterial(Point3 p)=0
virtual ~GraphicalObject()
Virtual destructor since object contains virtual methods.
virtual void init(Viewer &)=0
virtual Vector3 getNormal(Point3 p)=0
virtual void draw(Viewer &)=0
GraphicalObject()
Default constructor. Nothing to do.
Definition Ray.h:18