void DisplayList::closeDefinition(stack<string> apps_stack) { glNewList(list_id, GL_COMPILE); glPushMatrix(); glMultMatrixf(transforms); if (getAppearance()->getId() == "default") { apps_stack.push(apps_stack.top()); } else { apps_stack.push(getAppearance()->getId()); } glPushMatrix(); if (prims.size() != 0) drawPrims(apps_stack.top()); glPopMatrix(); vector<string>::iterator it; for (it = refs.begin(); it != refs.end(); it++) { Node *ptr = Scene::getInstance()->getNode((*it)); stack<string> tmp; tmp.push("default"); //stack tem que ter o primeiro elemento ptr->processNode(apps_stack, tmp); } apps_stack.pop(); glPopMatrix(); glEndList(); }
size_t PredicateIndexArray::load(unsigned char *ptr, unsigned char *ptrMax, ProgressListener *listener) { size_t count = 0; bitmap = new BitSequence375(); count += bitmap->load(&ptr[count], ptrMax, listener); array = new LogSequence2(); count += array->load(&ptr[count], ptrMax, listener); #if 0 cout << "Predicate index: " << endl; // for(size_t i=0;i<array->getNumberOfElements();i++) { // cout << array->get(i) << " " << bitmap->access(i)<< endl; // } for(size_t i=1;i<=getNumPredicates();i++) { cout << "Predicate "<<i<< " first pos: " << calculatePos(i) << " occurs "<< getNumAppearances(i) << " times. "<<endl; for(size_t j=1; j<=getNumAppearances(i);j++) { size_t pos = getAppearance(i, j); cout << "\t Appearance "<< j<< " at " << pos << " => " << bitmapTriples->arrayY->get(pos) << endl; } } #endif return count; }
//! conveniance function for finding a specific attachment in the volume kit AttachmentPtr DVRVolume::findParameter(UInt32 groupId, UInt16 binding) { DVRAppearancePtr app = getAppearance(); if(app != NullFC) return app->findAttachment(groupId, binding); return NullFC; }
void MyTriangle::calcTextCoords() { float base1 = sqrtf(exp2(x2 - x1) + exp2(y2 - y1) + exp2(z2 - z1)); float hipot = sqrtf(exp2(x3 - x1) + exp2(y3 - y1) + exp2(z3 - z1)); float teta = acos((x1 * x2 + y1 * y2 + z1 * z2) / (base1 * hipot)); float base2 = hipot * cos(teta); float hight = sqrt(exp2(hipot) - exp2f(base2)); float deltas1 = base1 / getAppearance()->getSWrap(); float deltas2 = base2 / getAppearance()->getSWrap(); float deltat = hight / getAppearance()->getTWrap(); text_coords[0][0] = 0.0; text_coords[0][1] = 0.0; text_coords[1][0] = deltas1; text_coords[1][1] = 0.0; text_coords[2][0] = deltas2; text_coords[2][1] = deltat; }
// Merge polygon p into the current polygon bool Polygon::merge( Polygon* p ) { if ( !p ) return false; if ( p->getAppearance() != getAppearance() ) return false; if ( p->getVertices().size() == 0 ) return true; // merge vertices unsigned int oldVSize = _vertices.size(); unsigned int pVSize = p->_vertices.size(); _vertices.resize( oldVSize + pVSize ); for ( unsigned int i = 0; i < pVSize; i++ ) _vertices[ oldVSize + i ] = p->_vertices[i]; p->_vertices.clear(); // merge indices { unsigned int oldSize = _indices.size(); unsigned int pSize = p->_indices.size(); _indices.resize( oldSize + pSize ); for ( unsigned int i = 0; i < pSize; i++ ) _indices[ oldSize + i ] = oldVSize + p->_indices[i]; p->_indices.clear(); } // merge normals { unsigned int oldSize = _normals.size(); unsigned int pSize = p->_normals.size(); _normals.resize( oldSize + pSize ); for ( unsigned int i = 0; i < pSize; i++ ) _normals[ oldSize + i ] = p->_normals[i]; p->_normals.clear(); } // merge texcoords { unsigned int oldSize = min( _texCoords.size(), oldVSize ); unsigned int pSize = min( p->_texCoords.size(), pVSize ); _texCoords.resize( oldSize + pSize ); for ( unsigned int i = 0; i < pSize; i++ ) _texCoords[ oldSize + i ] = p->_texCoords[i]; p->_texCoords.clear(); } // merge ids _id += "+" + p->_id; return true; }
//! conveniance function for finding a specific attachment in the volume kit AttachmentPtr DVRVolume::findParameter(const FieldContainerType &type, UInt16 binding) { DVRAppearancePtr app = getAppearance(); if(osgLog().getLogLevel() == LOG_DEBUG) { FDEBUG(("DVRVolume::findParameter: \n")); type.dump(); } if(app != NullFC) return app->findAttachment(type, binding); SWARNING << "DVRVolume::findParameter - NO such parameter " << std::endl; return NullFC; }
/** * @brief Create a string representation of this device. * @return A string representation of this device. */ std::string BLEAdvertisedDevice::toString() { std::stringstream ss; ss << "Name: " << getName() << ", Address: " << getAddress().toString(); if (haveAppearance()) { ss << ", appearance: " << getAppearance(); } if (haveManufacturerData()) { char *pHex = BLEUtils::buildHexData(nullptr, (uint8_t*)getManufacturerData().data(), getManufacturerData().length()); ss << ", manufacturer data: " << pHex; free(pHex); } if (haveServiceUUID()) { ss << ", serviceUUID: " << getServiceUUID().toString(); } if (haveTXPower()) { ss << ", txPower: " << (int)getTXPower(); } return ss.str(); } // toString
//! Destructor DVRVolume::~DVRVolume(void) { SINFO << "~DVRVolume this: " << this << std::endl << "~DVRVolume appearance: " << getAppearance() << std::endl << "~DVRVolume::subRefCP(Appearance)" << std::endl; subRefCP(_sfAppearance.getValue()); SINFO << "~DVRVolume::subRefCP(Geometry)" << std::endl; // << "~DVRVolume geometry: " // << int(_sfGeometry.getValue()) // << std::endl; subRefCP(_sfGeometry.getValue()); SINFO << "~DVRVolume::subRefCP(Shader)" << std::endl; SINFO << "~DVRVolume shader: " << getShader() << std::endl; subRefCP(_sfShader.getValue()); SINFO << "~DVRVolume::subRefCP(RenderMaterial)" << std::endl << "~DVRVolume renderMaterial: " << getRenderMaterial() << std::endl; subRefCP(_sfRenderMaterial.getValue()); SINFO << "~DVRVolume::subRefCP(TextureStorage)" << std::endl << "~DVRVolume textureStorage: " << getTextureStorage() << std::endl; subRefCP(_sfTextureStorage.getValue()); }
void Node::draw(vector<Appearance*> &appearances, bool dl) { glPushMatrix(); // Appearances bool newAppearance = false; Appearance* thisAppearance = NULL; if (getAppearance()) { appearances.push_back(getAppearance()); newAppearance = true; } if (!appearances.empty()) { appearances[appearances.size() - 1]->apply(); thisAppearance = appearances[appearances.size() - 1]; } // Display List if(!dl && displayList) { // Init Display List if(generatedDL[thisAppearance] == NULL) { printf("Gerando dl!\n"); generatedDL[thisAppearance] = glGenLists(1); glNewList(generatedDL[thisAppearance], GL_COMPILE); // Transformações glMultMatrixf(getTransformations()); // Draw Primitives for (unsigned int i = 0; i < childPrimitives.size(); i++) childPrimitives[i]->draw(1, 1); // Draw other Nodes for (unsigned int i = 0; i < childNodes.size(); i++) childNodes[i]->draw(appearances, true); glEndList(); // Call Display List } else { //printf("Mostrando!\n"); glCallList(generatedDL[thisAppearance]); } } else { // Transformações glMultMatrixf(getTransformations()); if(animation) animation->apply(); // Draw Primitives for (unsigned int i = 0; i < childPrimitives.size(); i++) childPrimitives[i]->draw(1, 1); // Draw other Nodes for (unsigned int i = 0; i < childNodes.size(); i++) childNodes[i]->draw(appearances); } // POP IT if (newAppearance && !appearances.empty()) appearances.pop_back(); glPopMatrix(); }