Skip to content

Commit eba1743

Browse files
committed
jshint fixes.
1 parent f47fb7a commit eba1743

5 files changed

Lines changed: 112 additions & 159 deletions

File tree

filters/pixi/.jshintrc

Lines changed: 0 additions & 49 deletions
This file was deleted.

filters/pixi/AlphaMaskFilter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
PIXI.AlphaMaskFilter = function(texture)
1616
{
17-
PIXI.AbstractFilter.call( this );
17+
PIXI.AbstractFilter.call(this);
1818

1919
this.passes = [this];
2020
texture.baseTexture._powerOf2 = true;
@@ -26,7 +26,7 @@ PIXI.AlphaMaskFilter = function(texture)
2626
dimensions: {type: '4fv', value:[0,0,0,0]}
2727
};
2828

29-
if(texture.baseTexture.hasLoaded)
29+
if (texture.baseTexture.hasLoaded)
3030
{
3131
this.uniforms.mask.value.x = texture.width;
3232
this.uniforms.mask.value.y = texture.height;
@@ -58,9 +58,7 @@ PIXI.AlphaMaskFilter = function(texture)
5858
' vec4 original = texture2D(uSampler, vTextureCoord);',
5959
' float maskAlpha = texture2D(mask, mapCords).r;',
6060
' original *= maskAlpha;',
61-
//' original.rgb *= maskAlpha;',
6261
' gl_FragColor = original;',
63-
//' gl_FragColor = gl_FragColor;',
6462
'}'
6563
];
6664
};
@@ -88,9 +86,11 @@ PIXI.AlphaMaskFilter.prototype.onTextureLoaded = function()
8886
* @type Texture
8987
*/
9088
Object.defineProperty(PIXI.AlphaMaskFilter.prototype, 'map', {
89+
9190
get: function() {
9291
return this.uniforms.mask.value;
9392
},
93+
9494
set: function(value) {
9595
this.uniforms.mask.value = value;
9696
}

filters/pixi/AsciiFilter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
PIXI.AsciiFilter = function()
1414
{
15-
PIXI.AbstractFilter.call( this );
15+
PIXI.AbstractFilter.call(this);
1616

1717
this.passes = [this];
1818

@@ -45,7 +45,7 @@ PIXI.AsciiFilter = function()
4545
' vec3 col = texture2D(uSampler, floor( uv / pixelSize ) * pixelSize / dimensions.xy).rgb;',
4646

4747
' #ifdef HAS_GREENSCREEN',
48-
' float gray = (col.r + col.b)/2.0;',
48+
' float gray = (col.r + col.b)/2.0;',
4949
' #else',
5050
' float gray = (col.r + col.g + col.b)/3.0;',
5151
' #endif',
@@ -77,9 +77,11 @@ PIXI.AsciiFilter.prototype.constructor = PIXI.AsciiFilter;
7777
* @type Number
7878
*/
7979
Object.defineProperty(PIXI.AsciiFilter.prototype, 'size', {
80+
8081
get: function() {
8182
return this.uniforms.pixelSize.value;
8283
},
84+
8385
set: function(value) {
8486
this.dirty = true;
8587
this.uniforms.pixelSize.value = value;

filters/pixi/NormalMapFilter.js

Lines changed: 102 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -15,124 +15,124 @@
1515
*/
1616
PIXI.NormalMapFilter = function(texture)
1717
{
18-
PIXI.AbstractFilter.call( this );
19-
20-
this.passes = [this];
21-
texture.baseTexture._powerOf2 = true;
22-
23-
// set the uniforms
24-
this.uniforms = {
25-
displacementMap: {type: 'sampler2D', value:texture},
26-
scale: {type: '2f', value:{x:15, y:15}},
27-
offset: {type: '2f', value:{x:0, y:0}},
28-
mapDimensions: {type: '2f', value:{x:1, y:1}},
29-
dimensions: {type: '4f', value:[0,0,0,0]},
30-
// LightDir: {type: 'f3', value:[0, 1, 0]},
31-
LightPos: {type: '3f', value:[0, 1, 0]}
32-
};
33-
34-
35-
if(texture.baseTexture.hasLoaded)
36-
{
37-
this.uniforms.mapDimensions.value.x = texture.width;
38-
this.uniforms.mapDimensions.value.y = texture.height;
39-
}
40-
else
41-
{
42-
this.boundLoadedFunction = this.onTextureLoaded.bind(this);
43-
44-
texture.baseTexture.on("loaded", this.boundLoadedFunction);
45-
}
46-
47-
this.fragmentSrc = [
48-
"precision mediump float;",
49-
"varying vec2 vTextureCoord;",
50-
"varying float vColor;",
51-
"uniform sampler2D displacementMap;",
52-
"uniform sampler2D uSampler;",
53-
54-
"uniform vec4 dimensions;",
55-
56-
"const vec2 Resolution = vec2(1.0,1.0);", //resolution of screen
57-
"uniform vec3 LightPos;", //light position, normalized
58-
"const vec4 LightColor = vec4(1.0, 1.0, 1.0, 1.0);", //light RGBA -- alpha is intensity
59-
"const vec4 AmbientColor = vec4(1.0, 1.0, 1.0, 0.5);", //ambient RGBA -- alpha is intensity
60-
"const vec3 Falloff = vec3(0.0, 1.0, 0.2);", //attenuation coefficients
61-
62-
"uniform vec3 LightDir;",//" = vec3(1.0, 0.0, 1.0);",
63-
64-
65-
"uniform vec2 mapDimensions;",// = vec2(256.0, 256.0);",
66-
67-
68-
"void main(void) {",
69-
"vec2 mapCords = vTextureCoord.xy;",
70-
71-
"vec4 color = texture2D(uSampler, vTextureCoord.st);",
18+
PIXI.AbstractFilter.call( this );
19+
20+
this.passes = [this];
21+
texture.baseTexture._powerOf2 = true;
22+
23+
// set the uniforms
24+
this.uniforms = {
25+
displacementMap: {type: 'sampler2D', value:texture},
26+
scale: {type: '2f', value:{x:15, y:15}},
27+
offset: {type: '2f', value:{x:0, y:0}},
28+
mapDimensions: {type: '2f', value:{x:1, y:1}},
29+
dimensions: {type: '4f', value:[0,0,0,0]},
30+
// LightDir: {type: 'f3', value:[0, 1, 0]},
31+
LightPos: {type: '3f', value:[0, 1, 0]}
32+
};
33+
34+
35+
if(texture.baseTexture.hasLoaded)
36+
{
37+
this.uniforms.mapDimensions.value.x = texture.width;
38+
this.uniforms.mapDimensions.value.y = texture.height;
39+
}
40+
else
41+
{
42+
this.boundLoadedFunction = this.onTextureLoaded.bind(this);
43+
44+
texture.baseTexture.on("loaded", this.boundLoadedFunction);
45+
}
46+
47+
this.fragmentSrc = [
48+
"precision mediump float;",
49+
"varying vec2 vTextureCoord;",
50+
"varying float vColor;",
51+
"uniform sampler2D displacementMap;",
52+
"uniform sampler2D uSampler;",
53+
54+
"uniform vec4 dimensions;",
55+
56+
"const vec2 Resolution = vec2(1.0,1.0);", //resolution of screen
57+
"uniform vec3 LightPos;", //light position, normalized
58+
"const vec4 LightColor = vec4(1.0, 1.0, 1.0, 1.0);", //light RGBA -- alpha is intensity
59+
"const vec4 AmbientColor = vec4(1.0, 1.0, 1.0, 0.5);", //ambient RGBA -- alpha is intensity
60+
"const vec3 Falloff = vec3(0.0, 1.0, 0.2);", //attenuation coefficients
61+
62+
"uniform vec3 LightDir;",//" = vec3(1.0, 0.0, 1.0);",
63+
64+
65+
"uniform vec2 mapDimensions;",// = vec2(256.0, 256.0);",
66+
67+
68+
"void main(void) {",
69+
"vec2 mapCords = vTextureCoord.xy;",
70+
71+
"vec4 color = texture2D(uSampler, vTextureCoord.st);",
7272
"vec3 nColor = texture2D(displacementMap, vTextureCoord.st).rgb;",
7373

7474

75-
"mapCords *= vec2(dimensions.x/512.0, dimensions.y/512.0);",
76-
77-
"mapCords.y *= -1.0;",
78-
"mapCords.y += 1.0;",
75+
"mapCords *= vec2(dimensions.x/512.0, dimensions.y/512.0);",
76+
77+
"mapCords.y *= -1.0;",
78+
"mapCords.y += 1.0;",
7979

80-
//RGBA of our diffuse color
81-
"vec4 DiffuseColor = texture2D(uSampler, vTextureCoord);",
80+
//RGBA of our diffuse color
81+
"vec4 DiffuseColor = texture2D(uSampler, vTextureCoord);",
8282

83-
//RGB of our normal map
84-
"vec3 NormalMap = texture2D(displacementMap, mapCords).rgb;",
83+
//RGB of our normal map
84+
"vec3 NormalMap = texture2D(displacementMap, mapCords).rgb;",
8585

86-
//The delta position of light
87-
//"vec3 LightDir = vec3(LightPos.xy - (gl_FragCoord.xy / Resolution.xy), LightPos.z);",
88-
"vec3 LightDir = vec3(LightPos.xy - (mapCords.xy), LightPos.z);",
89-
//Correct for aspect ratio
90-
//"LightDir.x *= Resolution.x / Resolution.y;",
86+
//The delta position of light
87+
//"vec3 LightDir = vec3(LightPos.xy - (gl_FragCoord.xy / Resolution.xy), LightPos.z);",
88+
"vec3 LightDir = vec3(LightPos.xy - (mapCords.xy), LightPos.z);",
89+
//Correct for aspect ratio
90+
//"LightDir.x *= Resolution.x / Resolution.y;",
9191

92-
//Determine distance (used for attenuation) BEFORE we normalize our LightDir
93-
"float D = length(LightDir);",
92+
//Determine distance (used for attenuation) BEFORE we normalize our LightDir
93+
"float D = length(LightDir);",
9494

95-
//normalize our vectors
96-
"vec3 N = normalize(NormalMap * 2.0 - 1.0);",
97-
"vec3 L = normalize(LightDir);",
95+
//normalize our vectors
96+
"vec3 N = normalize(NormalMap * 2.0 - 1.0);",
97+
"vec3 L = normalize(LightDir);",
9898

99-
//Pre-multiply light color with intensity
100-
//Then perform "N dot L" to determine our diffuse term
101-
"vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);",
99+
//Pre-multiply light color with intensity
100+
//Then perform "N dot L" to determine our diffuse term
101+
"vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);",
102102

103-
//pre-multiply ambient color with intensity
104-
"vec3 Ambient = AmbientColor.rgb * AmbientColor.a;",
103+
//pre-multiply ambient color with intensity
104+
"vec3 Ambient = AmbientColor.rgb * AmbientColor.a;",
105105

106-
//calculate attenuation
107-
"float Attenuation = 1.0 / ( Falloff.x + (Falloff.y*D) + (Falloff.z*D*D) );",
106+
//calculate attenuation
107+
"float Attenuation = 1.0 / ( Falloff.x + (Falloff.y*D) + (Falloff.z*D*D) );",
108108

109-
//the calculation which brings it all together
110-
"vec3 Intensity = Ambient + Diffuse * Attenuation;",
111-
"vec3 FinalColor = DiffuseColor.rgb * Intensity;",
112-
"gl_FragColor = vColor * vec4(FinalColor, DiffuseColor.a);",
113-
//"gl_FragColor = vec4(1.0, 0.0, 0.0, Attenuation);",//vColor * vec4(FinalColor, DiffuseColor.a);",
114-
/*
115-
// normalise color
116-
"vec3 normal = normalize(nColor * 2.0 - 1.0);",
117-
118-
"vec3 deltaPos = vec3( (light.xy - gl_FragCoord.xy) / resolution.xy, light.z );",
109+
//the calculation which brings it all together
110+
"vec3 Intensity = Ambient + Diffuse * Attenuation;",
111+
"vec3 FinalColor = DiffuseColor.rgb * Intensity;",
112+
"gl_FragColor = vColor * vec4(FinalColor, DiffuseColor.a);",
113+
//"gl_FragColor = vec4(1.0, 0.0, 0.0, Attenuation);",//vColor * vec4(FinalColor, DiffuseColor.a);",
114+
/*
115+
// normalise color
116+
"vec3 normal = normalize(nColor * 2.0 - 1.0);",
117+
118+
"vec3 deltaPos = vec3( (light.xy - gl_FragCoord.xy) / resolution.xy, light.z );",
119119
120-
"float lambert = clamp(dot(normal, lightDir), 0.0, 1.0);",
120+
"float lambert = clamp(dot(normal, lightDir), 0.0, 1.0);",
121121
122-
"float d = sqrt(dot(deltaPos, deltaPos));",
122+
"float d = sqrt(dot(deltaPos, deltaPos));",
123123
"float att = 1.0 / ( attenuation.x + (attenuation.y*d) + (attenuation.z*d*d) );",
124124
125125
"vec3 result = (ambientColor * ambientIntensity) + (lightColor.rgb * lambert) * att;",
126126
"result *= color.rgb;",
127127
128128
"gl_FragColor = vec4(result, 1.0);",*/
129129

130-
130+
131131

132-
"}"
133-
];
134-
135-
}
132+
"}"
133+
];
134+
135+
};
136136

137137
PIXI.NormalMapFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
138138
PIXI.NormalMapFilter.prototype.constructor = PIXI.NormalMapFilter;
@@ -144,10 +144,10 @@ PIXI.NormalMapFilter.prototype.constructor = PIXI.NormalMapFilter;
144144
*/
145145
PIXI.NormalMapFilter.prototype.onTextureLoaded = function()
146146
{
147-
this.uniforms.mapDimensions.value.x = this.uniforms.displacementMap.value.width;
148-
this.uniforms.mapDimensions.value.y = this.uniforms.displacementMap.value.height;
147+
this.uniforms.mapDimensions.value.x = this.uniforms.displacementMap.value.width;
148+
this.uniforms.mapDimensions.value.y = this.uniforms.displacementMap.value.height;
149149

150-
this.uniforms.displacementMap.value.baseTexture.off("loaded", this.boundLoadedFunction)
150+
this.uniforms.displacementMap.value.baseTexture.off("loaded", this.boundLoadedFunction);
151151
};
152152

153153
/**
@@ -161,7 +161,7 @@ Object.defineProperty(PIXI.NormalMapFilter.prototype, 'map', {
161161
return this.uniforms.displacementMap.value;
162162
},
163163
set: function(value) {
164-
this.uniforms.displacementMap.value = value;
164+
this.uniforms.displacementMap.value = value;
165165
}
166166
});
167167

@@ -176,7 +176,7 @@ Object.defineProperty(PIXI.NormalMapFilter.prototype, 'scale', {
176176
return this.uniforms.scale.value;
177177
},
178178
set: function(value) {
179-
this.uniforms.scale.value = value;
179+
this.uniforms.scale.value = value;
180180
}
181181
});
182182

@@ -191,6 +191,6 @@ Object.defineProperty(PIXI.NormalMapFilter.prototype, 'offset', {
191191
return this.uniforms.offset.value;
192192
},
193193
set: function(value) {
194-
this.uniforms.offset.value = value;
194+
this.uniforms.offset.value = value;
195195
}
196196
});

src/geom/Matrix.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ Phaser.Matrix.prototype.toArray = function(transpose)
9898
{
9999
if (!this.array)
100100
{
101-
this.array = new PIXI.Float32Array(9);
102-
}
101+
this.array = new PIXI.Float32Array(9);
102+
}
103103

104104
var array = this.array;
105105

0 commit comments

Comments
 (0)