* 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 heatmaster
parent
10b60a3871
commit
4813b7eb4b
@ -1,11 +0,0 @@
|
|||||||
uniform float opacity; // painter opacity
|
|
||||||
uniform vec4 color; // painter color
|
|
||||||
uniform float time; // time in seconds since shader linkage
|
|
||||||
uniform sampler2D tex0; // map texture
|
|
||||||
varying vec2 texCoord; // map texture coords
|
|
||||||
//uniform int itemId; // item id
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_FragColor = texture2D(tex0, texCoord);
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
uniform float opacity; // painter opacity
|
|
||||||
uniform vec4 color; // painter color
|
|
||||||
uniform float time; // time in seconds since shader linkage
|
|
||||||
|
|
||||||
uniform sampler2D tex0; // outfit texture
|
|
||||||
uniform sampler2D tex1; // outfit color mask
|
|
||||||
varying vec2 texCoord; // outfit texture coords
|
|
||||||
|
|
||||||
uniform vec4 headColor;
|
|
||||||
uniform vec4 bodyColor;
|
|
||||||
uniform vec4 legsColor;
|
|
||||||
uniform vec4 feetColor;
|
|
||||||
|
|
||||||
|
|
||||||
vec4 calcOutfitPixel()
|
|
||||||
{
|
|
||||||
vec4 pixel = texture2D(tex0, texCoord);
|
|
||||||
vec4 maskColor = texture2D(tex1, texCoord);
|
|
||||||
|
|
||||||
vec4 outColor = vec4(1.0, 1.0, 1.0, 1.0);
|
|
||||||
if(maskColor.r > 0.1 && maskColor.g > 0.1)
|
|
||||||
outColor = headColor;
|
|
||||||
else if(maskColor.r > 0.1)
|
|
||||||
outColor = bodyColor;
|
|
||||||
else if(maskColor.g > 0.1)
|
|
||||||
outColor = legsColor;
|
|
||||||
else if(maskColor.b > 0.1)
|
|
||||||
outColor = feetColor;
|
|
||||||
|
|
||||||
return pixel * outColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
// optimized to handle antialising
|
|
||||||
vec4 calcOutfitPixel()
|
|
||||||
{
|
|
||||||
vec4 pixel = texture2D(texture, textureCoords);
|
|
||||||
vec4 maskColor = texture2D(maskTexture, textureCoords);
|
|
||||||
const vec4 white = vec4(1,1,1,1);
|
|
||||||
|
|
||||||
float headFactor = 0.0;
|
|
||||||
if(maskColor.r > 0.1 && maskColor.g > 0.1) {
|
|
||||||
headFactor = min(maskColor.r, maskColor.g);
|
|
||||||
|
|
||||||
maskColor.r -= headFactor;
|
|
||||||
maskColor.g -= headFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
float tot = headFactor + maskColor.r + maskColor.g + maskColor.b;
|
|
||||||
vec4 outColor = headFactor * headColor + bodyColor * maskColor.r + legsColor * maskColor.g + feetColor * maskColor.b;
|
|
||||||
if(tot < 1.0)
|
|
||||||
outColor += white * (1.0 - tot);
|
|
||||||
outColor.a = 1.0;
|
|
||||||
|
|
||||||
return pixel * outColor;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_FragColor = calcOutfitPixel();
|
|
||||||
}
|
|
||||||
|
|
@ -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);
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PAINTERSHADERMANAGER_H
|
|
||||||
#define PAINTERSHADERMANAGER_H
|
|
||||||
|
|
||||||
#include "paintershaderprogram.h"
|
|
||||||
|
|
||||||
class PainterShaderManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void init();
|
|
||||||
void terminate();
|
|
||||||
|
|
||||||
PainterShaderProgramPtr createShader();
|
|
||||||
PainterShaderProgramPtr createTexturedFragmentShader(const std::string& shaderFile);
|
|
||||||
|
|
||||||
const PainterShaderProgramPtr& getDrawTexturedProgram() { return m_drawTexturedProgram; }
|
|
||||||
const PainterShaderProgramPtr& getDrawSolidColorProgram() { return m_drawSolidColorProgram; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
PainterShaderProgramPtr m_drawTexturedProgram;
|
|
||||||
PainterShaderProgramPtr m_drawSolidColorProgram;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern PainterShaderManager g_shaders;
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in new issue