void QCollisionAspect::sceneNodeRemoved(QSceneChangePtr &e) { QScenePropertyChangePtr propertyChange = e.staticCast<QScenePropertyChange>(); QNodePtr nodePtr = propertyChange->value().value<QNodePtr>(); QNode *n = nodePtr.data(); QAbstractAspect::clearBackendNode(n); }
void RenderMaterial::sceneChangeEvent(const QSceneChangePtr &e) { QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e); switch (e->type()) { case NodeUpdated: { if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) m_enabled = propertyChange->value().toBool(); break; } // Check for shader parameter case NodeAdded: { if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>()); else if (propertyChange->propertyName() == QByteArrayLiteral("effect")) m_effectUuid = propertyChange->value().value<QNodeId>(); break; } case NodeRemoved: { if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>()); else if (propertyChange->propertyName() == QByteArrayLiteral("effect")) m_effectUuid = QNodeId(); break; } default: break; } }
void QCollisionAspect::sceneNodeAdded(QSceneChangePtr &e) { QScenePropertyChangePtr propertyChange = e.staticCast<QScenePropertyChange>(); QNodePtr nodePtr = propertyChange->value().value<QNodePtr>(); QNode *n = nodePtr.data(); QNodeVisitor visitor; visitor.traverse(n, this, &QCollisionAspect::visitNode); }
void RenderScene::sceneChangeEvent(const QSceneChangePtr &e) { QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e); if (propertyChange->propertyName() == QByteArrayLiteral("source")) { m_source = propertyChange->value().toUrl(); m_sceneManager->addSceneData(m_source, peerUuid()); } }
void ClearBuffer::sceneChangeEvent(const QSceneChangePtr &e) { if (e->type() == NodeUpdated) { QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e); if (propertyChange->propertyName() == QByteArrayLiteral("buffers")) m_type = static_cast<QClearBuffer::BufferType>(propertyChange->value().toInt()); else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) setEnabled(propertyChange->value().toBool()); } }
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(); } }
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 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 SortMethod::sceneChangeEvent(const QSceneChangePtr &e) { QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e); if (propertyChange->propertyName() == QByteArrayLiteral("sortCriterion")) { QSortCriterion *c = propertyChange->value().value<QSortCriterion *>(); if (c != Q_NULLPTR) { if (e->type() == NodeAdded) m_criteria.append(c->id()); else if (e->type() == NodeRemoved) m_criteria.removeAll(c->id()); } } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled") && e->type() == NodeUpdated) { setEnabled(propertyChange->value().toBool()); } }
void RenderCameraLens::sceneChangeEvent(const QSceneChangePtr &e) { switch (e->type()) { case NodeUpdated: { QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e); if (propertyChange->propertyName() == QByteArrayLiteral("projectionMatrix")) { QMatrix4x4 projectionMatrix = propertyChange->value().value<QMatrix4x4>(); m_projection = projectionMatrix; } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) { m_enabled = propertyChange->value().toBool(); } } break; default: break; } }
void StateSetNode::sceneChangeEvent(const QSceneChangePtr &e) { QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e); switch (e->type()) { case NodeAdded: { if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) { QNodePtr nodePtr = propertyChange->value().value<QNodePtr>(); QRenderState *renderState = static_cast<QRenderState *>(nodePtr.data()); appendRenderState(renderState->id(), RenderState::getOrCreateBackendState(renderState)); } } break; case NodeRemoved: { if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) removeRenderState(propertyChange->value().value<QNodeId>()); } break; default: break; } }
void RenderEntity::sceneChangeEvent(const QSceneChangePtr &e) { QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e); switch (e->type()) { case ComponentAdded: { QNodePtr nodePtr = propertyChange->value().value<QNodePtr>(); QComponent *component = qobject_cast<QComponent *>(nodePtr.data()); qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "Component Added" << m_objectName << component->objectName(); addComponent(component); break; } case ComponentRemoved: { QNodeId nodeId = propertyChange->value().value<QNodeId>(); qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "Component Removed"; removeComponent(nodeId); break; } default: break; } }
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; } }