Runtime loading of .OBJ meshes

Share your ZGE-development tips and techniques here!

Moderator: Moderators

User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Kjell wrote:Anyway, it does make you wonder how significant the performance penalty of FileMoveData's ( silly ) char to float conversion is in the entire overhead of the call.
Is it possible to make char-to-float conversion faster? Or what about to support char type in ZGE? Another improvement would be accessing the loaded file as an array - e.g. File would (optionally) take a 1-dimensional array as property and set its "start" to memory with imported file + SizeDim1 to the length of the file on Read FileAction. Is there some restriction for dimensions of arrays?
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Good suggestions Rado1, I'll try to implement that array idea. Please remind me if it doesn't appear soon.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I took some time to test this right away.

Download the beta again.

See attached project. It currently only works with Arrays of integer type but we could add support for strings to read a text file directly into an array of string. And it only supports reading, but writing could be supported as well. Anyway, please try this and see if speed improves!
Attachments
Temp.zgeproj
(718 Bytes) Downloaded 773 times
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ville, this is really useful improvement! Attached, you will find a new version of obj loader using array access to the loaded files. Its performance improved in average by 28% on Windows and 31% on relatively slow Android mobile. Original, string-based versions of the obj loader were 40-50% slower.
Attachments
obj_loader_008.zgeproj
faster obj loader
(19.67 KiB) Downloaded 834 times
Post Reply