Пример #1
0
// Creates the requested Render Object and returns to the Engine...
CRenderObject* CD3D_Device::CreateRenderObject(CRenderObject::RENDER_OBJECT_TYPES ObjectType) 
{
	CRenderObject* pNewObject = NULL;			// Create the Sucka...
	switch (ObjectType) 
	{
//	case CRenderObject::eDebugLine :
//		pNewObject = new CDIDebugLine(); break;
//	case CRenderObject::eDebugPolygon :
//		pNewObject = new CDIDebugPolygon(); break;
//	case CRenderObject::eDebugText :
//		pNewObject = new CDIDebugText(); break;
	case CRenderObject::eRigidMesh :
		pNewObject = new CD3DRigidMesh(); break;
	case CRenderObject::eSkelMesh :
		pNewObject = new CD3DSkelMesh(); break;
//	case CRenderObject::eVAMesh :
//		pNewObject = new CD3DVAMesh(); break;
//	case CRenderObject::eABCPieceLOD :
//		pNewObject = new ABCPieceLOD(); break;
	default : return NULL; 
	} //assert(0);  }

	if (pNewObject) 
	{							// Add it to the Render Object List...
		pNewObject->SetNext(g_Device.m_pRenderObjectList_Head); 
		g_Device.m_pRenderObjectList_Head = pNewObject; 
	}

	return pNewObject;
}
Пример #2
0
bool CD3D_Device::DestroyRenderObject(CRenderObject* pObject)
{
	if (pObject == g_Device.m_pRenderObjectList_Head) {	// Remove the sucka from the Render Object List...
		g_Device.m_pRenderObjectList_Head = pObject->GetNext(); }
	else {
		CRenderObject* pPrevObject = g_Device.m_pRenderObjectList_Head;
		while (pPrevObject->GetNext() && pPrevObject->GetNext() != pObject) {
			pPrevObject = pPrevObject->GetNext(); }
		if (pPrevObject->GetNext()) {
			pPrevObject->SetNext(pPrevObject->GetNext()->GetNext()); }
		else { assert(0); return false; } }		// It's not in the list!?!

	delete pObject;								// Ok, now delete the sucka...

	return true; 
}
Пример #3
0
// Creates the requested Render Object and returns to the Engine...
CRenderObject* CD3D_Device::CreateRenderObject(CRenderObject::RENDER_OBJECT_TYPES ObjectType)
{
	CRenderObject* pNewObject = NULL;			// Create the Sucka...
	switch (ObjectType)
	{
	case CRenderObject::eDebugLine :
		LT_MEM_TRACK_ALLOC(pNewObject = new CDIDebugLine(),LT_MEM_TYPE_RENDERER);
		break;
	case CRenderObject::eDebugPolygon :
		LT_MEM_TRACK_ALLOC(pNewObject = new CDIDebugPolygon(),LT_MEM_TYPE_RENDERER);
		break;
	case CRenderObject::eDebugText :
		LT_MEM_TRACK_ALLOC(pNewObject = new CDIDebugText(),LT_MEM_TYPE_RENDERER);
		break;
	case CRenderObject::eRigidMesh :
		LT_MEM_TRACK_ALLOC(pNewObject = new CD3DRigidMesh(),LT_MEM_TYPE_RENDERER);
		break;
	case CRenderObject::eSkelMesh :
		LT_MEM_TRACK_ALLOC(pNewObject = new CD3DSkelMesh(),LT_MEM_TYPE_RENDERER);
		break;
	case CRenderObject::eVAMesh :
		LT_MEM_TRACK_ALLOC(pNewObject = new CD3DVAMesh(),LT_MEM_TYPE_RENDERER);
		break;
	case CRenderObject::eNullMesh :
		LT_MEM_TRACK_ALLOC(pNewObject = new CDIModelDrawable,LT_MEM_TYPE_RENDERER);
		break;
	default :
		return NULL; break;
	}

	if (pNewObject)
	{
		// Add it to the Render Object List...
		pNewObject->SetNext(g_Device.m_pRenderObjectList_Head);
		g_Device.m_pRenderObjectList_Head = pNewObject;
	}
	return pNewObject;
}
Пример #4
0
bool CD3D_Device::DestroyRenderObject(CRenderObject* pObject)
{
	if (pObject == g_Device.m_pRenderObjectList_Head)
	{
		// Remove the sucka from the Render Object List...
		g_Device.m_pRenderObjectList_Head = pObject->GetNext();
	}
	else
	{
		if (!g_Device.m_pRenderObjectList_Head)
		{
			// It's not in the list!?!
			//assert(0); // Note : This really should assert, but this happens VERY frequently and doesn't seem to be causing any problems
			return false;
		}
		CRenderObject* pPrevObject = g_Device.m_pRenderObjectList_Head;
		while (pPrevObject->GetNext() && pPrevObject->GetNext() != pObject)
		{
			pPrevObject = pPrevObject->GetNext();
		}
		if (pPrevObject->GetNext())
		{
			pPrevObject->SetNext(pPrevObject->GetNext()->GetNext());
		}
		else
		{
			// It's not in the list!?!
			assert(0);
			return false;
		}
	}

	delete pObject;								// Ok, now delete the sucka...

	return true;
}