Table of Contents

Sine effect on an Object

Assets

Code

orxObject_CreateFromConfig("Chicken");

Config

[Chicken]
Graphic    = @
Texture    = chicken.png
ShaderList = SineShader
 
[SineShader]
ParamList      = texture # time
time           = time
UseCustomParam = true
Code           = "
void main() {
	#define BENDS 16.0
	#define SINE_HEIGHT 20.0 //less is higher
 
	vec2 p = gl_TexCoord[0].xy;
 
	vec2 sineAffectedP = vec2(p.x, p.y + (sin((p.x*BENDS - (time*2.0))) / SINE_HEIGHT) ); 
	vec4 texFragment = texture2D(texture, sineAffectedP );
 
	gl_FragColor.rgba = vec4(texFragment.rgb, 1.0);
 
}"

Result