void Model::arrangeFaceColors(const osg::Vec4Array &colors) { if (!this->m_mesh || !this->m_colorArray || !this->m_vertexGeometry || !this->m_edgeGeometry || !this->m_faceGeometry) return; if (this->m_usingSharedVertex) return; if (colors.size() != this->m_mesh->fn * 3) return; this->m_colorArray->assign(colors.begin(), colors.end()); this->m_vertexGeometry->dirtyDisplayList(); this->m_edgeGeometry->dirtyDisplayList(); this->m_faceGeometry->dirtyDisplayList(); }
virtual void apply(osg::Vec4Array& array) { if (_pointList.size()!=array.size()) return; for(unsigned int i=0;i<_pointList.size();++i) { _pointList[i] = new EdgeCollector::Point; _pointList[i]->_index = i; osgUtil::ConvertVec<osg::Vec4, osg::Vec3d>::convert(array[i], _pointList[i]->_vertex); } }
void Model::arrangeVertexColors(const osg::Vec4Array &colors) { if (!this->m_mesh || !this->m_colorArray || !this->m_vertexGeometry || !this->m_edgeGeometry || !this->m_faceGeometry) return; if (colors.size() != this->m_mesh->vn) return; if (this->m_usingSharedVertex) { this->m_colorArray->assign(colors.begin(), colors.end()); } else { this->m_colorArray->clear(); this->m_colorArray->reserve(this->m_mesh->fn * 3); for (pcvcg::TriMesh::ConstFaceIterator cf_iter = this->m_mesh->face.begin(); cf_iter != this->m_mesh->face.end(); ++cf_iter) { this->m_colorArray->push_back(colors[vcg::tri::Index(*this->m_mesh, cf_iter->cV(0))]); this->m_colorArray->push_back(colors[vcg::tri::Index(*this->m_mesh, cf_iter->cV(1))]); this->m_colorArray->push_back(colors[vcg::tri::Index(*this->m_mesh, cf_iter->cV(2))]); } } this->m_vertexGeometry->dirtyDisplayList(); this->m_edgeGeometry->dirtyDisplayList(); this->m_faceGeometry->dirtyDisplayList(); }
GLuint SomePointsGenerator::getNumPrimitivesGenerated()const { return vAry->size()*4; }