本文整理汇总了C++中BinaryFile::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryFile::Write方法的具体用法?C++ BinaryFile::Write怎么用?C++ BinaryFile::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryFile
的用法示例。
在下文中一共展示了BinaryFile::Write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertToPyrosFormat
bool AssimpModelImporter::ConvertToPyrosFormat(const std::string &Filename)
{
BinaryFile *bin = new BinaryFile();
if (bin->Open(Filename.c_str(), 'w'))
{
// Save Materials
int32 materialsSize = materials.size();
bin->Write(&materialsSize, sizeof(int32));
for (std::vector<MaterialProperties>::iterator i=materials.begin();i!=materials.end();i++)
{
// Material ID
bin->Write(&(*i).id,sizeof(int32));
// Material Name
int32 nameSize = (*i).Name.size();
bin->Write(&nameSize,sizeof(int32));
if (nameSize>0)
bin->Write((*i).Name.c_str(),sizeof(char)*nameSize);
// Color
uchar Out = (uchar)(*i).haveColor;
bin->Write(&Out, sizeof(uchar));
bin->Write(&(*i).Color, sizeof(Vec4));
// Specular
Out = (uchar)(*i).haveSpecular;
bin->Write(&Out, sizeof(uchar));
bin->Write(&(*i).Specular, sizeof(Vec4));
// Ambient
Out = (uchar)(*i).haveAmbient;
bin->Write(&Out, sizeof(uchar));
bin->Write(&(*i).Ambient, sizeof(Vec4));
// Emissive
Out = (uchar)(*i).haveEmissive;
bin->Write(&Out, sizeof(uchar));
bin->Write(&(*i).Emissive, sizeof(Vec4));
// WireFrame
Out = (uchar)(*i).WireFrame;
bin->Write(&Out, sizeof(uchar));
// Twosided
Out = (uchar)(*i).Twosided;
bin->Write(&Out, sizeof(uchar));
// Opacity
bin->Write(&(*i).Opacity,sizeof(f32));
// Shininess
bin->Write(&(*i).Shininess,sizeof(f32));
// Shininess Strength
bin->Write(&(*i).ShininessStrength,sizeof(f32));
// Textures
// Color Map
Out = (uchar)(*i).haveColorMap;
bin->Write(&Out, sizeof(uchar));
int32 colorMapSize = (*i).colorMap.size();
bin->Write(&colorMapSize,sizeof(int32));
if (colorMapSize>0)
bin->Write((*i).colorMap.c_str(),sizeof(char)*colorMapSize);
// Specular Map
Out = (uchar)(*i).haveSpecularMap;
bin->Write(&Out, sizeof(uchar));
int32 specularMapSize = (*i).specularMap.size();
bin->Write(&specularMapSize,sizeof(int32));
if (specularMapSize>0)
bin->Write((*i).specularMap.c_str(),sizeof(char)*specularMapSize);
// Normal Map
Out = (uchar)(*i).haveNormalMap;
bin->Write(&Out, sizeof(uchar));
int32 normalMapSize = (*i).normalMap.size();
bin->Write(&normalMapSize,sizeof(int32));
if (normalMapSize>0)
bin->Write((*i).normalMap.c_str(),sizeof(char)*normalMapSize);
// Have Bones
Out = (uchar)(*i).haveBones;
bin->Write(&Out, sizeof(uchar));
}
// Skeleton
int32 skeletonSize = skeleton.size();
bin->Write(&skeletonSize,sizeof(int32));
if (skeletonSize>0)
{
// Write ids
//.........这里部分代码省略.........