Author Topic: Scaling issue  (Read 883 times)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Scaling issue
« on: January 09, 2013, 04:14:45 pm »
Hi, I wanted to scale object in custom factor x and factor y, but I found only scale(float factor) which I think it is scaling factor x and y equally. Is there any simply function to do factor x and y scaling? or I have to do it from ground up by multiplying the matrix?
« Last Edit: January 09, 2013, 04:21:00 pm by kkl »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Scaling issue
« Reply #1 on: January 09, 2013, 04:28:36 pm »
This is not so simple. If you use default shader and calculation of normals, lighting will be wrong (because non orthogonal transformation). Maybe will works scale in shader, but I do not test it.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Scaling issue
« Reply #2 on: January 09, 2013, 05:03:04 pm »
Should the new scaling be static or dynamic?

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Scaling issue
« Reply #3 on: January 09, 2013, 05:15:07 pm »
Both... On one side, I would like to scale a plane from square to rectangle shape. I guess this would be the static one. On the other side, I want to scale 3D object dynamically to create sort of cartoon effect (e.g. ball bouncing effect). How shall I do it?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Scaling issue
« Reply #4 on: January 09, 2013, 06:04:07 pm »
You can tweak the rotation matrix manually. As Thomas has mentioned, this might cause the lighting calculations to become slightly wrong, but in most cases, this shouldn't be an issue. For static scaling, you do it in the same way, then make the change permanent by calling rotateMesh() and clear the rotation matrix afterwards (and call build()).

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Scaling issue
« Reply #5 on: January 10, 2013, 01:35:10 pm »
I just tried the static scaling... It worked!! But I haven't go through the dynamic scaling yet... Will keep you posted. Thanx ;)