Skip to content

Commit

Permalink
Merge branch '3d-tiles' into pnts-styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Oct 18, 2016
2 parents 83efc1b + 5aa2a0e commit 45d96d8
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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]
}
});
Expand Down
6 changes: 5 additions & 1 deletion Source/Scene/Primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
5 changes: 4 additions & 1 deletion Source/Shaders/Builtin/Functions/getSpecular.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
49 changes: 49 additions & 0 deletions Specs/Scene/GeometryRenderingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 45d96d8

Please sign in to comment.