本文整理汇总了C++中torque::Path::getExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::getExtension方法的具体用法?C++ Path::getExtension怎么用?C++ Path::getExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torque::Path
的用法示例。
在下文中一共展示了Path::getExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkAndMountSketchup
bool ColladaShapeLoader::checkAndMountSketchup(const Torque::Path& path, String& mountPoint, Torque::Path& daePath)
{
bool isSketchup = path.getExtension().equal("kmz", String::NoCase);
if (isSketchup)
{
// Mount the zip so files can be found (it will be unmounted before we return)
mountPoint = String("sketchup_") + path.getFileName();
String zipPath = path.getFullPath();
if (!Torque::FS::Mount(mountPoint, new Torque::ZipFileSystem(zipPath)))
return false;
Vector<String> daeFiles;
Torque::Path findPath;
findPath.setRoot(mountPoint);
S32 results = Torque::FS::FindByPattern(findPath, "*.dae", true, daeFiles);
if (results == 0 || daeFiles.size() == 0)
{
Torque::FS::Unmount(mountPoint);
return false;
}
daePath = daeFiles[0];
}
else
{
daePath = path;
}
return isSketchup;
}
示例2: sHLSLStr
bool GFXD3D9Shader::_compileShader( const Torque::Path &filePath,
const String& target,
const D3DXMACRO *defines,
GenericConstBufferLayout* bufferLayoutF,
GenericConstBufferLayout* bufferLayoutI,
Vector<GFXShaderConstDesc> &samplerDescriptions )
{
PROFILE_SCOPE( GFXD3D9Shader_CompileShader );
HRESULT res = D3DERR_INVALIDCALL;
LPD3DXBUFFER code = NULL;
LPD3DXBUFFER errorBuff = NULL;
#ifdef TORQUE_DEBUG
U32 flags = D3DXSHADER_DEBUG;
#else
U32 flags = 0;
#endif
#ifdef TORQUE_OS_XENON
flags |= D3DXSHADER_PREFER_FLOW_CONTROL;
#endif
#ifdef D3DXSHADER_USE_LEGACY_D3DX9_31_DLL
if( D3DX_SDK_VERSION >= 32 )
{
// will need to use old compiler for 1_1 shaders - check for pixel
// or vertex shader with appropriate version.
if ((target.compare("vs1", 3) == 0) || (target.compare("vs_1", 4) == 0))
flags |= D3DXSHADER_USE_LEGACY_D3DX9_31_DLL;
if ((target.compare("ps1", 3) == 0) || (target.compare("ps_1", 4) == 0))
flags |= D3DXSHADER_USE_LEGACY_D3DX9_31_DLL;
}
#endif
#if !defined(TORQUE_OS_XENON) && (D3DX_SDK_VERSION <= 40)
#error This version of the DirectX SDK is too old. Please install a newer version of the DirectX SDK: http://msdn.microsoft.com/en-us/directx/default.aspx
#endif
ID3DXConstantTable* table = NULL;
static String sHLSLStr( "hlsl" );
static String sOBJStr( "obj" );
// Is it an HLSL shader?
if ( filePath.getExtension().equal(sHLSLStr, String::NoCase) )
{
FrameAllocatorMarker fam;
char *buffer = NULL;
// Set this so that the D3DXInclude::Open will have this
// information for relative paths.
smD3DXInclude->setPath( filePath.getRootAndPath() );
FileStream s;
if ( !s.open( filePath, Torque::FS::File::Read ) )
{
AssertISV(false, avar("GFXD3D9Shader::initShader - failed to open shader '%s'.", filePath.getFullPath().c_str()));
if ( smLogErrors )
Con::errorf( "GFXD3D9Shader::_compileShader - Failed to open shader file '%s'.",
filePath.getFullPath().c_str() );
return false;
}
// Convert the path which might have virtualized
// mount paths to a real file system path.
Torque::Path realPath;
if ( !FS::GetFSPath( filePath, realPath ) )
realPath = filePath;
// Add a #line pragma so that error and warning messages
// returned by the HLSL compiler report the right file.
String linePragma = String::ToString( "#line 1 \"%s\"\r\n", realPath.getFullPath().c_str() );
U32 linePragmaLen = linePragma.length();
U32 bufSize = s.getStreamSize();
buffer = (char *)fam.alloc( bufSize + linePragmaLen + 1 );
dStrncpy( buffer, linePragma.c_str(), linePragmaLen );
s.read( bufSize, buffer + linePragmaLen );
buffer[bufSize+linePragmaLen] = 0;
res = GFXD3DX.D3DXCompileShader( buffer, bufSize + linePragmaLen, defines, smD3DXInclude, "main",
target, flags, &code, &errorBuff, &table );
}
// Is it a precompiled obj shader?
else if ( filePath.getExtension().equal( sOBJStr, String::NoCase ) )
{
FileStream s;
if(!s.open(filePath, Torque::FS::File::Read))
{
AssertISV(false, avar("GFXD3D9Shader::initShader - failed to open shader '%s'.", filePath.getFullPath().c_str()));
if ( smLogErrors )
Con::errorf( "GFXD3D9Shader::_compileShader - Failed to open shader file '%s'.",
filePath.getFullPath().c_str() );
//.........这里部分代码省略.........