Author Topic: "Thread.sleep(15)" at jPCT-AE + "getTexture"  (Read 1452 times)

Offline mrsalomao

  • byte
  • *
  • Posts: 3
    • View Profile
"Thread.sleep(15)" at jPCT-AE + "getTexture"
« on: March 02, 2012, 08:49:19 am »
Hi guys,

First of all, Egon Olsen, congrats and thanks for this great engine !

I've been messing around with jPCT-AE for a while and all good so far. However there are 2 things I'd like to mention:

1) Here ( http://www.jpct.net/wiki/index.php/Hello_World_for_Android ) when "Thread.sleep(15)" is called, what is it for? I can see it limits the fps to something around 60, but should it be kept there in all cases? What if the framerate is already low? Wouldn't we just be losing framerate to...? save battery life?

2) I couldn't find a way to query for my "Object3D"s currently assigned texture. I could use that info to make a simpler 3ds loader function (I would get the texture name straight from the one assined to my .3ds. Isn't a method like "getTexture" missing?

Thanks a lot in advance!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: "Thread.sleep(15)" at jPCT-AE + "getTexture"
« Reply #1 on: March 02, 2012, 09:40:05 am »
The Thread.sleep() is there as a very basic timing approach, so that the movement isn't too fast. It's not needed and not meant to be used that way in production code. You should replace it with your own timing approach instead.

You can't get a texture from an Object3D, because it an Object3D can have multiple textures. The setTexture()-method sets a texture for all polygons at once, but you can't be sure that this will remain the only texture. You can use the PolygonManager to query for textures of specific polygons. If your objects use only one texture, you can simply query for the texture of polygon 0.

Offline mrsalomao

  • byte
  • *
  • Posts: 3
    • View Profile
Re: "Thread.sleep(15)" at jPCT-AE + "getTexture"
« Reply #2 on: March 02, 2012, 03:55:14 pm »
Wow, thanks, that was an incredibly fast answer.

Nice explanation, I got it. But now I have 2 new small questions:

1 - Can you load multiple UV maps/textures from the same polygon in a .3ds file?

2 - setTransparency(15) is the most opaque you can get in areas with no transparency?

Thanks for your patience hehe :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: "Thread.sleep(15)" at jPCT-AE + "getTexture"
« Reply #3 on: March 02, 2012, 04:12:59 pm »
1) No. 3DS (as well as OBJ) doesn't support this. I usually end up by loading the model twice with different mappings and merge them at runtime.

2) That depends on a setting in Config: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#glTransparencyOffset. The default, legacy settings try to mimic the behaviour of the desktop version's software renderer...for jPCT-AE, it's useful to adjust them to something that gives you a wider range of possible values....like setting the offset to 0 and the multiplier to 1/255 or something like that.

Offline mrsalomao

  • byte
  • *
  • Posts: 3
    • View Profile
Re: "Thread.sleep(15)" at jPCT-AE + "getTexture"
« Reply #4 on: March 02, 2012, 04:38:02 pm »
Ok, I'll try those! Thanks!