cone shadows done
This commit is contained in:
@@ -223,6 +223,12 @@ void ObjectBase::setVisible(bool v) {
|
||||
}
|
||||
|
||||
|
||||
void ObjectBase::setCastShadows(bool on) {
|
||||
cast_shadow = on;
|
||||
if (type_ == glLight) ((Light *)this)->apply();
|
||||
}
|
||||
|
||||
|
||||
void ObjectBase::rotateZ(GLfloat a) {
|
||||
raw_matrix = false;
|
||||
trans.setRotationZ(trans.rotationZ() + a);
|
||||
@@ -587,23 +593,12 @@ void AimedObject::orbitXY(const float & a) {
|
||||
void AimedObject::transformChanged() {}
|
||||
|
||||
|
||||
Light::Light(): AimedObject(), shadow_map(nullptr, 1, true) {
|
||||
type_ = glLight;
|
||||
light_type = Omni;
|
||||
intensity = 1.;
|
||||
angle_start = angle_end = 180.;
|
||||
decay_linear = decay_quadratic = decay_start = 0.;
|
||||
decay_const = decay_end = 1.;
|
||||
setDirection(0, 0, -1.);
|
||||
}
|
||||
|
||||
|
||||
Light::Light(const QVector3D & p, const QColor & c, float i): AimedObject(), shadow_map(nullptr, 1, true) {
|
||||
Light::Light(const QVector3D & p, const QColor & c, float i): AimedObject(), shadow_map(nullptr, 0, true, GL_R32F) {
|
||||
type_ = glLight;
|
||||
light_type = Omni;
|
||||
intensity = i;
|
||||
color_ = c;
|
||||
angle_start = angle_end = 180.;
|
||||
angle_start = angle_end = 90.;
|
||||
decay_linear = decay_quadratic = decay_start = 0.;
|
||||
decay_const = decay_end = 1.;
|
||||
setPos(p);
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
bool isReceiveShadows() const { return rec_shadow; }
|
||||
bool isCastShadows() const { return cast_shadow; }
|
||||
void setReceiveShadows(bool on) { rec_shadow = on; }
|
||||
void setCastShadows(bool on) { cast_shadow = on; }
|
||||
void setCastShadows(bool on);
|
||||
|
||||
void move(const QVector3D & dv) {
|
||||
trans.setTranslation(pos() + dv);
|
||||
@@ -398,8 +398,7 @@ public:
|
||||
Directional
|
||||
};
|
||||
|
||||
Light();
|
||||
Light(const QVector3D & p, const QColor & c = Qt::white, float i = 1.);
|
||||
Light(const QVector3D & p = QVector3D(), const QColor & c = Qt::white, float i = 1.);
|
||||
virtual ObjectBase * clone(bool withChildren = true);
|
||||
virtual void init() {
|
||||
shadow_map.resize(512, 512);
|
||||
|
||||
Reference in New Issue
Block a user