Author Topic: How to upload an Object3D?  (Read 2132 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
How to upload an Object3D?
« on: October 17, 2013, 04:15:19 am »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to upload an Object3D?
« Reply #1 on: October 17, 2013, 10:01:51 am »
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.

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: How to upload an Object3D?
« Reply #2 on: October 19, 2013, 09:51:58 am »
I called World.compileAllObjects, but seems none VBOs created immediately, log:

Code: [Select]
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:

Code: [Select]
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)!

« Last Edit: October 19, 2013, 09:55:38 am by kiffa »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to upload an Object3D?
« Reply #3 on: October 19, 2013, 11:18:26 am »
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.