mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
Factor out a truncated upper bound
This commit is contained in:
parent
cd1ed07b8a
commit
2e032bad8c
1 changed files with 6 additions and 4 deletions
|
@ -40,12 +40,14 @@ var Mesh = new Class({
|
||||||
throw new Error('Phaser: Vertex count must match UV count');
|
throw new Error('Phaser: Vertex count must match UV count');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colors.length > 0 && colors.length < ((vertices.length / 2)|0))
|
var verticesUB = (vertices.length / 2) | 0;
|
||||||
|
|
||||||
|
if (colors.length > 0 && colors.length < verticesUB)
|
||||||
{
|
{
|
||||||
throw new Error('Phaser: Color count must match Vertex count');
|
throw new Error('Phaser: Color count must match Vertex count');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alphas.length > 0 && alphas.length < ((vertices.length / 2)|0))
|
if (alphas.length > 0 && alphas.length < verticesUB)
|
||||||
{
|
{
|
||||||
throw new Error('Phaser: Alpha count must match Vertex count');
|
throw new Error('Phaser: Alpha count must match Vertex count');
|
||||||
}
|
}
|
||||||
|
@ -54,7 +56,7 @@ var Mesh = new Class({
|
||||||
|
|
||||||
if (colors.length === 0)
|
if (colors.length === 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (vertices.length / 2)|0; ++i)
|
for (i = 0; i < verticesUB; ++i)
|
||||||
{
|
{
|
||||||
colors[i] = 0xFFFFFF;
|
colors[i] = 0xFFFFFF;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +64,7 @@ var Mesh = new Class({
|
||||||
|
|
||||||
if (alphas.length === 0)
|
if (alphas.length === 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (vertices.length / 2)|0; ++i)
|
for (i = 0; i < verticesUB; ++i)
|
||||||
{
|
{
|
||||||
alphas[i] = 1.0;
|
alphas[i] = 1.0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue