本文整理汇总了C++中torque::Path::setPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::setPath方法的具体用法?C++ Path::setPath怎么用?C++ Path::setPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torque::Path
的用法示例。
在下文中一共展示了Path::setPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copySketchupTexture
//-----------------------------------------------------------------------------
/// Copy a texture from a KMZ to a cache. Note that the texture filename is modified
void copySketchupTexture(const Torque::Path &path, String &textureFilename)
{
if (textureFilename.isEmpty())
return;
Torque::Path texturePath(textureFilename);
texturePath.setExtension(findTextureExtension(texturePath));
String cachedTexFilename = String::ToString("%s_%s.cached",
TSShapeLoader::getShapePath().getFileName().c_str(), texturePath.getFileName().c_str());
Torque::Path cachedTexPath;
cachedTexPath.setRoot(path.getRoot());
cachedTexPath.setPath(path.getPath());
cachedTexPath.setFileName(cachedTexFilename);
cachedTexPath.setExtension(texturePath.getExtension());
FileStream *source;
FileStream *dest;
if ((source = FileStream::createAndOpen(texturePath.getFullPath(), Torque::FS::File::Read)) == NULL)
return;
if ((dest = FileStream::createAndOpen(cachedTexPath.getFullPath(), Torque::FS::File::Write)) == NULL)
{
delete source;
return;
}
dest->copyFrom(source);
delete dest;
delete source;
// Update the filename in the material
cachedTexPath.setExtension("");
textureFilename = cachedTexPath.getFullPath();
}
示例2: _loadLegacy
//.........这里部分代码省略.........
if ( mFileVersion > 3 && mFileVersion < 6 )
{
// Between version 3 and 5 we store the texture file names
// relative to the terrain file. We restore the full path
// here so that we can create a TerrainMaterial from it.
materials.push_back( Torque::Path::CompressPath( mFilePath.getRoot() + mFilePath.getPath() + '/' + matName ) );
}
else
materials.push_back( matName );
}
if ( mFileVersion <= 3 )
{
GFXTexHandle terrainMat;
Torque::Path matRelPath;
// Try to automatically fix up our material file names
for (U32 i = 0; i < materials.size(); i++)
{
if ( materials[i].isEmpty() )
continue;
terrainMat.set( materials[i], &GFXDefaultPersistentProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
if ( terrainMat )
continue;
matRelPath = materials[i];
String path = matRelPath.getPath();
String::SizeType n = path.find( '/', 0, String::NoCase );
if ( n != String::NPos )
{
matRelPath.setPath( String(Con::getVariable( "$defaultGame" )) + path.substr( n, path.length() - n ) );
terrainMat.set( matRelPath, &GFXDefaultPersistentProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
if ( terrainMat )
{
materials[i] = matRelPath.getFullPath();
mNeedsResaving = true;
}
}
} // for (U32 i = 0; i < TerrainBlock::MaterialGroups; i++)
} // if ( mFileVersion <= 3 )
if ( mFileVersion == 1 )
{
for( S32 j = 0; j < sampleCount; j++ )
{
if ( materialAlphaMap[baseMaterialMap[j]] == NULL )
{
materialAlphaMap[baseMaterialMap[j]] = new U8[sampleCount];
dMemset(materialAlphaMap[baseMaterialMap[j]], 0, sampleCount);
}
materialAlphaMap[baseMaterialMap[j]][j] = 255;
}
}
else
{
for( S32 k=0; k < materials.size(); k++ )
{
AssertFatal(materialAlphaMap[k] == NULL, "Bad assumption. There should be no alpha map at this point...");
materialAlphaMap[k] = new U8[sampleCount];