本文整理汇总了C++中Archive::Pop方法的典型用法代码示例。如果您正苦于以下问题:C++ Archive::Pop方法的具体用法?C++ Archive::Pop怎么用?C++ Archive::Pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Archive
的用法示例。
在下文中一共展示了Archive::Pop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
void Batch::Save(std::string filename,std::vector< SmartPointer<Batch> > batches)
{
Clock t1;
printf("Saving file %s\n",filename.c_str());
std::set<std::string> light_textures;
Archive ar;
ar.Open(filename,true);
ar.Push("batches");
int num=(int)batches.size();
ar.WriteInt("num",num);
for (int i=0;i<num;i++)
{
ar.Push("batch");
ar.WriteSmartPointer(batches[i]);
ar.Pop("batch");
//save the light maps
if (batches[i]->texture1 && light_textures.find(batches[i]->texture1->filename)==light_textures.end())
{
light_textures.insert(batches[i]->texture1->filename);
batches[i]->texture1->save();
}
}
ar.Pop("batches");
ar.Close();
//printf("done in %d msec\n",t1.msec());
}
示例2: Write
void Batch::Write(Archive& ar)
{
static int BATCH_VERSION=1;
ar.WriteInt("version",BATCH_VERSION);
ar.WriteInt("primitive",primitive);
ar.Push("ambient" );ambient.Write (ar);ar.Pop("ambient");
ar.Push("diffuse" );diffuse.Write (ar);ar.Pop("diffuse");
ar.Push("specular");specular.Write(ar);ar.Pop("specular");
ar.Push("emission");emission.Write(ar);ar.Pop("emission");
ar.WriteFloat("shininess",shininess);
ar.Push("matrix" );matrix.Write(ar);ar.Pop("matrix");
ar.Push("vertices" );ar.WriteSmartPointer(vertices);ar.Pop("vertices");
ar.Push("normals" );ar.WriteSmartPointer(normals );ar.Pop("normals");
ar.Push("colors" );ar.WriteSmartPointer(colors );ar.Pop("colors");
ar.WriteString("texture0",this->texture0?texture0->filename:"");
ar.Push("texture0coords");ar.WriteSmartPointer(texture0coords);ar.Pop("texture0coords");
ar.WriteString("texture1",this->texture1?texture1->filename:"");
ar.Push("texture1coords");ar.WriteSmartPointer(texture1coords);ar.Pop("texture1coords");
//important: I do not write the bounding box getBox();
}
示例3: batches
std::vector< SmartPointer<Batch> > Batch::Open(std::string filename)
{
Clock t1;
printf("Opening file %s\n",filename.c_str());
Archive ar;
ar.Open(filename,false);
ar.Push("batches");
int num=ar.ReadInt("num");
std::vector< SmartPointer<Batch> > batches(num);
for (int i=0;i<num;i++)
{
ar.Push("batch");
batches[i]=ar.ReadSmartPointer<Batch>();
ar.Pop("batch");
}
ar.Pop("batches");
ar.Close();
//printf("done in %d msec\n",t1.msec());
return batches;
}
示例4: Read
void Batch::Read(Archive& ar)
{
int version=ar.ReadInt("version");
this->primitive=ar.ReadInt("primitive");
ar.Push("ambient" );ambient.Read (ar);ar.Pop("ambient");
ar.Push("diffuse" );diffuse.Read (ar);ar.Pop("diffuse");
ar.Push("specular");specular.Read(ar);ar.Pop("specular");
ar.Push("emission");emission.Read(ar);ar.Pop("emission");
this->shininess=ar.ReadFloat("shininess");
ar.Push("matrix" );matrix.Read(ar);ar.Pop("matrix");
ar.Push("vertices");vertices=ar.ReadSmartPointer<Vector>();ar.Pop("vertices");
ar.Push("normals" );normals=ar.ReadSmartPointer<Vector>();ar.Pop("normals");
ar.Push("colors" ) ;colors=ar.ReadSmartPointer<Vector>();ar.Pop("colors");
this->texture0.reset();std::string skin_filename=ar.ReadString("texture0");
if (skin_filename.length()) this->texture0 =Texture::open(skin_filename);
ar.Push("texture0coords");texture0coords=ar.ReadSmartPointer<Vector>();ar.Pop("texture0coords");
this->texture1.reset();std::string light_filename=ar.ReadString("texture1");
if (light_filename.length()) this->texture1 =Texture::open(light_filename);
ar.Push("texture1coords");texture1coords=ar.ReadSmartPointer<Vector>();ar.Pop("texture1coords");
//I force a recalculation of bounding box
this->invalidateBox();
}