3D model support

I just tried Jame’s extensions with a MD2 with animation (got it from http://www.derschmale.com/2008/08/14/wick3d-source-available-md2-animated-model-demo/) and it mostly works to run animations. It needs some work, and the biggest dragback I see is that it’s MD2 which is a very old format. I personally love the idea of being able to have a 3D object running/jumping/turning in a 2d world like a side scroller; it’s the best of both worlds.

I’m currently working on some 3d model loaders for Cocos2dx 2.14. I got most of the things running nice and smooth. Currently my loader supports: OBJ, MD2 and MD5 models with normal mapping and specular mapping. I need to cleanup my code a little bit and if you guys have any interest of them I can contribute to the idea of bringing 3D to cocos. I also think that that there should be no problems making a 2.5D game (or even full 3D one ) with cocos2d-x. Here are some screenshots of some MD5 models running full 60fps on an iphone 4.

(EDIT: As it turned out while taking the screenshot on the Makron’s model the frames dropped to 50 on the second screenshot, its because the model got some parts offscreen hence the frame dropping)

Also to make a not on the Hell Knight model i am missing the saliva texture, so it uses the body image and looks weird.

To make a note about the engine. I didn’t make any changes on the engine itself. All of the loaders are extending the CCNode and displaying the data in the draw() method. So it can just be an extension with no actual effect on the engine itself. Also the shaders are loaded from resources in the init().

Dimitar, it’s look very good! Can you show your sources? :slight_smile:

I can show you some very WIP things atm. There are some things to be done, this is only a quick test. For once I do not free memory after the allocations (I know its lame, but I’m lazy :slight_smile: ) so please do not use this in a live project. And since I posted screenshots from the MD5 loader, here is a sample project that uses it.

I’ve adjusted the project for iOS, OSX and Linux. I left the other system projects for usability.

* It seems i cannot attach the zip file here. So I uploaded it on my server. Im posting a link:
http://mmmedia.info/wp-content/uploads/2013/11/3DLoader.zip

@Dimitar Dimitrov, thank you! I’ll try to see the code the next few days and maybe give a small feedback :slight_smile:

I modded the CCSprite3D classes and associated files for Cocos2d-x 3.0beta and got it mostly working again, but the problem is that I cannot figure out how to get the sprite3D to display in front of it’s sibling layers & nodes, it is always in the background. My guess is that it has something to do with OpenGL rendering order, but that is mostly black magic to me.

Attached is a sample project (minus the “cocos2d” folder) generated from the create_project.py tool of Cocos2d-x 3.0beta. The only change to the cocos2d libraries that you need to make is in CCNode.h, you must add “virtual” before “void transform();”, about line 1170, as the Sprirt3D class overrides it (might be the source of the issue?).

If anyone can figure it out, I would greatly appreciate it.