Beispiel #1
0
/*
**	Delete all of the meshes starting from the front.
*/
void CleanUpOBJ(void)
{
	ObjMesh *pCurr;
	while(g_LinkedListHead != NULL)
	{
		pCurr = g_LinkedListHead;
		g_LinkedListHead = g_LinkedListHead->m_pNext;
		DeleteMesh(pCurr);
	}
}
Beispiel #2
0
void DeleteOBJ(ObjFile id)
{
	/*
	**	Create two pointers to walk through the linked list
	*/
	ObjMesh *pCurr,
			*pPrev = NULL;

	/*
	**	Start traversing the list from the start
	*/
	pCurr = g_LinkedListHead;

	/*
	**	Walk through the list until we either reach the end, or
	**	we find the node we are looking for
	*/
	while(pCurr != NULL && pCurr->m_iMeshID != id)
	{
		pPrev = pCurr;
		pCurr = pCurr->m_pNext;
	}

	/*
	**	If we found the node that needs to be deleted
	*/
	if(pCurr != NULL)
	{
		/*
		**	If the pointer before it is NULL, then we need to
		**	remove the first node in the list
		*/
		if(pPrev == NULL)
		{
			g_LinkedListHead = pCurr->m_pNext;
		}

		/*
		**	Otherwise we are removing a node from somewhere else
		*/
		else
		{
			pPrev->m_pNext = pCurr->m_pNext;
		}

		/*
		**	Free the memory allocated for this mesh
		*/
		DeleteMesh(pCurr);
	}
}
Beispiel #3
0
OBJModel::OBJModel(const QString& path)
{
    const std::string tmpPath = path.toStdString();
    const char* c_path = tmpPath.c_str();

    mesh_loader_result_t result = NewMeshFromOBJFile(c_path);

    if (result.status == MESH_LOADER_SUCCESS) {
        qDebug() << "Loaded Mesh!";
        createBuffers(&result.mesh);
    } else {
        qDebug() << "Error loading mesh:" << result.status;
    }

    DeleteMesh(&result.mesh);
}
Beispiel #4
0
bool CPlane::GenerateMesh()
{
	if( !pMesh ) { return FALSE; }

	DeleteMesh(); 

	Object = pMesh->AddObject();

	pMesh->pObject[Object].HasVertexColors = FALSE; 
	pMesh->pObject[Object].Color[0] = 0.3f;
	pMesh->pObject[Object].Color[1] = 0.3f;
	pMesh->pObject[Object].Color[2] = 0.3f;

	Step[0] = Size[0] / Tassellation[0];
	Step[1] = Size[1] / Tassellation[1];

	pMesh->AddVertices( Object,  ( Tassellation[0] + 1 ) * ( Tassellation[1] + 1 ) ); 
	pMesh->AddTriangles( Object, Tassellation[0] * Tassellation[1] * 2 );

	return TRUE;
}
void ResourceManager::Destroy()
{
    DeleteSprite();
    CursorCleanUp();

    SkyBoxCleanUp();
    DeleteMap();

    for ( auto& toBeDelete : m_MeshArray )
    {
        if ( toBeDelete )
        {
            DeleteMesh( toBeDelete->m_MeshObject );
            SafeDelete( toBeDelete->m_MeshObject );
            delete toBeDelete;
        }
    }
    for ( auto& toBeDelete : m_HeightMapArray )
    {
        SafeDelete( toBeDelete );
    }
}
Beispiel #6
0
 /*!
 * @brief Calls when the system is shutting down
 */
 void GLGraphics::Shutdown(void)  //called when system is deleated
 {
   DeleteMesh();
 }