本文整理汇总了C++中Archive::WriteSmartPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ Archive::WriteSmartPointer方法的具体用法?C++ Archive::WriteSmartPointer怎么用?C++ Archive::WriteSmartPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Archive
的用法示例。
在下文中一共展示了Archive::WriteSmartPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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());
}