当前位置: 首页>>代码示例>>C++>>正文


C++ Model::Destroy方法代码示例

本文整理汇总了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;
	}
}
开发者ID:88er,项目名称:tutorials,代码行数:22,代码来源:Main.cpp

示例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;
}
开发者ID:Clever-Boy,项目名称:XLE,代码行数:74,代码来源:XmlModelFactory.cpp


注:本文中的Model::Destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。