How to upload an Object3D?

Started by kiffa, October 17, 2013, 04:15:19 AM

Previous topic - Next topic

kiffa

I want to load models -> compile -> build -> strip -> upload-> virtualize one by one.

But I don't know how to upload an Object3D(as VBO). Is there a  method like TextureManager.prewarm for Object3D?

EgonOlsen

You can call World.compileAllObjects(). That will create VBOs before rendering. You can call it multiple times as it won't touch already processed objects.

kiffa

#2
I called World.compileAllObjects, but seems none VBOs created immediately, log:


10-21 15:44:53.330: I/jPCT-AE(2547): Subobject of object 38/3_bar_6 compiled to indexed fixed point data using 2466/1644 vertices in 32ms!
10-21 15:44:53.330: I/jPCT-AE(2547): Object 38/3_bar_6 compiled to 1 subobjects in 38ms!
10-21 15:44:53.330: I/jPCT-AE(2547): Object '3_bar_6' uses one texture set!


And the VBOs are created when rendering, log:


10-21 15:44:59.220: I/jPCT-AE(2547): Creating buffers...
10-21 15:44:59.220: I/jPCT-AE(2547): VBO created for object '3_bar_6'
10-21 15:44:59.240: I/jPCT-AE(2547): Stored buffer of type 1 on disk (19728 bytes / _vir_0_1085156536_vertices_ib_.dat)!
10-21 15:44:59.250: I/jPCT-AE(2547): Stored buffer of type 1 on disk (19728 bytes / _vir_0_1085156536_normals_ib_.dat)!
10-21 15:44:59.250: I/jPCT-AE(2547): Stored buffer of type 3 on disk (4932 bytes / _vir_0_1085156536_indices_sb_.dat)!
10-21 15:44:59.270: I/jPCT-AE(2547): Stored buffer of type 1 on disk (13152 bytes / _vir_0_1085156536_multiTextures0_ib_.dat)!


EgonOlsen

Well, yes. The actual VBO creation still happens in the render thread, but that shouldn't be that much of an issue. The time consuming parts are all done when compileAllObjects() has run. The rest is just reserve the VBO and make it use the prepared buffers.