本文整理汇总了C++中IReadFile::releaseRef方法的典型用法代码示例。如果您正苦于以下问题:C++ IReadFile::releaseRef方法的具体用法?C++ IReadFile::releaseRef怎么用?C++ IReadFile::releaseRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReadFile
的用法示例。
在下文中一共展示了IReadFile::releaseRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTexture
//! loads a Texture
ITexture* CNullDriver::getTexture(const path& filename)
{
// Identify textures by their absolute filenames if possible.
const path absolutePath = FileSystem->getAbsolutePath(filename);
ITexture* texture = findTexture(absolutePath);
if (texture)
return texture;
// Then try the raw filename, which might be in an Archive
texture = findTexture(filename);
if (texture)
return texture;
// Now try to open the file using the complete path.
IReadFile* file = FileSystem->createAndOpenFile(absolutePath);
if (!file)
{
// Try to open it using the raw filename.
file = FileSystem->createAndOpenFile(filename);
}
if (file)
{
// Re-check name for actual archive names
texture = findTexture(file->getFileName());
if (texture)
{
file->releaseRef();
return texture;
}
texture = loadTextureFromFile(file);
file->releaseRef();
if (texture)
{
addTexture(texture);
texture->releaseRef(); // drop it because we created it, one grab too much
}
else
Printer::log("Could not load texture", filename, ELL_ERROR);
return texture;
}
else
{
Printer::log("Could not open file of texture", filename, ELL_WARNING);
return 0;
}
}
示例2: addShaderMaterialFromFiles
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
//! programs from files.
s32 CNullDriver::addShaderMaterialFromFiles(const path& vertexShaderProgramFileName,
const path& pixelShaderProgramFileName,
IShaderConstantSetCallBack* callback,
E_MATERIAL_TYPE baseMaterial,
s32 userData)
{
IReadFile* vsfile = 0;
IReadFile* psfile = 0;
if (vertexShaderProgramFileName.size())
{
vsfile = FileSystem->createAndOpenFile(vertexShaderProgramFileName);
if (!vsfile)
{
Printer::log("Could not open vertex shader program file",
vertexShaderProgramFileName, ELL_WARNING);
return -1;
}
}
if (pixelShaderProgramFileName.size())
{
psfile = FileSystem->createAndOpenFile(pixelShaderProgramFileName);
if (!psfile)
{
Printer::log("Could not open pixel shader program file",
pixelShaderProgramFileName, ELL_WARNING);
if (vsfile)
vsfile->releaseRef();
return -1;
}
}
s32 result = addShaderMaterialFromFiles(vsfile, psfile, callback,
baseMaterial, userData);
if (psfile)
psfile->releaseRef();
if (vsfile)
vsfile->releaseRef();
return result;
}
示例3: createImageFromFile
//! Creates a software image from a file.
IImage* CNullDriver::createImageFromFile(const path& filename)
{
if (!filename.size())
return 0;
IImage* image = 0;
IReadFile* file = FileSystem->createAndOpenFile(filename);
if (file)
{
image = createImageFromFile(file);
file->releaseRef();
}
else
Printer::log("Could not open file of image", filename, ELL_WARNING);
return image;
}
示例4: addHighLevelShaderMaterialFromFiles
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
//! but tries to load the programs from files.
s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
const path& vertexShaderProgramFileName,
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
const path& pixelShaderProgramFileName,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
const path& geometryShaderProgramFileName,
const c8* geometryShaderEntryPointName,
E_GEOMETRY_SHADER_TYPE gsCompileTarget,
E_PRIMITIVE_TYPE inType, E_PRIMITIVE_TYPE outType,
u32 verticesOut,
IShaderConstantSetCallBack* callback,
E_MATERIAL_TYPE baseMaterial,
s32 userData, E_GPU_SHADING_LANGUAGE shadingLang)
{
IReadFile* vsfile = 0;
IReadFile* psfile = 0;
IReadFile* gsfile = 0;
if (vertexShaderProgramFileName.size() )
{
vsfile = FileSystem->createAndOpenFile(vertexShaderProgramFileName);
if (!vsfile)
{
Printer::log("Could not open vertex shader program file",
vertexShaderProgramFileName, ELL_WARNING);
}
}
if (pixelShaderProgramFileName.size() )
{
psfile = FileSystem->createAndOpenFile(pixelShaderProgramFileName);
if (!psfile)
{
Printer::log("Could not open pixel shader program file",
pixelShaderProgramFileName, ELL_WARNING);
}
}
if (geometryShaderProgramFileName.size() )
{
gsfile = FileSystem->createAndOpenFile(geometryShaderProgramFileName);
if (!gsfile)
{
Printer::log("Could not open geometry shader program file",
geometryShaderProgramFileName, ELL_WARNING);
}
}
s32 result = addHighLevelShaderMaterialFromFiles(
vsfile, vertexShaderEntryPointName, vsCompileTarget,
psfile, pixelShaderEntryPointName, psCompileTarget,
gsfile, geometryShaderEntryPointName, gsCompileTarget,
inType, outType, verticesOut,
callback, baseMaterial, userData, shadingLang);
if (psfile)
psfile->releaseRef();
if (vsfile)
vsfile->releaseRef();
if (gsfile)
gsfile->releaseRef();
return result;
}