[libgdx] 2D Mesh Asset Loading Best Option......

Hi,

I am loading 2d meshes (com.badlogic.gdx.graphics.Mesh) at startup and wanted an asynchronous way of loading them so that my splash screen continues to animate as the meshes are loaded.

I don’t think the current AssetManager class supports loading 2d meshes so from your experience what would be the best option for doing this task:

  1. creating a new asset loader for AssetManager
  2. loading the meshes in a separate thread
  3. Other option you know about

You can see a solution here-

http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=5727&p=27435&hilit=assetmanager+mesh+load#p27435

Thanks for the reply, the link provided was interesting but I should clarify I am not reading a file from disk but am actually algorithmically generating the meshes i.e.:


		float[] meshCoords = new float[num_segments *2 *3  *7];
		
		//array for vertice triangles 
		for(int ii = 0; ii < num_segments; ii++) 
		{ 
			.....
                        ...
		} 
	
		Mesh myMesh = new Mesh(VertexDataType.VertexArray, false, meshCoords.length, 0,
				new VertexAttribute(VertexAttributes.Usage.Position, 3, "a_position"),
				new VertexAttribute(VertexAttributes.Usage.Color, 4, "a_color"));          
		
		myMesh.setVertices(meshCoords);   
		return myMesh;

Is is still possible to use the AssetManager interface to load generated assets like these meshes asynchronously because in the example you have linked and all other asset loaders in Libgdx source they seem to be loading a file into memory using a FileResolver meaning i would have to pass in an asset location to the asset manager load() function(which is not applicable in my case), right?