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
26 _buffer(QOpenGLBuffer::VertexBuffer) {26 _buffer(QOpenGLBuffer::VertexBuffer) {
27}27}
28 28
29MetavoxelSystem::~MetavoxelSystem() {
30 NodeList::getInstance()->removeHook(this);
31}
32
33void MetavoxelSystem::init() {29void MetavoxelSystem::init() {
34 if (!_program.isLinked()) {30 if (!_program.isLinked()) {
35 switchToResourcesParentIfRequired();31 switchToResourcesParentIfRequired();
@@ -39,7 +35,10 @@ void MetavoxelSystem::init() { · 3 unmodified lines
39 _pointScaleLocation = _program.uniformLocation("pointScale");35 _pointScaleLocation = _program.uniformLocation("pointScale");
40 }36 }
41 37
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)));
43 42
44 AttributeRegistry::getInstance()->configureScriptEngine(&_scriptEngine);43 AttributeRegistry::getInstance()->configureScriptEngine(&_scriptEngine);
45 44
@@ -117,14 +116,14 @@ void MetavoxelSystem::render() { · 71 unmodified lines
117 _program.release();116 _program.release();
118}117}
119 118
120void MetavoxelSystem::nodeAdded(Node* node) {119void MetavoxelSystem::nodeAdded(SharedNodePointer node) {
121 if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {120 if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {
122 QMetaObject::invokeMethod(this, "addClient", Q_ARG(const QUuid&, node->getUUID()),121 QMetaObject::invokeMethod(this, "addClient", Q_ARG(const QUuid&, node->getUUID()),
123 Q_ARG(const HifiSockAddr&, node->getLocalSocket()));122 Q_ARG(const HifiSockAddr&, node->getLocalSocket()));
124 }123 }
125}124}
126 125
127void MetavoxelSystem::nodeKilled(Node* node) {126void MetavoxelSystem::nodeKilled(SharedNodePointer node) {
128 if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {127 if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {
129 QMetaObject::invokeMethod(this, "removeClient", Q_ARG(const QUuid&, node->getUUID()));128 QMetaObject::invokeMethod(this, "removeClient", Q_ARG(const QUuid&, node->getUUID()));
130 }129 }