New Object, Material, Camera, Lamp File Format

View previous topic View next topic Go down

New Object, Material, Camera, Lamp File Format

Post  sio2interactive on Thu Oct 02, 2008 9:16 pm

As Im continuing the development I see alot of problem coming up from the file format for the next revision (v1.2). Binary is cool because its fast but its not really flexible. So I will go for a text format, using similar syntax as C (and honestly look alot like the ID fileformat, except that this one is not sequential ~ well almost Wink ), at the moment the parser performances are pretty good:

Parsing tags (root, token, values, comments etc...): +/- 530 meg per sec.

Parsing tags + Affectation: +/- 150 meg per sec.

This new file format have some good features, basically now you can mix multiple SIO2 structure into 1 file or have (like it is right now) 1 structure per file. The parser is based on dynamic callbacks (and user defined when the root/token is unknown). So that means that you can literally add your own root, token and value and be capable add extra information to any SIO2 structure and use your custom loader (as a callback) to deal with the value you put in. Using this kind of approach the current format & future format will be backward and forward compatible ( v2.0 will still be capable to read v1.0 and vice versa ), which is also kinda cool, it also can execute LUA script at loading time etc... The only thing Im trading with all theses features and flexibility is speed. I didn't test yet against the current file format, put im pretty sure its going to be slower, since at the moment its like EXTREMELY optimized so...

There's an example:

[ my_model.txt ]

Code:

/* Some comments */
script( "SOME LUA SCRIPT COMMANDS HERE" )

/* Some comments */
object( "myobject" )
{
   mass( 16.0 )
   rot( 1.0 2.0 3.0 )
   pos( -100.123 -200 -300.123456 )
   
   material("mymaterial")

   nvert( 3 )

   usenorm( 1 )
   usevcol( 1 )
   useuv0( 1 )
   useuv1( 1 )

   /* vert, normals, vcolor, uv0, uv1 */
   vert( 1.0 2.0 3.0 -1.0 -2.0 -3.0 1 2 3 4 0.0 1.0 0.0 1.0 )
   vert( 1.0 2.0 3.0 -1.0 -2.0 -3.0 1 2 3 4 0.0 1.0 0.0 1.0 )
   vert( 1.0 2.0 3.0 -1.0 -2.0 -3.0 1 2 3 4 0.0 1.0 0.0 1.0 )
}


material("anewmaterial")
{
   diff(1.0 2.0 3.0 4.0)
   tex0( "image/texture0.jpg" )
   tex1( "image/texture1.tga" )
}

etc...

Ok now the question that everyone will ask:

Q:"Yeah well I already have some models that I make work with the previous version are they still good?"
A: Yes they are, simply export them again, properties will not change they will only be expanded along the current version, if you are loading something that doesn't not contain that new property the value will be set automatically to the default one.

So that's about it... If you guys have comments, questions or suggestions lemme know Wink

Cheers,


Last edited by sio2interactive on Fri Oct 03, 2008 2:07 am; edited 3 times in total (Reason for editing : typo...)
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: New Object, Material, Camera, Lamp File Format

Post  matt on Fri Oct 03, 2008 3:58 pm

I like the idea. It makes debugging and editing a bit easier, plus it allows to version-control and diff your exported assets. I'm not sure whether it's available already, but if not, could you please add support for Blenders custom properties that you can add on Blenders Logic panel to your exporter?

Keep up the good work, highly appreciated!
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: New Object, Material, Camera, Lamp File Format

Post  sio2interactive on Sun Oct 05, 2008 5:01 am

Is it really necessary to support blender object custom properties as another dynamic struct attached to the object?

I think it would be more appropriate to write them down as custom token so you can link you can receive the control using a callback to parse them using your own preferred method.

Can someone else please comment on this,

Cheers,
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: New Object, Material, Camera, Lamp File Format

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum