Cocos2d-x Study Notes 1 Sprite3D, cocos2d-xsprite3d
1 FBX is a common export format, which can be exported through maya or max.
2File formats
1) obj: obj is a default export format that can be exported by max or maya without any conversion. However, it does not support animation export.
2) The c3t file is a Json format file generated after the FBX model file is converted. The c3t format is used to facilitate you to view model data and compare the version, since the c3t file is in Json format, the file size is large and the loading speed is slow. It is not recommended in actual games.
3) c3b: c3b is a binary file. The data content is the same as that of c3t files. The difference is that c3b files are small in size and can be loaded quickly. Therefore, it is recommended to be used in actual game development.
C3t and c3b are obtained after secondary conversion through the FBX model file.
3 Max export FBX format, and then use * \ cocos2d-x-3.3rc0 \ tools \ fbx-conv \ win \ fbx-conv.exe through FBX_CONV_DIR-a xx. fbx (FBX_CONV_DIR is the complete path of the conversion plug-in xx/fbx-conv).-a in the command indicates that the c3b and c3t files are output simultaneously, you can also use-B or-t to output c3b or-c3t files separately. The converted files will be generated to the current directory.
4. Use the following code to implement the 3D genie
Auto tortoise = Sprite3D: create ("tortoise. c3b "); // create a 3D sprite tortoise-> setScale (0.3f); // set the zooming ratio of the sprite tortoise-> setPosition (Point (visibleSize. width/2, visibleSize. height/2); addChild (tortoise); // create an animation auto animation = Animation3D: create ("tortoise. c3b "); if (animation) {auto animate = Animate3D: create (animation); animate-> setSpeed (2.0f ); // set the animation playback speed tortoise-> runAction (RepeatForever: create (animate ));}