History

change NodeList container to QHash with QSharedPointer

Stephen Birarda committed 12 years ago

Commit 7d1a64c1 parent 0e25c8535 files · +355 −737Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 35 files). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+6−7
@@ -26,10 +26,6 @@ MetavoxelSystem::MetavoxelSystem() : · 25 unmodified lines
2626 _buffer(QOpenGLBuffer::VertexBuffer) {
2727 }
2828
29−MetavoxelSystem::~MetavoxelSystem() {
30− NodeList::getInstance()->removeHook(this);
31−}
32−
3329 void MetavoxelSystem::init() {
3430 if (!_program.isLinked()) {
3531 switchToResourcesParentIfRequired();
@@ -39,7 +35,10 @@ void MetavoxelSystem::init() { · 3 unmodified lines
3935 _pointScaleLocation = _program.uniformLocation("pointScale");
4036 }
4137
42− NodeList::getInstance()->addHook(this);
38+ NodeList* nodeList = NodeList::getInstance();
39+
40+ connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), SLOT(nodeAdded(SharedNodePointer)));
41+ connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
4342
4443 AttributeRegistry::getInstance()->configureScriptEngine(&_scriptEngine);
4544
@@ -117,14 +116,14 @@ void MetavoxelSystem::render() { · 71 unmodified lines
117116 _program.release();
118117 }
119118
120−void MetavoxelSystem::nodeAdded(Node* node) {
119+void MetavoxelSystem::nodeAdded(SharedNodePointer node) {
121120 if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {
122121 QMetaObject::invokeMethod(this, "addClient", Q_ARG(const QUuid&, node->getUUID()),
123122 Q_ARG(const HifiSockAddr&, node->getLocalSocket()));
124123 }
125124 }
126125
127−void MetavoxelSystem::nodeKilled(Node* node) {
126+void MetavoxelSystem::nodeKilled(SharedNodePointer node) {
128127 if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {
129128 QMetaObject::invokeMethod(this, "removeClient", Q_ARG(const QUuid&, node->getUUID()));
130129 }