java obj,Java - 加载.OBJ文件

I want to be able to get information (like names of sub-components) from an .obj file. Is there a loader out there somewhere to do this? Java3D has an ObjectFile, but the list of methods I've seen makes me think it is not exactly what I want. Would I be better off just parsing the file myself?

Thanks

-Will

解决方案

I wrote a java obj file format loader a few months ago that should easily do what you need.

It's on git hub at;

Note that the README says it's pre-alpha - this is primarily because pretty much nobody else has seen it yet.

It parses most all of the .obj format as well as the .mtl format. Now what it DOES with what it parses... well, I tried to take a SAX like approach. There is a Parser that calls methods on a BuilderInterface with each parsed element. There is a simple sample implementation of the BuilderInterface and also a simple LWJGL viewing app that ties it all together.

It doesn't currently do anything useful with more exotic geometry statements, i.e. anything other than vertices and polygons, in other words it ignores any geometry except for vertices and polygons. It parses and captures .mtl files but the actual viewer doesn't implement anything except very very very simple textures.

I'd more than happy to hear any and all feedback and advice. The license is extremely liberal;

This code was written by myself, Sean R. Owens, sean at guild dot net,

and is released to the public domain. Share and enjoy. Since some

people argue that it is impossible to release software to the public

domain, you are also free to use this code under any version of the

GPL, LPGL, Apache, or BSD licenses, or contact me for use of another

license.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值