Пример #1
0
LightPropertyWidget::LightPropertyWidget(FloatVec4Property* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
    , noUpdateFromProp_(false)
{
    light_ = new LightWidget(this);
    followCam_ = new QCheckBox(tr("Follow Camera"), this);
    if (BoolMetaData* follow = dynamic_cast<BoolMetaData*>(property_->getMetaDataContainer().getMetaData("FollowCamera")))
        followCam_->setChecked(follow->getValue());
    else
        followCam_->setChecked(false);

    layout_->setDirection(QBoxLayout::TopToBottom);
    layout_->addWidget(light_);
    layout_->addWidget(followCam_);
    connect(light_, SIGNAL(lightWidgetChanged(tgt::vec4)), this, SLOT(changeWidgetLight(tgt::vec4)));

    CameraProperty* camProp = getCamera();
    if(camProp) {
        camProp->onChange(CallMemberAction<LightPropertyWidget>(this, &LightPropertyWidget::cameraUpdate));
        light_->setLightPosition(camProp->get().getViewMatrix().getRotationalPart() * property_->get());
        cameraUpdate();
    }

    addVisibilityControls();
    // we have to add this widget to the property to enable automatic metadata serialization
    property_->addWidget(this);
}
Пример #2
0
LightPropertyWidget::LightPropertyWidget(LightSourceProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
{
    light_ = new LightWidget(this);
    followCam_ = new QCheckBox(tr("Follow Camera"), this);

    layout_->setDirection(QBoxLayout::TopToBottom);
    layout_->addWidget(light_);
    layout_->addWidget(followCam_);
    connect(light_, SIGNAL(lightWidgetChanged(tgt::vec4)), this, SLOT(changeWidgetLight(tgt::vec4)));
    connect(followCam_, SIGNAL(toggled(bool)), this, SLOT(changeFollowCam(bool)));

    updateFromPropertySlot();

    addVisibilityControls();
}
Пример #3
0
LightPropertyWidget::LightPropertyWidget(FloatVec4Property* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
    , hemisphere_(1)
{
    light_ = new LightWidget(this);
    vector_ = tgt::Vector4f::zero;
    layout_->addWidget(light_);
    connect(light_, SIGNAL(lightWidgetChanged(tgt::vec4)), this, SLOT(changeWidgetLight(tgt::vec4)));
    PropertyOwner* propOwner = prop->getOwner();
    if(dynamic_cast<VolumeRaycaster*>(propOwner)) {
        VolumeRaycaster* vol = dynamic_cast<VolumeRaycaster*>(propOwner);
        std::vector<Property*> props = vol->getProperties();
        std::vector<Property*>::iterator it = props.begin();
        while(it != props.end()){
            if(dynamic_cast<CameraProperty*>(*it)) {
                camera_ = (dynamic_cast<CameraProperty*>(*it)->get());
                dynamic_cast<CameraProperty*>(*it)->onChange(CallMemberAction<LightPropertyWidget>(this, &LightPropertyWidget::cameraUpdate));
            }
            ++it;
        }
    }
}