"Thread.sleep(15)" at jPCT-AE + "getTexture"

Started by mrsalomao, March 02, 2012, 08:49:19 AM

Previous topic - Next topic

mrsalomao

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!

EgonOlsen

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.

mrsalomao

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 :)

EgonOlsen

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.

mrsalomao