本文整理汇总了C++中tstring::cbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::cbegin方法的具体用法?C++ tstring::cbegin怎么用?C++ tstring::cbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tstring
的用法示例。
在下文中一共展示了tstring::cbegin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadBinObj
void ModelLoader::ReadBinObj(const tstring& assetName)
{
//LAYOUT
//DWord : #meshes
//Word: nameLength
//buffer: name
//DWord : #vert
//vector3: pos, vector3: norm, vector3 tan, vector2: tex : vertex
//DWord : #triangles
//DWord, DWord, DWord : triangle
//...
string name(assetName.cbegin(), assetName.cend());
UserStream stream(name.c_str(), true);
DWORD meshes = stream.readDword();
for (DWORD m = 0; m < meshes; ++m)
{
WORD nameLength = stream.readWord();
char* name = new char[nameLength];
stream.readBuffer(name, nameLength);
string tempname(name);
tempname = tempname.substr(0, nameLength);
delete name;
m_pCurrentMesh = m_pCurrentModel->AddMesh(tstring(tempname.cbegin(), tempname.cend()));
m_VPNTTData.clear();
DWORD vertices = stream.readDword();
for (DWORD v = 0; v < vertices; ++v)
{
Vector3 pos = stream.readVector3();
Vector3 norm = stream.readVector3();
Vector3 tan = stream.readVector3();
Vector2 tex = stream.readVector2();
m_VPNTTData.push_back(VertexPosNormTanTex(pos, norm, tan, tex));
}
DWORD indices = stream.readDword() * 3;
m_IndexData.clear();
for (DWORD i = 0; i < indices; ++i)
{
DWORD index = stream.readDword();
m_IndexData.push_back(index);
}
m_pCurrentMesh->SetVertices(m_VPNTTData);
m_pCurrentMesh->SetIndices(m_IndexData);
}
}
示例2: ReadBinSBObj
void ModelLoader::ReadBinSBObj(const tstring& assetName)
{
//LAYOUT
//Word: nameLength
//buffer: name
//DWord : #vert
//vector3: pos, vector3: norm, vector2: tex, DWORD tetra, Vector3 bc : vertex
//DWord : #triangles
//DWord, DWord, DWord : triangle
string filename(assetName.cbegin(), assetName.cend());
UserStream stream(filename.c_str(), true);
WORD nameLength = stream.readWord();
char* name = new char[nameLength];
stream.readBuffer(name, nameLength);
string tempname(name);
delete name;
m_pCurrentSBMesh->SetName(tstring(tempname.cbegin(), tempname.cend()));
m_VPNTTData.clear();
vector<DWORD> tetraData;
vector<Vector3> bcData;
DWORD numVertices = stream.readDword();
for (DWORD v = 0; v < numVertices; ++v)
{
Vector3 pos = stream.readVector3();
Vector3 norm = stream.readVector3();
Vector2 tex = stream.readVector2();
DWORD tetra = stream.readDword();
Vector3 bc = stream.readVector3();
m_VPNTTData.push_back(VertexPosNormTanTex(pos, norm, Vector3(), tex));
tetraData.push_back(tetra);
bcData.push_back(bc);
}
DWORD tris = stream.readDword();
m_IndexData.clear();
for (DWORD i = 0; i < tris * 3; ++i)
{
DWORD index = stream.readDword();
m_IndexData.push_back(index);
}
m_pCurrentSBMesh->SetVertices(m_VPNTTData);
m_pCurrentSBMesh->SetIndices(m_IndexData);
m_pCurrentSBMesh->SetTetra(tetraData);
m_pCurrentSBMesh->SetBaryCentricCoords(bcData);
}