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; } }
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(); } }
/*! \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); } }
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()); } }
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>(); } }
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; } }
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; } } }
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); }
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; } }
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); }
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); }
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); }
// 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); }