简体   繁体   English

将Java(或JavaScript)文件转换为3D模型(最好是OBJ)

[英]Converting a Java (or a javascript) file to a 3d model (preferably OBJ)

Alrighty, so I have some models from this 3d program called techne (for minecraft). 好吧,所以我有一些来自3d程序的模型,称为techne(适用于Minecraft)。 I can export 3d models from Techne to .java or .js files 我可以将3d模型从Techne导出到.java或.js文件

The .js files look somethign like this: .js文件看起来像这样:

var body1 = new Model();
body1.addBox("body1", -8, 20, 0, 16, 16, 23, 0, 30);
body1.setPosition(0, 0, 0);
body1.setRotation(0, 0, 0);

and so on and so forth. 等等等等。 My question is, how do I convert a .java or .js (or a .tcn [Techne format]) into a .obj file 我的问题是,如何将.java或.js(或.tcn [技术格式])转换为.obj文件

Here is Techne: http://techne.zeux.me/Techne 这是Techne: http//techne.zeux.me/Techne

Is there any sort of Java 3d model viewer which can open such files, and allow me to export them? 是否有可以打开此类文件并允许我导出这些文件的Java 3d模型查看器?

Searches on the interweb have only yielded me info about going from a 3d obj to Java, but not the other way around 在interweb上进行的搜索仅向我提供了有关从3d obj到Java的信息,但没有反过来

A sample .js file: http://goo.gl/NGDeoE A sample .java file: http://goo.gl/EaqqLm 样本.js文件: http://goo.gl/NGDeoEhttp://goo.gl/NGDeoE样本.java文件: http://goo.gl/EaqqLmhttp://goo.gl/EaqqLm

Thanks so much! 非常感谢! Hope to hear from some one soon :) ~MT 希望很快能收到您的回音:)〜MT

OBJ format doesn't make a lot of sense for this kind of data because what you have is a bunch of transformations (coordinates) for a couple of identical objects(cubes) inlined in the source code. OBJ格式对于此类数据没有多大意义,因为您拥有的是一堆针对源代码中内联的几个相同对象(多维数据集)的转换(坐标)。 OBJ format doesn't support multiply repetition of the same geometry(only vertices) so it will have overhead. OBJ格式不支持相同几何图形的乘法重复(仅顶点),因此会产生开销。 So to make proper converter you must first decide what you want to do with this data and it won't be one solution for all cases. 因此,要制造合适的转换器,您首先必须决定要对这些数据进行什么处理,但这并不是所有情况下的一种解决方案。 If you want to import this data to the 3d editor like Blender or 3Ds MAX it makes sense to weld all cubes together and remove invisible sides, make a texture atlas. 如果要将这些数据导入到Blender或3Ds MAX之类的3d编辑器中,将所有多维数据集焊接在一起并除去不可见的面,则可以制作纹理图集。

OBJ format is really simple and intended to be human readable and with those source files that you shown it won't take a lot of time to write proper exporter on JS or JAVA tuned for your needs. OBJ格式确实非常简单,并且易于阅读,并且使用您显示的那些源文件,无需花费很多时间就可以根据需要调整JS或JAVA编写适当的导出程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM