Skip to content

Commit

Permalink
use Core/arraySlice
Browse files Browse the repository at this point in the history
  • Loading branch information
likangning93 committed Jul 2, 2018
1 parent 40972ef commit 4c5987f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 9 additions & 7 deletions Specs/Core/GeometryPipelineSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defineSuite([
'Core/GeometryPipeline',
'Core/arraySlice',
'Core/AttributeCompression',
'Core/BoundingSphere',
'Core/BoxGeometry',
Expand All @@ -22,6 +23,7 @@ defineSuite([
'Core/VertexFormat'
], function(
GeometryPipeline,
arraySlice,
AttributeCompression,
BoundingSphere,
BoxGeometry,
Expand Down Expand Up @@ -1739,7 +1741,7 @@ defineSuite([
minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
}));
expect(geometry.attributes.normal).toBeDefined();
var originalNormals = Array.prototype.slice.call(geometry.attributes.normal.values);
var originalNormals = arraySlice(geometry.attributes.normal.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand All @@ -1763,7 +1765,7 @@ defineSuite([
minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
}));
expect(geometry.attributes.st).toBeDefined();
var originalST = Array.prototype.slice.call(geometry.attributes.st.values);
var originalST = arraySlice(geometry.attributes.st.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand Down Expand Up @@ -1794,8 +1796,8 @@ defineSuite([
}));
expect(geometry.attributes.normal).toBeDefined();
expect(geometry.attributes.st).toBeDefined();
var originalNormals = Array.prototype.slice.call(geometry.attributes.normal.values);
var originalST = Array.prototype.slice.call(geometry.attributes.st.values);
var originalNormals = arraySlice(geometry.attributes.normal.values);
var originalST = arraySlice(geometry.attributes.st.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand Down Expand Up @@ -1826,9 +1828,9 @@ defineSuite([
expect(geometry.attributes.normal).toBeDefined();
expect(geometry.attributes.tangent).toBeDefined();
expect(geometry.attributes.bitangent).toBeDefined();
var originalNormals = Array.prototype.slice.call(geometry.attributes.normal.values);
var originalTangents = Array.prototype.slice.call(geometry.attributes.tangent.values);
var originalBitangents = Array.prototype.slice.call(geometry.attributes.bitangent.values);
var originalNormals = arraySlice(geometry.attributes.normal.values);
var originalTangents = arraySlice(geometry.attributes.tangent.values);
var originalBitangents = arraySlice(geometry.attributes.bitangent.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand Down
6 changes: 4 additions & 2 deletions Specs/Core/GroundPolylineGeometrySpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defineSuite([
'Core/GroundPolylineGeometry',
'Core/ApproximateTerrainHeights',
'Core/arraySlice',
'Core/Cartesian3',
'Core/Cartographic',
'Core/Math',
Expand All @@ -11,6 +12,7 @@ defineSuite([
], function(
GroundPolylineGeometry,
ApproximateTerrainHeights,
arraySlice,
Cartesian3,
Cartographic,
CesiumMath,
Expand All @@ -33,11 +35,11 @@ defineSuite([
var values = attribute.values;
var componentsPerAttribute = attribute.componentsPerAttribute;
var vertexCount = values.length / componentsPerAttribute;
var firstVertex = Array.prototype.slice.call(values, 0, componentsPerAttribute);
var firstVertex = arraySlice(values, 0, componentsPerAttribute);
var identical = true;
for (var i = 1; i < vertexCount; i++) {
var index = i * componentsPerAttribute;
var vertex = Array.prototype.slice.call(values, index, index + componentsPerAttribute);
var vertex = arraySlice(values, index, index + componentsPerAttribute);
for (var j = 0; j < componentsPerAttribute; j++) {
if (vertex[j] !== firstVertex[j]) {
identical = false;
Expand Down

0 comments on commit 4c5987f

Please sign in to comment.