diff --git a/CHANGES.md b/CHANGES.md index ece32ea7a27a..b2c3e60474df 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,8 @@ Change Log * * Fixed a crash that would occur when using dynamic `distanceDisplayCondition` properties. [#4403](https://github.com/AnalyticalGraphicsInc/cesium/pull/4403) * Fixed a bug affected models with multiple meshes without indices. [#4237](https://github.com/AnalyticalGraphicsInc/cesium/issues/4237) +* Fixed a glTF transparency bug where `blendFuncSeparate` parameters were loaded in the wrong order. [#4435](https://github.com/AnalyticalGraphicsInc/cesium/pull/4435) +* Fixed a bug where creating a custom geometry with attributes and indices that have values that are not a typed array would cause a crash. [#4419](https://github.com/AnalyticalGraphicsInc/cesium/pull/4419) ### 1.26 - 2016-10-03 diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index a150e35dfaac..80b533c7f00a 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -2427,9 +2427,9 @@ define([ WebGLConstants.FUNC_ADD, WebGLConstants.FUNC_ADD]); var blendFuncSeparate = defaultValue(statesFunctions.blendFuncSeparate, [ - WebGLConstants.ONE, WebGLConstants.ONE, WebGLConstants.ZERO, + WebGLConstants.ONE, WebGLConstants.ZERO]); var colorMask = defaultValue(statesFunctions.colorMask, [true, true, true, true]); var depthRange = defaultValue(statesFunctions.depthRange, [0.0, 1.0]); @@ -2483,8 +2483,8 @@ define([ equationRgb : blendEquationSeparate[0], equationAlpha : blendEquationSeparate[1], functionSourceRgb : blendFuncSeparate[0], - functionSourceAlpha : blendFuncSeparate[1], - functionDestinationRgb : blendFuncSeparate[2], + functionDestinationRgb : blendFuncSeparate[1], + functionSourceAlpha : blendFuncSeparate[2], functionDestinationAlpha : blendFuncSeparate[3] } }); diff --git a/Source/Scene/Primitive.js b/Source/Scene/Primitive.js index 29f69c199c36..4aa6975e3c51 100644 --- a/Source/Scene/Primitive.js +++ b/Source/Scene/Primitive.js @@ -683,7 +683,11 @@ define([ var indices; if (defined(geometry.indices)) { var sourceValues = geometry.indices; - indices = new sourceValues.constructor(sourceValues); + if (isArray(sourceValues)) { + indices = sourceValues.slice(0); + } else { + indices = new sourceValues.constructor(sourceValues); + } } return new Geometry({ diff --git a/Source/Shaders/Builtin/Functions/getSpecular.glsl b/Source/Shaders/Builtin/Functions/getSpecular.glsl index 57998b693cd9..7849670041ac 100644 --- a/Source/Shaders/Builtin/Functions/getSpecular.glsl +++ b/Source/Shaders/Builtin/Functions/getSpecular.glsl @@ -22,5 +22,8 @@ float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float { vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC); float specular = max(dot(toReflectedLight, toEyeEC), 0.0); - return pow(specular, shininess); + + // pow has undefined behavior if both parameters <= 0. + // Prevent this by making sure shininess is at least czm_epsilon2. + return pow(specular, max(shininess, czm_epsilon2)); } \ No newline at end of file diff --git a/Specs/Scene/GeometryRenderingSpec.js b/Specs/Scene/GeometryRenderingSpec.js index 03106a12ed14..e732ef84f9d6 100644 --- a/Specs/Scene/GeometryRenderingSpec.js +++ b/Specs/Scene/GeometryRenderingSpec.js @@ -1603,6 +1603,55 @@ defineSuite([ pickGeometry(instance); }); }, 'WebGL'); + + describe('with native arrays as attributes and indices', function() { + var instance; + beforeAll(function() { + instance = new GeometryInstance({ + geometry : new Geometry({ + attributes : { + position : new GeometryAttribute({ + componentDatatype : ComponentDatatype.DOUBLE, + componentsPerAttribute : 3, + values : [ + 1000000.0, 0.0, 0.0, + 1000000.0, 1000000.0, 0.0, + 1000000.0, 0.0, 1000000.0, + 1000000.0, 1000000.0, 1000000.0 + ] + }) + }, + indices : [0, 1, 2, 2, 1, 3], + primitiveType : PrimitiveType.TRIANGLES + }), + modelMatrix : Matrix4.multiplyByTranslation(Transforms.eastNorthUpToFixedFrame( + Cartesian3.fromDegrees(0,0)), new Cartesian3(0.0, 0.0, 10000.0), new Matrix4()), + id : 'customWithIndices', + attributes : { + color : new ColorGeometryInstanceAttribute(1.0, 1.0, 1.0, 1.0) + } + }); + geometry = instance.geometry; + geometry.boundingSphere = BoundingSphere.fromVertices(instance.geometry.attributes.position.values); + geometry.boundingSphereWC = BoundingSphere.transform(geometry.boundingSphere, instance.modelMatrix); + }); + + it('3D', function() { + render3D(instance); + }); + + it('Columbus view', function() { + renderCV(instance); + }); + + it('2D', function() { + render2D(instance); + }); + + it('pick', function() { + pickGeometry(instance); + }); + }, 'WebGL'); }); }, 'WebGL'); diff --git a/package.json b/package.json index 2393d1589afa..c44797d5621a 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "devDependencies": { "almond": "0.3.3", - "aws-sdk": "2.6.7", + "aws-sdk": "2.6.9", "bluebird": "3.4.6", "compressible": "2.0.8", "compression": "1.6.2", @@ -67,7 +67,7 @@ "request": "2.75.0", "rimraf": "2.5.4", "strip-comments": "0.3.2", - "yargs": "6.0.0" + "yargs": "6.2.0" }, "scripts": { "start": "node server.js",