cone shadows done

This commit is contained in:
2023-02-12 21:27:04 +03:00
parent 728c4a85ed
commit e3389bcc20
11 changed files with 142 additions and 88 deletions

View File

@@ -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);