示例#1
0
void ChannelMapper::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    switch (e->type()) {
    case Qt3DCore::PropertyValueAdded: {
        const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("mappings")) {
            m_mappingIds.push_back(change->addedNodeId());
            setDirty(Handler::ChannelMappingsDirty);
            m_isDirty = true;
        }
        break;
    }

    case Qt3DCore::PropertyValueRemoved: {
        const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("mappings")) {
            m_mappingIds.removeOne(change->removedNodeId());
            setDirty(Handler::ChannelMappingsDirty);
            m_isDirty = true;
        }
        break;
    }

    default:
        break;
    }
    QBackendNode::sceneChangeEvent(e);
}
void PhysicsGeometry::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e){
    Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
    QByteArray propertyName = propertyChange->propertyName();
    switch (e->type()) {
    case Qt3DCore::NodeAdded: {
        if (propertyName == QByteArrayLiteral("attribute")) {
            m_attributes.push_back(propertyChange->value().value<Qt3DCore::QNodeId>());
        }
        break;
    }
    case Qt3DCore::NodeRemoved: {
        if (propertyName == QByteArrayLiteral("attribute")) {
            m_attributes.removeOne(propertyChange->value().value<Qt3DCore::QNodeId>());
        }
        break;
    }
    case Qt3DCore::NodeUpdated:
        if (propertyName == QByteArrayLiteral("enabled")){
            m_enabled = propertyChange->value().value<bool>();
        }
        else if (propertyName == QByteArrayLiteral("verticesPerPatch")) {
            m_verticesPerPatch = propertyChange->value().value<int>();
            break;
        }
    default:
        break;
    }
}
示例#3
0
void TextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);

    if (e->type() == NodeUpdated) {
        if (propertyChange->propertyName() == QByteArrayLiteral("layer")) {
            m_layer = propertyChange->value().toInt();
            m_dirty = true;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("mipmapLevel")) {
            m_mipmapLevel = propertyChange->value().toInt();
            m_dirty = true;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("cubeMapFace")) {
            m_face = static_cast<QAbstractTextureProvider::CubeMapFace>(propertyChange->value().toInt());
            m_dirty = true;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("dataFunctor")) {
            m_functor = propertyChange->value().value<QTextureDataFunctorPtr>();
            m_dirty = true;
        }
    }
    if (m_dirty) {// Notify the Texture that we were updated and request it to schedule an update job
        Texture *txt = m_textureManager->data(m_textureProvider);
        if (txt != Q_NULLPTR)
            txt->addToPendingTextureJobs();
    }
}
示例#4
0
/*! \internal */
void QAbstractClipAnimator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
    if (change->type() == Qt3DCore::CallbackTriggered) {
        QAnimationCallbackTriggerPtr callbackTrigger = qSharedPointerCast<Qt3DAnimation::QAnimationCallbackTrigger>(change);
        if (callbackTrigger->callback())
            callbackTrigger->callback()->valueChanged(callbackTrigger->value());
    } else {
        QComponent::sceneChangeEvent(change);
    }
}
示例#5
0
void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);

    if (e->type() == NodeUpdated) {
        if (propertyChange->propertyName() == QByteArrayLiteral("name"))
            m_name = propertyChange->value().toString();
        else if (propertyChange->propertyName() == QByteArrayLiteral("value"))
            m_value = toBackendValue(propertyChange->value());
    }
}
示例#6
0
void AdditiveClipBlend::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    if (e->type() == Qt3DCore::PropertyUpdated) {
        Qt3DCore::QPropertyUpdatedChangePtr change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("additiveFactor"))
            m_additiveFactor = change->value().toFloat();
        else if (change->propertyName() == QByteArrayLiteral("baseClip"))
            m_baseClipId = change->value().value<Qt3DCore::QNodeId>();
        else if (change->propertyName() == QByteArrayLiteral("additiveClip"))
            m_additiveClipId = change->value().value<Qt3DCore::QNodeId>();
    }
}
示例#7
0
void MouseInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    if (e->type() == NodeUpdated) {
        QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
        if (propertyChange->propertyName() == QByteArrayLiteral("controller")) {
            const QNodeId newId = propertyChange->value().value<QNodeId>();
            if (m_mouseController != newId) {
                setController(newId);
            }
        }
    }
}
void PhysicsGeometryRenderer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e){
    switch (e->type()) {
        case Qt3DCore::NodeUpdated: {
            Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
            QByteArray propertyName = propertyChange->propertyName();
            if (propertyName == QByteArrayLiteral("geometryFunctor")){ // Mesh with source
                m_geometry_functor= propertyChange->value().value<Qt3DRender::QGeometryFunctorPtr>();
                m_dirty=true;
            }
            else if (propertyName == QByteArrayLiteral("enabled")){
                m_enabled = propertyChange->value().value<bool>();
            }else if (propertyChange->propertyName() == QByteArrayLiteral("instanceCount")) {
                m_instanceCount = propertyChange->value().value<int>();
                m_dirty = true;
            } else if (propertyName == QByteArrayLiteral("primitiveCount")) {
                m_primitiveCount = propertyChange->value().value<int>();
                m_dirty = true;
            } else if (propertyName == QByteArrayLiteral("baseVertex")) {
                m_baseVertex = propertyChange->value().value<int>();
                m_dirty = true;
            } else if (propertyName == QByteArrayLiteral("baseInstance")) {
                m_baseInstance = propertyChange->value().value<int>();
                m_dirty = true;
            } else if (propertyName == QByteArrayLiteral("restartIndex")) {
                m_restartIndex = propertyChange->value().value<int>();
                m_dirty = true;
            } else if (propertyName == QByteArrayLiteral("primitiveRestart")) {
                m_primitiveRestart = propertyChange->value().value<bool>();
                m_dirty = true;
            }
            break;
    }
    case Qt3DCore::NodeAdded: {
        Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
        if (propertyChange->propertyName() == QByteArrayLiteral("geometry")) {
            m_geometry = propertyChange->value().value<Qt3DCore::QNodeId>();
        }
        break;
    }
    case Qt3DCore::NodeRemoved: {
        Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
        if (propertyChange->propertyName() == QByteArrayLiteral("geometry")) {
            m_geometry = Qt3DCore::QNodeId();
        }
        break;
    }
    default:
        break;
    }
}
示例#9
0
文件: axissetting.cpp 项目: RSATom/Qt
void AxisSetting::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    if (e->type() == Qt3DCore::PropertyUpdated) {
        Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
        if (propertyChange->propertyName() == QByteArrayLiteral("deadZoneRadius")) {
            m_deadZoneRadius = propertyChange->value().toFloat();
        } else if (propertyChange->propertyName() == QByteArrayLiteral("axes")) {
            m_axes = propertyChange->value().value<QVector<int>>();
        } else if (propertyChange->propertyName() == QByteArrayLiteral("smooth")) {
            m_smooth = propertyChange->value().toBool();
        }
    }
    QBackendNode::sceneChangeEvent(e);
}
void PhysicsTransform::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e){
    if (e->type() == Qt3DCore::NodeUpdated) {
            const Qt3DCore::QScenePropertyChangePtr &propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
            if (propertyChange->propertyName() == QByteArrayLiteral("scale3D")) {
                m_scale = propertyChange->value().value<QVector3D>();
                updateMatrix();
            } else if (propertyChange->propertyName() == QByteArrayLiteral("rotation")) {
                m_rotation = propertyChange->value().value<QQuaternion>();
                updateMatrix();
            } else if (propertyChange->propertyName() == QByteArrayLiteral("translation")) {
                m_translation = propertyChange->value().value<QVector3D>();
                updateMatrix();
            }
            else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")){
                m_enabled = propertyChange->value().value<bool>();
                m_dirty = true;
            }
    }
}
示例#11
0
void ClearBuffers::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    if (e->type() == PropertyUpdated) {
        QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
        if (propertyChange->propertyName() == QByteArrayLiteral("buffers")) {
            m_type = static_cast<QClearBuffers::BufferType>(propertyChange->value().toInt());
        } else if (propertyChange->propertyName() == QByteArrayLiteral("clearColor")) {
            m_clearColorAsColor = propertyChange->value().value<QColor>();
            m_clearColor = vec4dFromColor(m_clearColorAsColor);
        } else if (propertyChange->propertyName() == QByteArrayLiteral("clearDepthValue")) {
            m_clearDepthValue = propertyChange->value().toFloat();
        } else if (propertyChange->propertyName() == QByteArrayLiteral("clearStencilValue")) {
            m_clearStencilValue = propertyChange->value().toInt();
        } else if (propertyChange->propertyName() == QByteArrayLiteral("colorBuffer")) {
            m_colorBufferId = propertyChange->value().value<QNodeId>();
        }
        markDirty(AbstractRenderer::AllDirty);
    }
    FrameGraphNode::sceneChangeEvent(e);
}
示例#12
0
void Geometry::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
    QByteArray propertyName = propertyChange->propertyName();

    switch (e->type()) {
    case NodeAdded: {
        if (propertyName == QByteArrayLiteral("attribute")) {
            m_attributes.push_back(propertyChange->value().value<QNodeId>());
            m_geometryDirty = true;
        }
        break;
    }

    case NodeRemoved: {
        if (propertyName == QByteArrayLiteral("attribute")) {
            m_attributes.removeOne(propertyChange->value().value<QNodeId>());
            m_geometryDirty = true;
        }
        break;
    }

    case NodeUpdated:
        if (propertyName == QByteArrayLiteral("verticesPerPatch")) {
            m_verticesPerPatch = propertyChange->value().value<int>();
            break;

            // Note: doesn't set dirtyness as this parameter changing doesn't need
            // a new VAO update.
        } else if (propertyName == QByteArrayLiteral("boundingVolumeSpecifierPositionAttribute")) {
            m_boundingPositionAttribute = propertyChange->value().value<Qt3DCore::QNodeId>();
            break;
        }

    default:
        break;
    }
}
示例#13
0
void AnimationClip::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    switch (e->type()) {
    case Qt3DCore::PropertyUpdated: {
        const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("source")) {
            Q_ASSERT(m_dataType == File);
            m_source = change->value().toUrl();
            setDirty(Handler::AnimationClipDirty);
        } else if (change->propertyName() == QByteArrayLiteral("clipData")) {
            Q_ASSERT(m_dataType == Data);
            m_clipData = change->value().value<Qt3DAnimation::QAnimationClipData>();
            if (m_clipData.isValid())
                setDirty(Handler::AnimationClipDirty);
        }
        break;
    }

    default:
        break;
    }
    QBackendNode::sceneChangeEvent(e);
}
示例#14
0
void InputSequence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    switch (e->type()) {
    case Qt3DCore::PropertyUpdated: {
        const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("timeout")) {
            m_timeout = milliToNano(change->value().toInt());
        } else if (change->propertyName() == QByteArrayLiteral("buttonInterval")) {
            m_buttonInterval = milliToNano(change->value().toInt());
        }
        break;
    }

    case Qt3DCore::PropertyValueAdded: {
        const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("sequence")) {
            m_sequences.push_back(change->addedNodeId());
            m_inputsToTrigger.push_back(change->addedNodeId());
        }
        break;
    }

    case Qt3DCore::PropertyValueRemoved: {
        const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("sequence")) {
            m_sequences.removeOne(change->removedNodeId());
            m_inputsToTrigger.removeOne(change->removedNodeId());
        }
        break;
    }

    default:
        break;
    }
    AbstractActionInput::sceneChangeEvent(e);
}
示例#15
0
文件: shaderdata.cpp 项目: RSATom/Qt
void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    if (!m_propertyReader.isNull() && e->type() == PropertyUpdated) {
        QString propertyName;
        QVariant propertyValue;

        if (auto propertyChange = qSharedPointerDynamicCast<QPropertyUpdatedChange>(e)) {
            propertyName = QString::fromLatin1(propertyChange->propertyName());
            propertyValue =  m_propertyReader->readProperty(propertyChange->value());
        } else if (auto propertyChange = qSharedPointerDynamicCast<QDynamicPropertyUpdatedChange>(e)) {
            propertyName = QString::fromLatin1(propertyChange->propertyName());
            propertyValue = m_propertyReader->readProperty(propertyChange->value());
        } else {
            Q_UNREACHABLE();
        }

        // Note we aren't notified about nested QShaderData in this call
        // only scalar / vec properties
        m_originalProperties.insert(propertyName, propertyValue);
        BackendNode::markDirty(AbstractRenderer::AllDirty);
    }

    BackendNode::sceneChangeEvent(e);
}
示例#16
0
文件: texture.cpp 项目: RSATom/Qt
// ChangeArbiter/Aspect Thread
void Texture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
    DirtyFlags dirty;

    switch (e->type()) {
    case PropertyUpdated: {
        QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
        if (propertyChange->propertyName() == QByteArrayLiteral("width")) {
            m_properties.width = propertyChange->value().toInt();
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("height")) {
            m_properties.height = propertyChange->value().toInt();
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("depth")) {
            m_properties.depth = propertyChange->value().toInt();
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("maximumLayers")) {
            m_properties.layers = propertyChange->value().toInt();
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("format")) {
            m_properties.format = static_cast<QAbstractTexture::TextureFormat>(propertyChange->value().toInt());
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("target")) {
            m_properties.target = static_cast<QAbstractTexture::Target>(propertyChange->value().toInt());
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("mipmaps")) {
            m_properties.generateMipMaps = propertyChange->value().toBool();
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("minificationFilter")) {
            m_parameters.minificationFilter = static_cast<QAbstractTexture::Filter>(propertyChange->value().toInt());
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("magnificationFilter")) {
            m_parameters.magnificationFilter = static_cast<QAbstractTexture::Filter>(propertyChange->value().toInt());
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("wrapModeX")) {
            m_parameters.wrapModeX = static_cast<QTextureWrapMode::WrapMode>(propertyChange->value().toInt());
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("wrapModeY")) {
            m_parameters.wrapModeY = static_cast<QTextureWrapMode::WrapMode>(propertyChange->value().toInt());
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("wrapModeZ")) {
            m_parameters.wrapModeZ =static_cast<QTextureWrapMode::WrapMode>(propertyChange->value().toInt());
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("maximumAnisotropy")) {
            m_parameters.maximumAnisotropy = propertyChange->value().toFloat();
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("comparisonFunction")) {
            m_parameters.comparisonFunction = propertyChange->value().value<QAbstractTexture::ComparisonFunction>();
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("comparisonMode")) {
            m_parameters.comparisonMode = propertyChange->value().value<QAbstractTexture::ComparisonMode>();
            dirty = DirtyParameters;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("layers")) {
            m_properties.layers = propertyChange->value().toInt();
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("samples")) {
            m_properties.samples = propertyChange->value().toInt();
            dirty = DirtyProperties;
        } else if (propertyChange->propertyName() == QByteArrayLiteral("generator")) {
            m_dataFunctor = propertyChange->value().value<QTextureGeneratorPtr>();
            dirty = DirtyDataGenerator;
        }
    }
        break;

    case PropertyValueAdded: {
        const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("textureImage")) {
            addTextureImage(change->addedNodeId());
        }
    }
        break;

    case PropertyValueRemoved: {
        const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
        if (change->propertyName() == QByteArrayLiteral("textureImage")) {
            removeTextureImage(change->removedNodeId());
        }
    }
        break;

    default:
        break;

    }

    addDirtyFlag(dirty);

    markDirty(AbstractRenderer::TexturesDirty);
    BackendNode::sceneChangeEvent(e);
}