Plugging own object types into the engine

View previous topic View next topic Go down

Plugging own object types into the engine

Post  matt on Sat Oct 11, 2008 11:18 am

I'd like to add an own object type to the engine but still use the engines features like physics integration. sio2interactive, do you have any suggestions / "best practises" how I could proceed?

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: Plugging own object types into the engine

Post  sio2interactive on Sat Oct 11, 2008 4:27 pm

Can you give me a little bit more info on what type you are trying to integrate so I can evaluate what is the best approach...
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: Plugging own object types into the engine

Post  matt on Sat Oct 11, 2008 5:12 pm

Sure. I have an own animated mesh file format. It's not supported by Blender, so I cannot add such entities in a Blender scene. (In fact, it's one of those dynamically added objects again, I don't need a Blender scene at all). I guess it would be okay for me if I could create a SIO2object from scratch, assign physics properties etc., but handle e.g. rendering myself. I guess some kind of SIO2custom object would be great which allows assigning callbacks for e.g. rendering.

(NB: I read your reasons why you went for C and I can understand your decision, but in such cases, I love inheritance, polymorphism,... ;-))

Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: Plugging own object types into the engine

Post  sio2interactive on Sat Oct 11, 2008 9:03 pm

Basically a SIO2object is a VBO, since its animated that what I would do:

1. Export my whole animation sequence as an optimized VBO and assign the unsigned char * data to SIO2object->buf, and enter the necessay vbo offsets (vbo_offset). Then I would use SIO2vertexgroup for the frames, that basically only include the indices that you need to render that frame. After that its really easy to just write a simple function and go search the appropriate vertex group for a specific frame. Basically what you do here is simply fill in the data to the SIO2object structure & SIO2vertexgroup, so you don't have to handle the clipping & rendering manually...

Check out in the code how the loading process occur, basically I design the sequence and the SIO2object, SIO2vertexgroup & SIO2material having in mind that other file format might comes in so it should be pretty easy. In addition you can add a custom load callback on the .sio2 like this:

Code:


...
void customload( SIO2stream *_SIO2stream )
...


sio2->_SIO2resource->_SIO2resourcecustomload = customload;


Like that you can add extra files inside the archive (.sio2) and get control over the binary stream when such resource is encountered by the extract function. After that you can easily use the sio2Stream methods to load everything that you want. (if you haven't notice basically SIO2stream is the same as FILE but all done in memory so basically alot faster... no need to read from the disk... well only once and 1 chunk Wink )

If you need more info lemme know.
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: Plugging own object types into the engine

Post  matt on Mon Oct 27, 2008 3:33 pm

sio2interactive wrote:Export my whole animation sequence as an optimized VBO and assign the unsigned char * data to SIO2object->buf, and enter the necessay vbo offsets (vbo_offset). Then I would use SIO2vertexgroup for the frames, that basically only include the indices that you need to render that frame. After that its really easy to just write a simple function and go search the appropriate vertex group for a specific frame. Basically what you do here is simply fill in the data to the SIO2object structure & SIO2vertexgroup, so you don't have to handle the clipping & rendering manually...

The problem is that I interpolate keyframes, so the vertex data changes with every frame. What's the best approach to integrate this into SIO2? Regenerating a VBO each frame sounds pretty expensive to me, but currently I do not see any other approach to modify the vertex data once it was sent to the graphics card.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: Plugging own object types into the engine

Post  sio2interactive on Mon Oct 27, 2008 5:24 pm

Hummmmmm lemme think about it but, interpolating the keyframe is probably more expensive on a large scale than precalculate your VBO...
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: Plugging own object types into the engine

Post  exavi on Tue Oct 28, 2008 1:41 pm

I've been reading the iPhone SDK docs and I didn't understood at all if it is possible to access to the iPhone filesystem the way we do in osx/linux/windows to save/read files through our programs/games...

They say something about that iPhone apps can read or write to the Docs folder for opening and saving stuff but there's no much info about it... they also say something about saving in the library folder our App settings but same here...

Is there any way to do this? In this case, is there any way to do this with SIO2 functions?


just in case I didn't have been clear, what I mean is, I am working on an obj file loader, I've managed to load it inside the OpenGL|ES template but now I want to be able to open files from the iphone app instead of plugging them inside the xcode project and hitting compile & run...

exavi

Posts : 37
Join date : 2008-10-21

View user profile

Back to top Go down

Re: Plugging own object types into the engine

Post  sio2interactive on Tue Oct 28, 2008 5:06 pm

Well you can always use the sio2Stream passing 0 to the _rel (relative) variable to use an absolute path, but I don't suggest you to do that... cuz every time you are going to need to go with ssh or sftp to upload and update your file to your device, you'd better add it to the .app and use a relative path to load it. In addition, if you want you app. to be distributed, or even making it to the app. store you need to provide 1 .app, there's not "installation" program for iphone Wink

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: Plugging own object types into the engine

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