本文整理汇总了C++中Model::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::Destroy方法的具体用法?C++ Model::Destroy怎么用?C++ Model::Destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::Destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Destroy
// This can be used to free all of our resources in the application.
void GLApplication::Destroy()
{
// Free the vertex buffers and array objects
g_Model.Destroy();
// If we have a window manager still allocated then destroy and delete it
if ( WindowManager )
{
WindowManager->Destroy();
delete WindowManager;
WindowManager = nullptr;
}
// If we have the camera still, delete it
if ( Camera )
{
delete Camera;
Camera = nullptr;
}
}
示例2: LoadResource
// ----------------------------------------------------------------------------------------------
bool XmlModelFactory::LoadResource(Resource* resource, const WCHAR * filename)
{
UINT dataSize;
BYTE* data = FileUtils::LoadFile(filename, &dataSize);
if (!data)
{
return false;
}
Model * model = (Model*)resource;
model->SetSourceFileName(filename);
// char name for logging 'char*' exceptions
char charName[MAX_PATH];
WideCharToMultiByte(0, 0, filename, -1, charName, MAX_PATH, NULL, NULL);
Model3dBuilder builder;
builder.m_model = model;
xml_document doc;
bool succeeded = false;
try
{
doc.parse<0>((char*)data);
m_parseErrors = 0;
builder.Begin();
ProcessXml(doc.first_node(), &builder);
builder.End();
if (m_parseErrors > 0)
{
Logger::Log(OutputMessageType::Error, L"%d errors occured while parsing, '%s'\n",
m_parseErrors, filename);
}
else
{
// this will create the D3D vertex/index buffers as well
// as trigger the loading of the textures.
model->Construct(m_device, ResourceManager::Inst());
}
succeeded = true;
}
catch(rapidxml::parse_error& error)
{
Logger::Log(OutputMessageType::Error, "Parse exception: '%s' while processing '%s'\n", error.what(), charName);
}
catch(std::runtime_error& error)
{
Logger::Log(OutputMessageType::Error, "Processing exception: '%s' while processing '%s'\n", error.what(), charName);
}
catch(...)
{
Logger::Log(OutputMessageType::Error, L"Generic exception while processing '%s'\n", filename);
}
if (!succeeded)
{
// clean up model (remove all geometry), but don't free memory because there
// are other references to this model from
model->Destroy();
}
SAFE_DELETE_ARRAY(data);
return succeeded;
}