#ifdef GL_ES
precision highp float;
#endif
// variables from PIXI
attribute vec2 aVertexPosition;
attribute vec2 aTexturePosition;
uniform mat3 translationMatrix;
// variable for fragment shader
varying vec2 vTextureCoord;
void main() {
// map texture coordinate from UV coordinates
vTextureCoord = aTexturePosition;
gl_Position = vec4((translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
}
uniform sampler2D texture;
varying vec2 vTextureCoord;
void main(void){
gl_FragColor = texture2D(texture, vTextureCoord);
}
void main(){
// get current pixel coordinate
vec2 st = gl_FragCoord.xy/u_resolution.xy;
// put aspect-ration into consideration
st.y *= u_resolution.y/u_resolution.x;
float t = u_time*0.5;
// calculate noise
float df = 1.0;
df = mix(hex(st,t),hex(st,t+1.),fract(t));
df += snoise(vec3(st*75.,t*0.1))*0.03;
gl_FragColor = vec4(mix(vec3(0.),vec3(1.),step(0.7,df)),1.0);
}
Linear
Ease in-out
Sine-in
Linear
Quadratic
Exponential
class NetworkExampleMessage extends Net.NetData {
positionX: number;
positionY: number;
rotation: number;
loadFromStream(reader: Net.NetReader) {
this.positionX = reader.readFloat();
this.positionY = reader.readFloat();
this.rotation = reader.readFloat();
}
saveToStream(writer: Net.NetWriter) {
writer.writeFloat(this.positionX);
writer.writeFloat(this.positionY);
writer.writeFloat(this.rotation);
}
getDataLength() {
return 8 + 8 + 8;
}
}
Client
Server
Client
Server
Client (lag = 0)
Client (lag = 500 ms)
Server
Client 25% packet loss
Client 500ms lag + 75% packet loss
Server
Client
Server
Client
Server