#include #include #include #include using namespace vcg; #include #include class EdgeProto{}; class Vertex0 : public VertexSimp1< Vertex0,EdgeProto,vcg::vert::Coord3fOpt>{}; typedef TVector TVect; int main(){ int i; // partial test for CORE DATA *********** // put some vertex in a vector TVector c1; for( i = 0; i < 10; i++) c1.push_back(Vertex0()); c1.EnableAttribute(); // put some more vertex inthe vector for( i= 0; i < 10; i++) c1.push_back(Vertex0()); c1[2].P()=Point3f(1.0,2,3); Point3f p = c1[2].P(); // drop the attributes c1.DisableAttribute(); // ***************************************** // USER DATA // si puo' fare in 2 modi: Se il container e'di tipo TVector (traced vector) // si puo'usare //(1) c.NewTempData(); che si occupa di resizare // i container di dati temporanei (cioe' riflette tutte le push_back,reserve,resize // eventualemnte fatte sul vettore). NewTempoData resituisce una handle per accedere // al dato. // (2) si usa SimpleTempData che e' come uno tranne che non supporta automaticamente // le variazioni di dimensione // del vettore (si puo' fare a mano pero')...s // partial test for USER DATA *********** // modo (1) for( i = 0; i < 10; i++) c1.push_back(Vertex0()); CATEntry >::Insert(c1); // questa riga sparira' TempData handle = c1.NewTempData(); handle[&c1[3]] = 71; // put some more vertex inthe vector for( i = 0; i < 10; i++) c1.push_back(Vertex0()); int h = handle[&c1[3]]; c1.DeleteTempData(handle); // ***************************************** // partial test for USER DATA *********** // modo (2) std::vector c; for( i = 0; i < 10; i++) c.push_back(Vertex0()); SimpleTempData,int> tmp(c); tmp.Start(); tmp[&c[1]] = 22; int hh = tmp[&c[1]]; tmp.Stop(); // ************************************** }