-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.h
64 lines (52 loc) · 1.57 KB
/
scene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef _Scene_H_
#define _Scene_H_
class Scene;
#include <QtOpenGL/qgl.h>
#include "model.h"
#include "ground.h"
#include "cameraIDI.h"
#include "objectInstance.h"
#include "lights.h"
class Scene
{
friend class XML;
private:
// Això és per a millorar la cerca dels objectes dins del vector.
static int LEAVES;
static int STEM;
static int CASA1;
static int CASA2;
static int CASA3;
static int OBELISC;
static int FAROLA;
bool load;
// Tindrem un vector amb els models geomètrics dels objectes urbans
// bàsics (o primitius) i un altre amb instàncies seves (instàncies o
// referències a objectes).
void computeTransformedBox(ObjectInstance &oref);
void transformPoint(ObjectInstance &oref, GLfloat p[4]);
public:
static MaterialLib matlib; // col·lecció de materials
Ground ground;
std::vector<Model> lmodels;
std::vector<ObjectInstance> lobjectsInstances;
Lights lights;
int id_model_dofi;
Scene();
void Init();
void Render(int id_dofi, bool dibuixa, bool llumglobal, bool llumdofi);
int AddModel(Model &);
int AddObject(ObjectInstance &);
int AddInstance(int modelid, int escala, Point& pos, float orien);
ObjectInstance* getObjectInstance(int id);
Model* getModel(int id);
void computeTransformedBoxes();
void CalculaEsfera (double &radi, Point ¢reEscena);
void updateTransformedBox(ObjectInstance& io);
bool objectIsInGround(ObjectInstance& io);
bool detectCollisions(ObjectInstance& oi);
int detectCollisionsLimits(ObjectInstance& oi);
void InitGround(double sx, double sz);
static void transformPoint(Point &p);
};
#endif