Author Topic: Overlay.setSourceCoordinates() has no effect  (Read 12608 times)

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Overlay.setSourceCoordinates() has no effect
« 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).

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Re: Overlay.setSourceCoordinates() has no effect
« Reply #1 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 :'( .
« Last Edit: February 10, 2014, 01:28:27 pm by Lobby »

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Re: Overlay.setSourceCoordinates() has no effect
« Reply #2 on: February 10, 2014, 03:00:27 pm »
By the way, would be nice to use float values as source coordinates for better accuracy.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Overlay.setSourceCoordinates() has no effect
« Reply #3 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?

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Re: Overlay.setSourceCoordinates() has no effect
« Reply #4 on: February 10, 2014, 09:58:46 pm »
Thank you :)

Do you need these floats now?

Would be nice to get them as soon as possible.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Re: Overlay.setSourceCoordinates() has no effect
« Reply #6 on: February 10, 2014, 10:18:43 pm »
Thanks, great stuff

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Re: Overlay.setSourceCoordinates() has no effect
« Reply #7 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Overlay.setSourceCoordinates() has no effect
« Reply #8 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.

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Re: Overlay.setSourceCoordinates() has no effect
« Reply #9 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Overlay.setSourceCoordinates() has no effect
« Reply #10 on: February 15, 2014, 08:30:14 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?

Offline Lobby

  • int
  • **
  • Posts: 66
    • View Profile
    • flowersoft
Re: Overlay.setSourceCoordinates() has no effect
« Reply #11 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.