Texture transformation

About advanced scenes, and the Thyme scripting language used in Algodoo.

Texture transformation

Postby Kilinich » Sun Dec 02, 2012 9:53 pm

I need it for my scene, maybe someone needs it too:

Rating: rated 5.6
Filesize: 18.09 kB
Comments: 1
Ratings: 2
download


Code: Select all
Scene.my.tmTrans := (tm, ang, shift) => {
  sin_a := math.sin(ang);
  cos_a := math.cos(ang);
  m1 := [[tm(0),tm(1)], [tm(3),tm(4)]];
  m2 := [[cos_a, sin_a], [-sin_a, cos_a]];
  mx := [[m1(0)(0)*m2(0)(0) + m1(0)(1)*m2(1)(0), m1(0)(0)*m2(0)(1) + m1(0)(1)*m2(1)(1)],
         [m1(1)(0)*m2(0)(0) + m1(1)(1)*m2(1)(0), m1(1)(0)*m2(0)(1) + m1(1)(1)*m2(1)(1)]];
  sx := [shift(0)*mx(0)(0) + shift(1)*mx(0)(1), shift(0)*mx(1)(0) + shift(1)*mx(1)(1)];
  [mx(0)(0), mx(0)(1), tm(2)+sx(0), mx(1)(0), mx(1)(1), tm(5)+sx(1), tm(6), tm(7), tm(8)]
};
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests