int VertexTreeWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: redraw(); break; case 1: updateMesh(); break; case 2: addEdgeBetweenFaces((*reinterpret_cast< Vertex*(*)>(_a[1]))); break; case 3: sendX((*reinterpret_cast< double(*)>(_a[1]))); break; case 4: sendY((*reinterpret_cast< double(*)>(_a[1]))); break; case 5: sendZ((*reinterpret_cast< double(*)>(_a[1]))); break; case 6: enableXYZ((*reinterpret_cast< bool(*)>(_a[1]))); break; case 7: enableRGB((*reinterpret_cast< bool(*)>(_a[1]))); break; case 8: sendVertex((*reinterpret_cast< Vertex*(*)>(_a[1]))); break; case 9: acceptMesh((*reinterpret_cast< Mesh*(*)>(_a[1]))); break; case 10: setX((*reinterpret_cast< double(*)>(_a[1]))); break; case 11: setY((*reinterpret_cast< double(*)>(_a[1]))); break; case 12: setZ((*reinterpret_cast< double(*)>(_a[1]))); break; case 13: deleteVertex(); break; case 14: addVertexToEdge(); break; case 15: addEdgeBetweenFaces(); break; case 16: activated(); break; default: ; } _id -= 17; } return _id; }
void DepthBuilderP2PNoBlock::synchAction() { Status status; if (isRecvActive && recvRequest.Test(status)) { assert(0 <= requestedVertex && requestedVertex <= graph->numLocalVertex); //printf("%d: write depth [ %ld] to %d\n", rank, depth[requestedVertex], status.Get_source()); sendVertex(depth[requestedVertex], status.Get_source(), DEPTH_SEND_TAG); isRecvActive = false; } startRecv(); }
Vertex DepthBuilderP2PNoBlock::getDepth(Vertex tgtVertex) { const int tgtRank = graph->vertexRank(tgtVertex); const Vertex tgtLocal = graph->vertexToLocal(tgtVertex); Vertex tgtDepth; if (tgtRank == rank) { tgtDepth = depth[tgtLocal]; } else { sendVertex(tgtLocal, tgtRank, LOCAL_SEND_TAG); Request recvReq = comm->Irecv(&tgtDepth, 1, VERTEX_TYPE, tgtRank, DEPTH_SEND_TAG); while (!recvReq.Test()) { synchAction(); } assert(0 <= tgtDepth && tgtDepth <= graph->numGlobalVertex); } return tgtDepth; }
// Finally, the actual calls to do something with all this data. You can either choose to render // it given the configuration, or generate a display list of rendering it with the given // configuration (uses GL_COMPILE mode to build the list). Fails if insufficient data has // been given (i.e. if you don't give it an array for an enabled parameter, if you don't // give it an array of indices when it needs them). // Note that rendering with GLVERTEX_MODE currently involves a lot of CPU overhead to // unpack the data and pass it to the GL; while the results will be correct, it would be // unwise to use this method for rendering that is to be benchmarked, because it will // underestimate performance significantly on some machines. bool GeomRenderer::renderPrimitives(GLenum mode) { if (!isReadyToRender()) { return false; } // Okay, different sections here depending on what we're doing. if (drawMethod == GLVERTEX_MODE) { glBegin(mode); for (unsigned int x=0; x<indicesCount; x++) { int directIndex = getIndex(x); if (parameterBits & COLOR_BIT) sendColor(directIndex); if (parameterBits & TEXTURE_COORD_BIT) sendTexCoord(directIndex); if (parameterBits & NORMAL_BIT) sendNormal(directIndex); sendVertex(directIndex); } glEnd(); } // Otherwise it has something to do with arrays; set up the arrays. else { if (parameterBits & COLOR_BIT) { glEnableClientState(GL_COLOR_ARRAY); glColorPointer(colorData.size, colorData.type, colorData.stride, colorData.pointer); // std::cout << "Enabled color arrays, size [" << colorData.size << "], type [" << colorData.type // << "], stride [" << colorData.stride << "], pointer [" << colorData.pointer << "]" << std::endl; } if (parameterBits & TEXTURE_COORD_BIT) { glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(texCoordData.size, texCoordData.type, texCoordData.stride, texCoordData.pointer); // std::cout << "Enabled texCoord arrays, size [" << texCoordData.size << "], type [" << texCoordData.type // << "], stride [" << texCoordData.stride << "], pointer [" << texCoordData.pointer << "]" << std::endl; } if (parameterBits & NORMAL_BIT) { glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(normalData.type, normalData.stride, normalData.pointer); // std::cout << "Enabled normal arrays, size [" << normalData.size << "], type [" << normalData.type // << "], stride [" << normalData.stride << "], pointer [" << normalData.pointer << "]" << std::endl; } glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(vertexData.size, vertexData.type, vertexData.stride, vertexData.pointer); // std::cout << "Enabled vertex arrays, size [" << vertexData.size << "], type [" << vertexData.type // << "], stride [" << vertexData.stride << "], pointer [" << vertexData.pointer << "]" << std::endl; // Should we lock? if (compileArrays) { assert(GLUtils::haveExtension("GL_EXT_compiled_vertex_array")); glLockArraysEXT(0, arrayLength); } // Okay, arrays configured; what exactly are we doing? if (drawMethod == GLARRAYELEMENT_MODE) { glBegin(mode); for (unsigned int x=0; x<indicesCount; x++) { glArrayElement(getIndex(x)); } glEnd(); } else if (drawMethod == GLDRAWARRAYS_MODE) { glDrawArrays(mode, 0, arrayLength); std::cout << "Called glDrawArrays, mode [" << mode << "], from 0 to " << arrayLength << std::endl; } else if (drawMethod == GLDRAWELEMENTS_MODE) { glDrawElements(mode, indicesCount, indicesType, indices); } // Done. If we locked, unlock. if (compileArrays) { assert(GLUtils::haveExtension("GL_EXT_compiled_vertex_array")); glUnlockArraysEXT(); } } return true; }
/** Send a 4-vertex to the rendersystem. */ virtual void sendVertex(double x, double y, double z, double w) { sendVertex(Vector4((float)x, (float)y, (float)z, (float)w)); };
/** Send a 4-vertex to the rendersystem. */ virtual void sendVertex(float x, float y, float z, float w) { sendVertex(Vector4(x, y, z, w)); };
/** Send a 3-vertex to the rendersystem. */ virtual void sendVertex(double x, double y, double z) { sendVertex(Vector3((float)x, (float)y, (float)z)); };
/** Send a 3-vertex to the rendersystem. */ virtual void sendVertex(float x, float y, float z) { sendVertex(Vector3(x, y, z)); }
/** Send a 2-vertex to the rendersystem. */ virtual void sendVertex(double x, double y) { sendVertex(Vector2((float)x, (float)y)); }