eslint fixes

This commit is contained in:
Richard Davey 2018-02-16 18:17:51 +00:00
parent e1554c34d6
commit 86f00eeb52
33 changed files with 145 additions and 110 deletions

View file

@ -1,4 +1,5 @@
src/physics/matter-js/lib/
src/physics/matter-js/poly-decomp/
src/polyfills/
src/renderer/webgl/shaders/
src/geom/polygon/Earcut.js

View file

@ -32,6 +32,7 @@ var GridAlign = function (items, options)
var position = GetValue(options, 'position', CONST.TOP_LEFT);
var x = GetValue(options, 'x', 0);
var y = GetValue(options, 'y', 0);
// var centerX = GetValue(options, 'centerX', null);
// var centerY = GetValue(options, 'centerY', null);
@ -43,7 +44,7 @@ var GridAlign = function (items, options)
// If the Grid is centered on a position then we need to calculate it now
// if (centerX !== null && centerY !== null)
// {
//
//
// }
tempZone.setPosition(x, y);

View file

@ -892,8 +892,8 @@ var Camera = new Class({
{
if (out === undefined) { out = new Vector2(); }
//TODO: optimize this with a simple distance calculation:
//https://developer.valvesoftware.com/wiki/Field_of_View
// TODO: optimize this with a simple distance calculation:
// https://developer.valvesoftware.com/wiki/Field_of_View
if (this.billboardMatrixDirty)
{

View file

@ -10,7 +10,7 @@
module.exports = {
BitmapMask: require('./BitmapMask'),
GeometryMask: require('./GeometryMask')
BitmapMask: require('./BitmapMask'),
GeometryMask: require('./GeometryMask')
};

View file

@ -114,76 +114,76 @@ var ParseRetroFont = function (scene, config)
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
ParseRetroFont.TEXT_SET1 = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
/**
* Text Set 2 = !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET2 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ParseRetroFont.TEXT_SET2 = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ';
/**
* Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
ParseRetroFont.TEXT_SET3 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ';
/**
* Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
ParseRetroFont.TEXT_SET4 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789';
/**
* Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789";
ParseRetroFont.TEXT_SET5 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() \'!?-*:0123456789';
/**
* Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.'
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ";
ParseRetroFont.TEXT_SET6 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.\' ';
/**
* Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-'39
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET7 = "AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39";
ParseRetroFont.TEXT_SET7 = 'AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-\'39';
/**
* Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET8 = "0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ParseRetroFont.TEXT_SET8 = '0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ';
/**
* Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'"?!
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!";
ParseRetroFont.TEXT_SET9 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,\'"?!';
/**
* Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET10 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ParseRetroFont.TEXT_SET10 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
/**
* Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()':;0123456789
* @constant
* @type {string}
*/
ParseRetroFont.TEXT_SET11 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789";
ParseRetroFont.TEXT_SET11 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()\':;0123456789';
module.exports = ParseRetroFont;

View file

@ -56,13 +56,13 @@ var ParseXMLBitmapFont = function (xml, xSpacing, ySpacing, frame)
// if (gx + gw > frame.width)
// {
// diff = frame.width - (gx + gw);
// gw -= diff;
// gw -= diff;
// }
// if (gy + gh > frame.height)
// {
// diff = frame.height - (gy + gh);
// gh -= diff;
// gh -= diff;
// }
if (gx < left)

View file

@ -144,6 +144,7 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage,
ctx.save();
ctx.translate(x, y);
ctx.scale(scale, scale);
// ctx.fillRect(0, 0, glyphW, glyphH);
ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH);
ctx.restore();

View file

@ -27,6 +27,7 @@ GameObjectCreator.register('bitmapText', function (config)
var font = GetValue(config, 'font', '');
var text = GetAdvancedValue(config, 'text', '');
var size = GetAdvancedValue(config, 'size', false);
// var align = GetValue(config, 'align', 'left');
var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size);

View file

@ -658,8 +658,8 @@ var Animation = new Class({
return this;
},
// Scale the time (make it go faster / slower)
// Factor that's used to scale time where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc.
// Scale the time (make it go faster / slower)
// Factor that's used to scale time where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc.
/**
* [description]

View file

@ -942,7 +942,7 @@ var ParticleEmitter = new Class({
if (this._frameCounter === this.frameQuantity)
{
this._frameCounter = 0;
this.currentFrame = Wrap(this.currentFrame + 1, 0, this._frameLength);
this.currentFrame = Wrap(this.currentFrame + 1, 0, this._frameLength);
}
return frame;

View file

@ -46,37 +46,37 @@ var Quad = new Class({
// | \
// 1----2
var vertices = [
var vertices = [
0, 0, // tl
0, 0, // bl
0, 0, // br
0, 0, // tl
0, 0, // br
0, 0 // tr
0, 0 // tr
];
var uv = [
var uv = [
0, 0, // tl
0, 1, // bl
1, 1, // br
0, 0, // tl
1, 1, // br
1, 0 // tr
1, 0 // tr
];
var colors = [
var colors = [
0xffffff, // tl
0xffffff, // bl
0xffffff, // br
0xffffff, // tl
0xffffff, // br
0xffffff // tr
0xffffff // tr
];
var alphas = [
var alphas = [
1, // tl
1, // bl
1, // br
1, // tl
1, // br
1 // tr
1 // tr
];
Mesh.call(this, scene, x, y, vertices, uv, colors, alphas, texture, frame);

View file

@ -959,7 +959,8 @@ var Text = new Class({
}
context.save();
//context.scale(resolution, resolution);
// context.scale(resolution, resolution);
if (style.backgroundColor)
{

View file

@ -53,7 +53,8 @@ var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camer
var canvas = src.canvas;
ctx.save();
//ctx.scale(1.0 / resolution, 1.0 / resolution);
// ctx.scale(1.0 / resolution, 1.0 / resolution);
ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY);
ctx.rotate(src.rotation);
ctx.scale(src.scaleX, src.scaleY);

View file

@ -177,7 +177,8 @@ var TileSprite = new Class({
this.updateTileTexture();
scene.sys.game.renderer.onContextRestored(function (renderer) {
scene.sys.game.renderer.onContextRestored(function (renderer)
{
this.tileTexture = null;
this.dirty = true;
this.tileTexture = renderer.createTexture2D(0, gl.LINEAR, gl.LINEAR, gl.REPEAT, gl.REPEAT, gl.RGBA, this.canvasBuffer, this.potWidth, this.potHeight);

View file

@ -20,7 +20,7 @@ var Contains = require('../triangle/Contains');
*/
var TriangleToCircle = function (triangle, circle)
{
// First the cheapest ones:
// First the cheapest ones:
if (
triangle.left > circle.right ||

View file

@ -28,7 +28,7 @@ var ContainsRect = function (rectA, rectB)
return (
(rectB.x > rectA.x && rectB.x < rectA.right) &&
(rectB.right > rectA.x && rectB.right < rectA.right) &&
(rectB.y > rectA.y && rectB.y < rectA.bottom) &&
(rectB.y > rectA.y && rectB.y < rectA.bottom) &&
(rectB.bottom > rectA.y && rectB.bottom < rectA.bottom)
);
};

View file

@ -56,6 +56,7 @@ var MarchingAnts = function (rect, step, quantity, out)
switch (face)
{
// Top face
case 0:
x += step;

View file

@ -18,9 +18,9 @@
var Overlaps = function (rectA, rectB)
{
return (
rectA.x < rectB.right &&
rectA.right > rectB.x &&
rectA.y < rectB.bottom &&
rectA.x < rectB.right &&
rectA.right > rectB.x &&
rectA.y < rectB.bottom &&
rectA.bottom > rectB.y
);
};

View file

@ -25,7 +25,7 @@ var Triangle = require('./Triangle');
*/
var BuildRight = function (x, y, width, height)
{
if (height === undefined) { height = width; }
if (height === undefined) { height = width; }
// 90 degree angle
var x1 = x;

View file

@ -43,4 +43,4 @@ module.exports = {
RIGHT_STICK_H: 2,
RIGHT_STICK_V: 3
};
};

View file

@ -309,7 +309,7 @@ var RandomDataGenerator = new Class({
var a = '';
var b = '';
for (b = a = ''; a++ < 36; b +=~a % 5 | a*3 & 4 ? (a^15 ? 8 ^ this.frac()*(a^20 ? 16 : 4) : 4).toString(16) : '-')
for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-')
{
}

View file

@ -1388,6 +1388,7 @@ var World = new Class({
return this.collideSpriteVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
}
}
// GROUPS
else if (object1.isParent)
{
@ -1404,6 +1405,7 @@ var World = new Class({
return this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
}
}
// TILEMAP LAYERS
else if (object1.isTilemap)
{
@ -1546,7 +1548,8 @@ var World = new Class({
{
if (children[i].body)
{
if (this.collideSpriteVsTilemapLayer(children[i], tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly)) {
if (this.collideSpriteVsTilemapLayer(children[i], tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly))
{
didCollide = true;
}
}

View file

@ -172,19 +172,22 @@ var World = new Class({
var _this = this;
var engine = this.engine;
MatterEvents.on(engine, 'beforeUpdate', function (event) {
MatterEvents.on(engine, 'beforeUpdate', function (event)
{
_this.emit('beforeupdate', event);
});
MatterEvents.on(engine, 'afterUpdate', function (event) {
MatterEvents.on(engine, 'afterUpdate', function (event)
{
_this.emit('afterupdate', event);
});
MatterEvents.on(engine, 'collisionStart', function (event) {
MatterEvents.on(engine, 'collisionStart', function (event)
{
var pairs = event.pairs;
var bodyA;
@ -200,7 +203,8 @@ var World = new Class({
});
MatterEvents.on(engine, 'collisionActive', function (event) {
MatterEvents.on(engine, 'collisionActive', function (event)
{
var pairs = event.pairs;
var bodyA;
@ -216,7 +220,8 @@ var World = new Class({
});
MatterEvents.on(engine, 'collisionEnd', function (event) {
MatterEvents.on(engine, 'collisionEnd', function (event)
{
var pairs = event.pairs;
var bodyA;
@ -480,9 +485,7 @@ var World = new Class({
convertTilemapLayer: function (tilemapLayer, options)
{
var layerData = tilemapLayer.layer;
var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, {
isColliding: true
});
var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, {isColliding: true});
this.convertTiles(tiles, options);
@ -663,7 +666,7 @@ var World = new Class({
var pathPattern = /L?\s*([\-\d\.e]+)[\s,]*([\-\d\.e]+)*/ig;
path.replace(pathPattern, function(match, x, y)
path.replace(pathPattern, function (match, x, y)
{
points.push({ x: parseFloat(x), y: parseFloat(y) });
});

View file

@ -75,7 +75,7 @@ var Collision = {
this.body.collisionFilter.mask = flags;
return this;
},
}
};

View file

@ -68,7 +68,8 @@ var Sleep = {
{
var world = this.world;
MatterEvents.on(this.body, 'sleepStart', function (event) {
MatterEvents.on(this.body, 'sleepStart', function (event)
{
world.emit('sleepstart', event, this);
});
}
@ -96,7 +97,8 @@ var Sleep = {
{
var world = this.world;
MatterEvents.on(this.body, 'sleepEnd', function (event) {
MatterEvents.on(this.body, 'sleepEnd', function (event)
{
world.emit('sleepend', event, this);
});
}

View file

@ -40,6 +40,7 @@ var DrawImage = function (src, camera)
if (this.currentScaleMode !== src.scaleMode)
{
this.currentScaleMode = src.scaleMode;
// ctx[this.smoothProperty] = (source.scaleMode === ScaleModes.LINEAR);
}

View file

@ -338,7 +338,7 @@ var WebGLPipeline = new Class({
*/
flush: function ()
{
if (this.flushLocked) return this;
if (this.flushLocked) { return this; }
this.flushLocked = true;
var gl = this.gl;
@ -348,7 +348,7 @@ var WebGLPipeline = new Class({
var topology = this.topology;
var vertexSize = this.vertexSize;
if (vertexCount === 0)
if (vertexCount === 0)
{
this.flushLocked = false;
return;

View file

@ -183,9 +183,9 @@ var WebGLRenderer = new Class({
this.blendModes.push({ func: [ WebGLRenderingContext.ONE, WebGLRenderingContext.ONE_MINUS_SRC_ALPHA ], equation: WebGLRenderingContext.FUNC_ADD });
}
this.blendModes[1].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.DST_ALPHA ];
this.blendModes[2].func = [ WebGLRenderingContext.DST_COLOR, WebGLRenderingContext.ONE_MINUS_SRC_ALPHA ];
this.blendModes[3].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.ONE_MINUS_SRC_COLOR ];
this.blendModes[1].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.DST_ALPHA ];
this.blendModes[2].func = [ WebGLRenderingContext.DST_COLOR, WebGLRenderingContext.ONE_MINUS_SRC_ALPHA ];
this.blendModes[3].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.ONE_MINUS_SRC_COLOR ];
// Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc)
@ -283,7 +283,7 @@ var WebGLRenderer = new Class({
* @type {Uint32Array}
* @since 3.0.0
*/
this.currentScissor = new Uint32Array([0, 0, this.width, this.height]);
this.currentScissor = new Uint32Array([ 0, 0, this.width, this.height ]);
/**
* [description]
@ -302,11 +302,12 @@ var WebGLRenderer = new Class({
* @type {Uint32Array}
* @since 3.0.0
*/
this.scissorStack = new Uint32Array(4 * 1000);
this.scissorStack = new Uint32Array(4 * 1000);
// Setup context lost and restore event listeners
this.canvas.addEventListener('webglcontextlost', function (event) {
this.canvas.addEventListener('webglcontextlost', function (event)
{
renderer.contextLost = true;
event.preventDefault();
@ -317,7 +318,8 @@ var WebGLRenderer = new Class({
}
}, false);
this.canvas.addEventListener('webglcontextrestored', function (event) {
this.canvas.addEventListener('webglcontextrestored', function (event)
{
renderer.contextLost = false;
renderer.init(renderer.config);
for (var index = 0; index < renderer.restoredContextCallbacks.length; ++index)
@ -469,7 +471,7 @@ var WebGLRenderer = new Class({
*/
onContextRestored: function (callback, target)
{
this.restoredContextCallbacks.push([callback, target]);
this.restoredContextCallbacks.push([ callback, target ]);
return this;
},
@ -486,7 +488,7 @@ var WebGLRenderer = new Class({
*/
onContextLost: function (callback, target)
{
this.lostContextCallbacks.push([callback, target]);
this.lostContextCallbacks.push([ callback, target ]);
return this;
},
@ -517,7 +519,7 @@ var WebGLRenderer = new Class({
*/
getExtension: function (extensionName)
{
if (!this.hasExtension(extensionName)) return null;
if (!this.hasExtension(extensionName)) { return null; }
if (!(extensionName in this.extensions))
{
@ -602,8 +604,8 @@ var WebGLRenderer = new Class({
*/
addPipeline: function (pipelineName, pipelineInstance)
{
if (!this.hasPipeline(pipelineName)) this.pipelines[pipelineName] = pipelineInstance;
else console.warn('Pipeline', pipelineName, ' already exists.');
if (!this.hasPipeline(pipelineName)) { this.pipelines[pipelineName] = pipelineInstance; }
else { console.warn('Pipeline', pipelineName, ' already exists.'); }
pipelineInstance.name = pipelineName;
this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution);
@ -630,9 +632,9 @@ var WebGLRenderer = new Class({
var currentScissor = this.currentScissor;
var enabled = (x == 0 && y == 0 && w == gl.canvas.width && h == gl.canvas.height && w >= 0 && h >= 0);
if (currentScissor[0] !== x ||
currentScissor[1] !== y ||
currentScissor[2] !== w ||
if (currentScissor[0] !== x ||
currentScissor[1] !== y ||
currentScissor[2] !== w ||
currentScissor[3] !== h)
{
this.flush();
@ -706,7 +708,7 @@ var WebGLRenderer = new Class({
var h = scissorStack[stackIndex + 3];
this.currentScissorIdx = stackIndex;
this.setScissor(x, y, w, h);
this.setScissor(x, y, w, h);
return this;
},
@ -954,7 +956,7 @@ var WebGLRenderer = new Class({
* @return {WebGLTexture} [description]
*/
createTextureFromSource: function (source, width, height, scaleMode)
{
{
var gl = this.gl;
var filter = gl.NEAREST;
var wrap = gl.CLAMP_TO_EDGE;
@ -1013,7 +1015,7 @@ var WebGLRenderer = new Class({
var gl = this.gl;
var texture = gl.createTexture();
pma = (pma === undefined || pma === null) ? true : pma;
pma = (pma === undefined || pma === null) ? true : pma;
this.setTexture2D(texture, 0);
@ -1272,12 +1274,12 @@ var WebGLRenderer = new Class({
var FlatTintPipeline = this.pipelines.FlatTintPipeline;
FlatTintPipeline.batchFillRect(
0, 0, 1, 1, 0,
camera.x, camera.y, camera.width, camera.height,
0, 0, 1, 1, 0,
camera.x, camera.y, camera.width, camera.height,
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1.0),
color.alphaGL,
1, 0, 0, 1, 0, 0,
[1, 0, 0, 1, 0, 0]
[ 1, 0, 0, 1, 0, 0 ]
);
FlatTintPipeline.flush();
@ -1300,22 +1302,22 @@ var WebGLRenderer = new Class({
// Fade
FlatTintPipeline.batchFillRect(
0, 0, 1, 1, 0,
camera.x, camera.y, camera.width, camera.height,
0, 0, 1, 1, 0,
camera.x, camera.y, camera.width, camera.height,
Utils.getTintFromFloats(camera._fadeRed, camera._fadeGreen, camera._fadeBlue, 1.0),
camera._fadeAlpha,
1, 0, 0, 1, 0, 0,
[1, 0, 0, 1, 0, 0]
[ 1, 0, 0, 1, 0, 0 ]
);
// Flash
FlatTintPipeline.batchFillRect(
0, 0, 1, 1, 0,
camera.x, camera.y, camera.width, camera.height,
0, 0, 1, 1, 0,
camera.x, camera.y, camera.width, camera.height,
Utils.getTintFromFloats(camera._flashRed, camera._flashGreen, camera._flashBlue, 1.0),
camera._flashAlpha,
1, 0, 0, 1, 0, 0,
[1, 0, 0, 1, 0, 0]
[ 1, 0, 0, 1, 0, 0 ]
);
FlatTintPipeline.flush();
@ -1332,7 +1334,7 @@ var WebGLRenderer = new Class({
*/
preRender: function ()
{
if (this.contextLost) return;
if (this.contextLost) { return; }
var gl = this.gl;
var color = this.config.backgroundColor;
@ -1342,7 +1344,7 @@ var WebGLRenderer = new Class({
gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL);
if (this.config.clearBeforeRender)
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
{ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); }
for (var key in pipelines)
{
@ -1363,7 +1365,7 @@ var WebGLRenderer = new Class({
*/
render: function (scene, children, interpolationPercentage, camera)
{
if (this.contextLost) return;
if (this.contextLost) { return; }
var gl = this.gl;
var list = children.list;
@ -1417,7 +1419,7 @@ var WebGLRenderer = new Class({
*/
postRender: function ()
{
if (this.contextLost) return;
if (this.contextLost) { return; }
// Unbind custom framebuffer here
@ -1774,7 +1776,7 @@ var WebGLRenderer = new Class({
for (var index = 0; index < this.nativeTextures.length; ++index)
{
this.deleteTexture(this.nativeTextures[index]);
delete this.nativeTextures[index];
delete this.nativeTextures[index];
}
if (this.hasExtension('WEBGL_lose_context'))

View file

@ -6,7 +6,7 @@
var Class = require('../../../utils/Class');
var ShaderSourceFS = require('../shaders/BitmapMask.frag');
var ShaderSourceVS = require('../shaders/BitmapMask.vert');
var ShaderSourceVS = require('../shaders/BitmapMask.vert');
var Utils = require('../Utils');
var WebGLPipeline = require('../WebGLPipeline');
@ -41,7 +41,7 @@ var BitmapMaskPipeline = new Class({
fragShader: ShaderSourceFS,
vertexCapacity: 3,
vertexSize:
vertexSize:
Float32Array.BYTES_PER_ELEMENT * 2,
vertices: new Float32Array([

View file

@ -8,8 +8,8 @@ var Class = require('../../../utils/Class');
var Commands = require('../../../gameobjects/graphics/Commands');
var Earcut = require('../../../geom/polygon/Earcut');
var ModelViewProjection = require('./components/ModelViewProjection');
var ShaderSourceFS = require('../shaders/FlatTint.frag');
var ShaderSourceVS = require('../shaders/FlatTint.vert');
var ShaderSourceFS = require('../shaders/FlatTint.frag');
var ShaderSourceVS = require('../shaders/FlatTint.vert');
var Utils = require('../Utils');
var WebGLPipeline = require('../WebGLPipeline');
@ -29,7 +29,7 @@ var Path = function (x, y, width, rgb, alpha)
this.points[0] = new Point(x, y, width, rgb, alpha);
};
var currentMatrix = new Float32Array([1, 0, 0, 1, 0, 0]);
var currentMatrix = new Float32Array([ 1, 0, 0, 1, 0, 0 ]);
var matrixStack = new Float32Array(6 * 1000);
var matrixStackLength = 0;
var pathArray = [];
@ -69,8 +69,8 @@ var FlatTintPipeline = new Class({
fragShader: ShaderSourceFS,
vertexCapacity: 12000,
vertexSize:
Float32Array.BYTES_PER_ELEMENT * 2 +
vertexSize:
Float32Array.BYTES_PER_ELEMENT * 2 +
Uint8Array.BYTES_PER_ELEMENT * 4,
attributes: [
@ -199,7 +199,7 @@ var FlatTintPipeline = new Class({
* @param {boolean} roundPixels - [description]
*/
batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels)
{
{
this.renderer.setPipeline(this);
if (this.vertexCount + 6 > this.vertexCapacity)
@ -207,7 +207,7 @@ var FlatTintPipeline = new Class({
this.flush();
}
var renderer = this.renderer;
var renderer = this.renderer;
var resolution = renderer.config.resolution;
var vertexViewF32 = this.vertexViewF32;
var vertexViewU32 = this.vertexViewU32;
@ -307,7 +307,7 @@ var FlatTintPipeline = new Class({
this.flush();
}
var renderer = this.renderer;
var renderer = this.renderer;
var resolution = renderer.config.resolution;
var vertexViewF32 = this.vertexViewF32;
var vertexViewU32 = this.vertexViewU32;
@ -446,7 +446,7 @@ var FlatTintPipeline = new Class({
{
this.renderer.setPipeline(this);
var renderer = this.renderer;
var renderer = this.renderer;
var resolution = renderer.config.resolution;
var length = path.length;
var polygonCache = this.polygonCache;
@ -658,7 +658,7 @@ var FlatTintPipeline = new Class({
* @param {Float32Array} currentMatrix - [description]
* @param {boolean} roundPixels - [description]
*/
batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels)
batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels)
{
this.renderer.setPipeline(this);
@ -667,7 +667,7 @@ var FlatTintPipeline = new Class({
this.flush();
}
var renderer = this.renderer;
var renderer = this.renderer;
var resolution = renderer.config.resolution;
var a0 = currentMatrix[0];
var b0 = currentMatrix[1];
@ -731,7 +731,7 @@ var FlatTintPipeline = new Class({
vertexViewU32[vertexOffset + 5] = aTint;
vertexViewF32[vertexOffset + 6] = x2;
vertexViewF32[vertexOffset + 7] = y2;
vertexViewU32[vertexOffset + 8] = bTint
vertexViewU32[vertexOffset + 8] = bTint;
vertexViewF32[vertexOffset + 9] = x1;
vertexViewF32[vertexOffset + 10] = y1;
vertexViewU32[vertexOffset + 11] = aTint;
@ -763,7 +763,7 @@ var FlatTintPipeline = new Class({
*/
batchGraphics: function (graphics, camera)
{
if (graphics.commandBuffer.length <= 0) return;
if (graphics.commandBuffer.length <= 0) { return; }
this.renderer.setPipeline(this);
@ -897,12 +897,15 @@ var FlatTintPipeline = new Class({
++pathArrayIndex)
{
this.batchFillPath(
/* Graphics Game Object Properties */
srcX, srcY, srcScaleX, srcScaleY, srcRotation,
/* Rectangle properties */
pathArray[pathArrayIndex].points,
fillColor,
fillAlpha,
/* Transform */
mva, mvb, mvc, mvd, mve, mvf,
currentMatrix,
@ -918,13 +921,16 @@ var FlatTintPipeline = new Class({
{
path = pathArray[pathArrayIndex];
this.batchStrokePath(
/* Graphics Game Object Properties */
srcX, srcY, srcScaleX, srcScaleY, srcRotation,
/* Rectangle properties */
path.points,
lineWidth,
lineColor,
lineAlpha,
/* Transform */
mva, mvb, mvc, mvd, mve, mvf,
path === this._lastPath,
@ -936,8 +942,10 @@ var FlatTintPipeline = new Class({
case Commands.FILL_RECT:
this.batchFillRect(
/* Graphics Game Object Properties */
srcX, srcY, srcScaleX, srcScaleY, srcRotation,
/* Rectangle properties */
commands[cmdIndex + 1],
commands[cmdIndex + 2],
@ -945,6 +953,7 @@ var FlatTintPipeline = new Class({
commands[cmdIndex + 4],
fillColor,
fillAlpha,
/* Transform */
mva, mvb, mvc, mvd, mve, mvf,
currentMatrix,
@ -956,8 +965,10 @@ var FlatTintPipeline = new Class({
case Commands.FILL_TRIANGLE:
this.batchFillTriangle(
/* Graphics Game Object Properties */
srcX, srcY, srcScaleX, srcScaleY, srcRotation,
/* Triangle properties */
commands[cmdIndex + 1],
commands[cmdIndex + 2],
@ -967,6 +978,7 @@ var FlatTintPipeline = new Class({
commands[cmdIndex + 6],
fillColor,
fillAlpha,
/* Transform */
mva, mvb, mvc, mvd, mve, mvf,
currentMatrix,
@ -978,8 +990,10 @@ var FlatTintPipeline = new Class({
case Commands.STROKE_TRIANGLE:
this.batchStrokeTriangle(
/* Graphics Game Object Properties */
srcX, srcY, srcScaleX, srcScaleY, srcRotation,
/* Triangle properties */
commands[cmdIndex + 1],
commands[cmdIndex + 2],
@ -990,6 +1004,7 @@ var FlatTintPipeline = new Class({
lineWidth,
lineColor,
lineAlpha,
/* Transform */
mva, mvb, mvc, mvd, mve, mvf,
currentMatrix,

View file

@ -95,7 +95,7 @@ var ForwardDiffuseLightPipeline = new Class({
renderer.setFloat1(program, 'uLights[' + index + '].radius', 0); // reset lights
}
if (lightCount <= 0) return this;
if (lightCount <= 0) { return this; }
renderer.setFloat4(program, 'uCamera', camera.x, camera.y, camera.rotation, camera.zoom);
renderer.setFloat3(program, 'uAmbientLightColor', lightManager.ambientColor.r, lightManager.ambientColor.g, lightManager.ambientColor.b);

View file

@ -369,16 +369,16 @@ var ModelViewProjection = {
vm[2] = 0.0;
vm[3] = 0.0;
vm[4] = matrix2D[2];
vm[5] = matrix2D[3];
vm[6] = 0.0;
vm[5] = matrix2D[3];
vm[6] = 0.0;
vm[7] = 0.0;
vm[8] = matrix2D[4];
vm[9] = matrix2D[5];
vm[10] = 1.0;
vm[9] = matrix2D[5];
vm[10] = 1.0;
vm[11] = 0.0;
vm[12] = 0.0;
vm[13] = 0.0;
vm[14] = 0.0;
vm[12] = 0.0;
vm[13] = 0.0;
vm[14] = 0.0;
vm[15] = 1.0;
this.viewMatrixDirty = true;

View file

@ -63,6 +63,7 @@ var UnityYAML = function (texture, sourceIndex, yaml)
var prevSprite = '';
var currentSprite = '';
var rect = { x: 0, y: 0, width: 0, height: 0 };
// var pivot = { x: 0, y: 0 };
// var border = { x: 0, y: 0, z: 0, w: 0 };