Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 05:41
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AbrahamR, AndrewAMD), 1,278 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Rotate texture ? #437481
02/18/14 11:38
02/18/14 11:38
Joined: Dec 2003
Posts: 1,225
germany
gri Offline OP
Serious User
gri  Offline OP
Serious User

Joined: Dec 2003
Posts: 1,225
germany
hi,

done by changing my.u or my.v we can shift the texture at runtime.

Is there a posibility for rotating too? Like an textureanimated wheel?


"Make a great game or kill it early" (Bruce Shelley, Ensemble Studios)
Re: Rotate texture ? [Re: gri] #437483
02/18/14 11:49
02/18/14 11:49
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
For what purpose?
It can (of course) be done with a shader.

EDIT: Only now see "texture animated wheel". Is a shader an option?

EDIT2: Tested and works:
Code:
my.skill1 += 5*time_step;
my.skill1 %= 360;
my.skill2 = cosv(my.skill1);
my.skill3 = sinv(my.skill1);
mat_rotate.matrix11 = my.skill2;
mat_rotate.matrix12 = -my.skill3;
mat_rotate.matrix21 = my.skill3;
mat_rotate.matrix22 = my.skill2;
...
OutTex = mul(InTex-0.5, matMtl)+0.5;



If you want to have different speeds for different wheels you need to calculate the transformation/ rotation in the vertex shader. You can speed this up by calculating cos and sin in the entity function, save those values in vecSkill41.xy and use those to implement the rotation, for example as follows:

Code:
InTex.xy -= 0.5;
OutTex.x = vecSkill41.x*InTex.x - vecSkill41.y*InTex.y;
OutTex.y = vecSkill41.y*InTex.x + vecSkill41.x*InTex.y;
OutTex.xy += 0.5;



When I think about is, this is probably the better approach in almost all cases.

Last edited by Superku; 02/18/14 12:23.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Rotate texture ? [Re: Superku] #437492
02/18/14 13:16
02/18/14 13:16
Joined: Dec 2003
Posts: 1,225
germany
gri Offline OP
Serious User
gri  Offline OP
Serious User

Joined: Dec 2003
Posts: 1,225
germany

crazy !

thanks Superku


"Make a great game or kill it early" (Bruce Shelley, Ensemble Studios)

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1