add missing shader

This commit is contained in:
Eduardo Bart 2012-01-30 01:27:25 -02:00
parent 7d8d214324
commit 87236ee780
4 changed files with 29 additions and 4 deletions

View File

@ -0,0 +1,25 @@
uniform float opacity; // painter opacity
uniform vec4 color; // painter color
uniform float time; // time in seconds since shader linkage
uniform sampler2D texture; // map texture
varying vec2 textureCoords; // map texture coords
void main()
{
vec4 outColor = texture2D(texture, textureCoords) * opacity;
/*
float refinement = 0;
if(refinement > 0) {
vec4 sum = vec4(0.0, 0.0, 0.0, 0.0);
for(int i=-1;i<=1;++i) {
for(int j=-1;j<=1;++j) {
vec4 pixel = texture2D(texture, textureCoords + vec2(i,j)*(1.0/32.0));
sum += pixel * (1.0/9.0) * pixel.a * (0.5 + (pixel.r + pixel.g + pixel.b)/3.0);
}
}
float factor = refinement*((1.0 + sin(time*2))/2.0);
outColor += sum * sum * factor;
}
*/
gl_FragColor = outColor;
}

View File

@ -33,7 +33,7 @@ public:
BUFFER_MAXSIZE = 16384,
HEADER_POS = 0,
HEADER_LENGTH = 2,
CHECKSUm_position = 2,
CHECKSUM_POS = 2,
CHECKSUM_LENGTH = 4,
DATA_POS = 6,
UNENCRYPTED_DATA_POS = 8

View File

@ -36,7 +36,7 @@ public:
BUFFER_MAXSIZE = 1024,
HEADER_POS = 0,
HEADER_LENGTH = 2,
CHECKSUm_position = 2,
CHECKSUM_POS = 2,
CHECKSUM_LENGTH = 4,
DATA_POS = 6
};

View File

@ -71,7 +71,7 @@ void Protocol::send(OutputMessage& outputMessage)
// set checksum
uint32 checksum = getAdlerChecksum(outputMessage.getBuffer() + OutputMessage::DATA_POS, outputMessage.getMessageSize());
outputMessage.setWritePos(OutputMessage::CHECKSUm_position);
outputMessage.setWritePos(OutputMessage::CHECKSUM_POS);
outputMessage.addU32(checksum);
// set size
@ -107,7 +107,7 @@ void Protocol::internalRecvHeader(uint8* buffer, uint16 size)
void Protocol::internalRecvData(uint8* buffer, uint16 size)
{
memcpy(m_inputMessage.getBuffer() + InputMessage::CHECKSUm_position, buffer, size);
memcpy(m_inputMessage.getBuffer() + InputMessage::CHECKSUM_POS, buffer, size);
if(m_checksumEnabled) {
uint32 checksum = getAdlerChecksum(m_inputMessage.getBuffer() + InputMessage::DATA_POS, m_inputMessage.getMessageSize() - InputMessage::CHECKSUM_LENGTH);