mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
many changes
* Fixes in WIN32 platform * Remove unused files * Make StaticText work more like tibia * Fix WIN32 compilation * Fix regression in framebuffers that caused battle to disappear * Shader fixes for DX9 * Add two new shaders: noise and heat
This commit is contained in:
56
modules/game_shaders/shaders/heat.frag
Normal file
56
modules/game_shaders/shaders/heat.frag
Normal file
@@ -0,0 +1,56 @@
|
||||
uniform sampler2D u_Tex0;
|
||||
varying vec2 v_TexCoord;
|
||||
uniform float u_Time;
|
||||
uniform vec2 u_Resolution;
|
||||
const float PI = 3.1415926535897932;
|
||||
|
||||
// speed
|
||||
const float speed = 0.06;
|
||||
const float speed_x = 0.03;
|
||||
const float speed_y = 0.02;
|
||||
|
||||
// geometry
|
||||
const float intensity = 30.;
|
||||
const int steps = 5;
|
||||
const float frequency = 3.0;
|
||||
const int angle = 7; // better when a prime
|
||||
|
||||
// reflection and emboss
|
||||
const float delta = 100.;
|
||||
const float intence = 1.2;
|
||||
const float emboss = 0.1;
|
||||
|
||||
//---------- crystals effect
|
||||
float col(vec2 coord)
|
||||
{
|
||||
float delta_theta = 2.0 * PI / float(angle);
|
||||
float col = 0.0;
|
||||
float theta = 0.0;
|
||||
for(int i = 0; i < steps; i++) {
|
||||
vec2 adjc = coord;
|
||||
theta = delta_theta*float(i);
|
||||
adjc.x += cos(theta)*u_Time*speed + u_Time * speed_x;
|
||||
adjc.y -= sin(theta)*u_Time*speed - u_Time * speed_y;
|
||||
col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity;
|
||||
}
|
||||
return cos(col);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 p = v_TexCoord, c1 = p, c2 = p;
|
||||
float cc1 = col(c1);
|
||||
|
||||
c2.x += u_Resolution.x/delta;
|
||||
float dx = emboss*(cc1-col(c2))/delta;
|
||||
|
||||
c2.x = p.x;
|
||||
c2.y += u_Resolution.y/delta;
|
||||
float dy = emboss*(cc1-col(c2))/delta;
|
||||
|
||||
c1.x += dx;
|
||||
c1.y += dy;
|
||||
|
||||
float alpha = 1.+dot(dx,dy)*intence;
|
||||
gl_FragColor = texture2D(u_Tex0,c1)*(alpha);
|
||||
}
|
56
modules/game_shaders/shaders/noise.frag
Normal file
56
modules/game_shaders/shaders/noise.frag
Normal file
@@ -0,0 +1,56 @@
|
||||
uniform sampler2D u_Tex0;
|
||||
varying vec2 v_TexCoord;
|
||||
uniform float u_Time;
|
||||
uniform vec2 u_Resolution;
|
||||
const float PI = 3.1415926535897932;
|
||||
|
||||
// speed
|
||||
const float speed = 0.16;
|
||||
const float speed_x = 0.13;
|
||||
const float speed_y = 0.12;
|
||||
|
||||
// geometry
|
||||
const float intensity = 100.;
|
||||
const int steps = 3;
|
||||
const float frequency = 100.0;
|
||||
const int angle = 7; // better when a prime
|
||||
|
||||
// reflection and emboss
|
||||
const float delta = 1000.;
|
||||
const float intence = 10.2;
|
||||
const float emboss = 1.;
|
||||
|
||||
//---------- crystals effect
|
||||
float col(vec2 coord)
|
||||
{
|
||||
float delta_theta = 2.0 * PI / float(angle);
|
||||
float col = 0.0;
|
||||
float theta = 0.0;
|
||||
for(int i = 0; i < steps; i++) {
|
||||
vec2 adjc = coord;
|
||||
theta = delta_theta*float(i);
|
||||
adjc.x += cos(theta)*u_Time*speed + u_Time * speed_x;
|
||||
adjc.y -= sin(theta)*u_Time*speed - u_Time * speed_y;
|
||||
col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity;
|
||||
}
|
||||
return cos(col);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 p = v_TexCoord, c1 = p, c2 = p;
|
||||
float cc1 = col(c1);
|
||||
|
||||
c2.x += u_Resolution.x/delta;
|
||||
float dx = emboss*(cc1-col(c2))/delta;
|
||||
|
||||
c2.x = p.x;
|
||||
c2.y += u_Resolution.y/delta;
|
||||
float dy = emboss*(cc1-col(c2))/delta;
|
||||
|
||||
c1.x += dx;
|
||||
c1.y += dy;
|
||||
|
||||
float alpha = 1.+dot(dx,dy)*intence;
|
||||
gl_FragColor = texture2D(u_Tex0,c1)*(alpha);
|
||||
}
|
@@ -5,9 +5,9 @@ varying vec2 v_TexCoord;
|
||||
void main()
|
||||
{
|
||||
vec4 col = texture2D(u_Tex0, v_TexCoord);
|
||||
float d = u_Time * 2;
|
||||
float d = u_Time * 2.0;
|
||||
col.x += (1.0 + sin(d))*0.25;
|
||||
col.y += (1.0 + sin(d*2))*0.25;
|
||||
col.z += (1.0 + sin(d*4))*0.25;
|
||||
col.y += (1.0 + sin(d*2.0))*0.25;
|
||||
col.z += (1.0 + sin(d*4.0))*0.25;
|
||||
gl_FragColor = col;
|
||||
}
|
||||
|
@@ -8,8 +8,7 @@ const float sampleStrength = 2.2;
|
||||
void main(void)
|
||||
{
|
||||
// some sample positions
|
||||
float samples[10] =
|
||||
float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);
|
||||
float samples[] = { -0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08 };
|
||||
|
||||
// 0.5,0.5 is the center of the screen
|
||||
// so substracting v_TexCoord from it will result in
|
||||
|
Reference in New Issue
Block a user