Ejemplo n.º 1
0
StaticMesh* GraphicsEngineImp::CreateStaticMesh(string filename, D3DXVECTOR3 pos, Material* material)
{
	StaticMesh* mesh = new StaticMesh(pos, filename);

	// if it is in memory dont put it on another thread.
	if(!this->useLoadingThread && GetResourceManager()->HasMeshStripsResource(filename.c_str()))
	{
		bool success = mesh->LoadFromFile(filename);
		if(success)
		{
			this->dx->CreateStaticMesh(mesh);
		}


		MaloW::Array<MeshStrip*>* strips = mesh->GetStrips();
		for(unsigned int i = 0; i < strips->size(); i++)
		{
			strips->get(i)->SetMaterial(material);
			
			if(i+1 < strips->size())
			{
				material = new Material(material);
			}
		}
	}
	else
	{
		LoadMeshEvent* re = new LoadMeshEvent(filename, mesh, NULL, material);
		this->PutEvent(re);
	}

	return mesh;
}
Ejemplo n.º 2
0
StaticMesh* GraphicsEngineImp::CreateStaticMesh(string filename, D3DXVECTOR3 pos, const char* billboardFilePath, float distanceToSwapToBillboard)
{
	StaticMesh* mesh = new StaticMesh(pos, filename, billboardFilePath, distanceToSwapToBillboard);
	
	// if it is in memory dont put it on another thread.
	if(!this->useLoadingThread && GetResourceManager()->HasMeshStripsResource(filename.c_str()))
	{
		bool success = mesh->LoadFromFile(filename);
		if(success)
		{
			this->dx->CreateStaticMesh(mesh);
		}
	}
	else
	{
		LoadMeshEvent* re = new LoadMeshEvent(filename, mesh, NULL, NULL);
		this->PutEvent(re);
	}

	return mesh;
}