INFO804 Introduction à l'informatique graphique
Loading...
Searching...
No Matches
Viewer.h
Go to the documentation of this file.
1/**
2@file Viewer.h
3*/
4#pragma once
5
6#ifndef _VIEWER_H_
7#define _VIEWER_H_
8
9#include <vector>
10#include <QKeyEvent>
11#include <QGLViewer/qglviewer.h>
12
13namespace rt {
14
15 /// Forward declaration of class Scene
16 struct Scene;
17
18 /// This class displays the interface for placing the camera and the
19 /// lights, and the user may call the renderer from it.
20 class Viewer : public QGLViewer
21 {
22 public:
23 /// Default constructor. Scene is empty.
24 Viewer() : QGLViewer(), ptrScene( 0 ), maxDepth( 6 ) {}
25
26 /// Sets the scene
27 void setScene( rt::Scene& aScene )
28 {
29 ptrScene = &aScene;
30 }
31
32 /// To call the protected method `drawLight`.
33 void drawSomeLight( GLenum light ) const
34 {
35 drawLight( light );
36 }
37 /// To call the protected method `drawLight`.
38 void drawSomeLight( GLenum light, float zoom ) const
39 {
40 drawLight( light, zoom );
41 }
42
43 protected :
44 /// Called at each draw of the window
45 virtual void draw();
46 /// Called before the first draw
47 virtual void init();
48 /// Called when pressing help.
49 virtual QString helpString() const;
50 /// Celled when pressing a key.
51 virtual void keyPressEvent(QKeyEvent *e);
52
53 /// Stores the scene
55
56 /// Maximum depth
58 };
59}
60
61#endif
virtual void keyPressEvent(QKeyEvent *e)
Celled when pressing a key.
Definition Viewer.cpp:56
virtual void init()
Called before the first draw.
Definition Viewer.cpp:28
Viewer()
Default constructor. Scene is empty.
Definition Viewer.h:24
void drawSomeLight(GLenum light, float zoom) const
To call the protected method drawLight.
Definition Viewer.h:38
void drawSomeLight(GLenum light) const
To call the protected method drawLight.
Definition Viewer.h:33
virtual void draw()
Called at each draw of the window.
Definition Viewer.cpp:16
int maxDepth
Maximum depth.
Definition Viewer.h:57
virtual QString helpString() const
Called when pressing help.
Definition Viewer.cpp:100
void setScene(rt::Scene &aScene)
Sets the scene.
Definition Viewer.h:27
rt::Scene * ptrScene
Stores the scene.
Definition Viewer.h:54
Namespace RayTracer.
Definition Color.h:11