有没有一种方法导入3D模型导入Android的? [英] Is there a way to import a 3D model into Android?
本文介绍了有没有一种方法导入3D模型导入Android的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能(在3DS MAX为例)创建一个简单的3D模型,然后将其导入到Android不知何故?我在Eclipse中使用Android插件,如果这是任何意义。
Is it possible to create a simple 3D model (for example in 3DS MAX) and then import it to Android somehow? I work in Eclipse with Android plugin, if that's of any importance.
推荐答案
这就是我得到了:
- 在我使用谷歌的APIDemos为出发点 - 有在那里旋转的立方体,每一个指定的两个数组:顶点和索引 。
- 我已经生成使用搅拌机我的模型并将其导出为关闭文件 - 那就是列出了所有顶点的文本文件,然后在这些顶点方面面临(索引几何)
- 然后,我创建了一个简单的C ++应用程序,采取了关闭,并将其写入为包含数组(一个顶点,一个用于索引)两大XMLS
- 在这些XML文件然后复制到RES /价值观,这样,我可以指定数据它们包含到数组是这样的:
INT顶点[] = context.getResources()getIntArray(R.array.vertices);
- 在我还需要手动更改面的数量在这里可以得出:
gl.glDrawElements(GL10.GL_TRIANGLES,212 * 6,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
- 你可以找到关文件的顶部该号码(在这种情况下,212)
- I've used Google's APIDemos as a starting point - there are rotating cubes in there, each specified by two arrays: vertices and indices.
- I've build my model using Blender and exported it as OFF file - it's a text file that lists all the vertices and then faces in terms of these vertices (indexed geometry)
- Then I've created a simple C++ app that takes that OFF and writes it as two XMLs containing arrays (one for vertices and one for indices)
- These XML files are then copied to res/values and this way I can assign the data they contain to arrays like this:
int vertices[] = context.getResources().getIntArray(R.array.vertices);
- I also need to manually change the number of faces to be drawn in here:
gl.glDrawElements(GL10.GL_TRIANGLES, 212*6, GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
- you can find that number (212 in this case) on top of the OFF file
在这里你可以找到我的项目页面,该页面使用此解决方案:
Here you can find my project page, which uses this solution:
HTTP://$c$c.google.com/p/vsiogap3d/
这篇关于有没有一种方法导入3D模型导入Android的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文