本文整理汇总了C++中BinaryWriter::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryWriter::Write方法的具体用法?C++ BinaryWriter::Write怎么用?C++ BinaryWriter::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter::Write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveMesh
void GeoSaver::SaveMesh(Scene3DMesh *mesh, BinaryWriter &bw)
{
bw.Write(mesh ->id);
bw.Write(mesh ->name);
for (int i = 0; i < 16; i++)
bw.Write(mesh->m_worldInverseMatrix.a[i]);
bw.Write((int)mesh ->meshParts.size());
for (int i = 0; i < (int)mesh ->meshParts.size(); i++)
SaveMeshPart(mesh ->meshParts[i], bw);
SaveProperties(mesh, bw);
}
示例2: sizeof
BinaryWriter& AFXAPI operator<<(BinaryWriter& wr, const IPAddress& ha) {
wr << (short)ha.get_AddressFamily();
switch ((int)ha.get_AddressFamily()) {
case AF_INET:
wr.Write(&ha.m_sin.sin_addr, sizeof(ha.m_sin.sin_addr));
break;
case AF_INET6:
wr.Write(&ha.m_sin6.sin6_addr, sizeof(ha.m_sin6.sin6_addr));
break;
default:
wr.Write(&ha.m_sockaddr, sizeof(ha.m_sockaddr)); //!!! unknown size
break;
}
return wr;
}
示例3: SaveProperties
void GeoSaver::SaveProperties(Scene3DMesh *mesh, BinaryWriter &bw)
{
bw.Write((int)mesh->properties.size());
for (unsigned i = 0; i < mesh->properties.size(); i++)
SaveProperty(mesh->properties[i], bw);
}
示例4: Write
void Type::Write(BinaryWriter &w) const
{
Node::Write(w);
w.WriteID(m_Parent);
w.WriteAs<uint8_t>(m_Primitive);
w.WriteID(m_Class);
w.Write(m_NumDereferences);
w.Write(m_IsReference);
w.Write(m_IsConst);
w.WriteID(m_ParentType);
w.WriteAs<uint32_t>(m_TemplateArgs.size());
for (auto &t : m_TemplateArgs)
t->Write(w);
w.Write(m_ArraySize);
}
示例5: SavePropertiesTxt
void GeoSaver::SavePropertiesTxt(Scene3DMesh *mesh, BinaryWriter &bw)
{
std::stringstream data;
data << "\n";
data << "<properties count=\"" << mesh->properties.size() << "\">\n";
for (unsigned i = 0; i < mesh->properties.size(); i++)
SavePropertyTxt(mesh->properties[i], bw, data);
data << "</properties>\n";
bw.Write(data.str().c_str(), static_cast<uint32_t>(data.str().size()));
}
示例6: SaveProperty
void GeoSaver::SaveProperty(Property *prop, BinaryWriter &bw)
{
bw.Write(prop->GetName());
bw.Write((BYTE)prop->GetPropertyType());
bw.Write((BYTE)prop->GetAnimationType());
if (!prop->IsAnimatable())
{
switch (prop->GetPropertyType())
{
case Property::PropertyType_Boolean: bw.Write(prop->GetBoolValue()); break;
case Property::PropertyType_Int: bw.Write(prop->GetIntValue()); break;
case Property::PropertyType_Float: bw.Write(prop->GetFloatValue()); break;
case Property::PropertyType_Vector3:
bw.Write(prop->GetVector3Value().x);
bw.Write(prop->GetVector3Value().y);
bw.Write(prop->GetVector3Value().z);
break;
case Property::PropertyType_String: bw.Write(prop->GetStringValue()); break;
}
}
else
{
if (prop->GetPropertyType() == Property::PropertyType_Float)
{
IInterpolator<float> *inter = prop->GetInterpolator<float>();
bw.Write(inter->GetKeysCount());
for (unsigned i = 0; i < prop->GetKeysCount(); i++)
{
float value;
float time;
bool stopKey;
inter->GetKeyframe(i, time, value, stopKey);
bw.Write(time);
bw.Write(value);
}
}
if (prop->GetPropertyType() == Property::PropertyType_Int)
{
IInterpolator<int> *inter = prop->GetInterpolator<int>();
bw.Write(inter->GetKeysCount());
for (unsigned i = 0; i < prop->GetKeysCount(); i++)
{
int value;
float time;
bool stopKey;
inter->GetKeyframe(i, time, value, stopKey);
bw.Write(time);
bw.Write(value);
}
}
}
}
示例7: SaveMeshPart
void GeoSaver::SaveMeshPart(Scene3DMeshPart *meshPart, BinaryWriter &bw)
{
bw.Write(meshPart ->materialName);
bw.Write(meshPart ->m_vertexChannels);
bw.Write((int)meshPart ->vertices.size());
for (int i = 0; i < (int)meshPart ->vertices.size(); i++)
{
Scene3DVertex *vert = meshPart ->vertices[i];
if (meshPart ->m_vertexChannels & VertexChannel_Position)
{
bw.Write(vert ->position.x);
bw.Write(vert ->position.y);
bw.Write(vert ->position.z);
}
if (meshPart ->m_vertexChannels & VertexChannel_Coords1)
{
bw.Write(vert ->coords1.x);
bw.Write(vert ->coords1.y);
}
if (meshPart ->m_vertexChannels & VertexChannel_Coords2)
{
bw.Write(vert ->coords2.x);
bw.Write(vert ->coords2.y);
}
if (meshPart ->m_vertexChannels & VertexChannel_Coords3)
{
bw.Write(vert ->coords3.x);
bw.Write(vert ->coords3.y);
}
if (meshPart ->m_vertexChannels & VertexChannel_Normal)
{
bw.Write(vert ->normal.x);
bw.Write(vert ->normal.y);
bw.Write(vert ->normal.z);
}
if (meshPart ->m_vertexChannels & VertexChannel_Tangent)
{
bw.Write(vert ->tangent.x);
bw.Write(vert ->tangent.y);
bw.Write(vert ->tangent.z);
}
}
}