Author Topic: Loader.readTextureNamesOBJ(String filename) plz?  (Read 798 times)

Offline efaj

  • byte
  • *
  • Posts: 32
    • View Profile
Loader.readTextureNamesOBJ(String filename) plz?
« on: December 28, 2011, 12:57:28 pm »
Is it possible to get a function like Loader.readTextureNames3DS(String filename) -or at least for what I guess it does- but for OBJ files? I see the OBJ Loader already prints outs the names to the standard output, so I guess it's not that hard. -though maybe lengthy-

I'm writing a function to load an obj as I want simply and shortly, and with my naming rules to auto load the correct textures before the model.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: Loader.readTextureNamesOBJ(String filename) plz?
« Reply #1 on: December 28, 2011, 07:28:42 pm »
A simple mtl parser could do that.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Loader.readTextureNamesOBJ(String filename) plz?
« Reply #2 on: December 28, 2011, 07:33:46 pm »
Yes. That's the reason why i never did this...it's obvious. Just load the .mtl file, scan for lines starting with "map_Kd", collect the rest of the line in a set and you are done.

Offline efaj

  • byte
  • *
  • Posts: 32
    • View Profile
Re: Loader.readTextureNamesOBJ(String filename) plz?
« Reply #3 on: December 29, 2011, 03:55:20 am »
Yes. That's the reason why i never did this...it's obvious. Just load the .mtl file, scan for lines starting with "map_Kd", collect the rest of the line in a set and you are done.
I know, but I was trying to avoid parsing it twice. But oh well, I haven't seen .mtl files to be large.