-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsceneobject.cpp
More file actions
42 lines (34 loc) · 966 Bytes
/
sceneobject.cpp
File metadata and controls
42 lines (34 loc) · 966 Bytes
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
#include "sceneobject.h"
#include "scenetexture.h"
sceneObject::sceneObject(QObject *parent) :
QObject(parent)
{
}
sceneObject::~sceneObject()
{
if (this->texture != NULL) delete this->texture;
}
sceneObject * sceneObject::copy() {
return new sceneObject();
}
QColor sceneObject::getTexture(float t, bool lighting){
// something has gone wrong!
if (this->texture == NULL) {
return QColor(0,0,0);
}
// get the QColor from the texture, then apply the lighting condition if required
QColor tempC = this->texture->getColour(this->lastHit, t);
if (lighting) {
tempC.setHsvF(tempC.hueF(), tempC.saturationF(), tempC.valueF()*this->light);
}
return tempC;
}
void sceneObject::debugPrint() {
qDebug() << "Object " << name;
qDebug() << "Loc = " << location;
qDebug() << "Rot = " << rotation;
qDebug() << "Scl = " << scaling;
if (this->texture != NULL) {
this->texture->dbgPrint();
}
}