www.jpct.net

jPCT-AE - a 3d engine for Android => Bugs => Topic started by: Lobby on February 10, 2014, 12:04:11 AM

Title: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 10, 2014, 12:04:11 AM
Hello, I tried to get an overlay to show just a part of the source texture by using the method setSourceCoordinates(). Unfortunately, this method seems to have no effect at all, it just doesn't matter what parameters I use (while other methods like setNewCoordinates() work properly).
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 10, 2014, 01:26:19 PM
Ok, it's not a bug, but the documentation forgot to mention that I have to use the Overlay constructor with parameter modifyUV set to true :'( .
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 10, 2014, 03:00:27 PM
By the way, would be nice to use float values as source coordinates for better accuracy.
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: EgonOlsen on February 10, 2014, 09:17:53 PM
You are right in both cases. I'll update the docs and change the parameters to float for the next release. Do you need these floats now?
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 10, 2014, 09:58:46 PM
Thank you :)

Quote from: EgonOlsen on February 10, 2014, 09:17:53 PMDo you need these floats now?

Would be nice to get them as soon as possible.
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: EgonOlsen on February 10, 2014, 10:01:12 PM
Ok, here you go: http://jpct.de/download/beta/jpct_ae.jar (http://jpct.de/download/beta/jpct_ae.jar) and http://jpct.de/download/beta/jpct.jar (http://jpct.de/download/beta/jpct.jar)
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 10, 2014, 10:18:43 PM
Thanks, great stuff
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 14, 2014, 08:55:35 PM
May I suggest to add a method to set the four uv coords manually or at least to set a rotated source rectangle? I want to rotate a background that is an overlay but to rotate the whole overlay is a bad solution I think (therefore the overlay would have to be bigger than the screen).

I hope it doesn't matter that I recycle this thread.
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: EgonOlsen on February 15, 2014, 09:25:16 AM
You could get the Object3D from the Overlay and assign a texture matrix to it that does the rotation...if that's what you meant.
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 15, 2014, 02:12:21 PM
Thank you, that's a working work around. However, now I have to do some confusing calculations for the matrix and I'm not sure whether an extended setSourceCoordinates() method would be easier to implement.

Something other, why SimpleVector has no SimpleVector calcScalarMul(float scalar) method?
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: EgonOlsen on February 15, 2014, 08:30:14 PM
Quote from: Lobby on February 15, 2014, 02:12:21 PM
Thank you, that's a working work around. However, now I have to do some confusing calculations for the matrix and I'm not sure whether an extended setSourceCoordinates() method would be easier to implement.

Something other, why SimpleVector has no SimpleVector calcScalarMul(float scalar) method?
I see your point, but i prefer the matrix solution. It's more flexible and this is a very special case anyway. About the calcScalarMul()...no idea. I guess i never needed it and no one ever requested it. Want it? Need it?
Title: Re: Overlay.setSourceCoordinates() has no effect
Post by: Lobby on February 16, 2014, 11:13:27 AM
Sure, no one really needs a calcScalarMul-method as some lines more can erase it's functionality. The point is, that in fast writing something I would prefer the short form with calc* and whenever I do this I notice this inconsistency.