Skip to content

Commit

Permalink
Merge branch 'master' into 5819_fix_for_empty_icon_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Bernstein authored Oct 2, 2017
2 parents b0a3834 + 9b05ee6 commit be26845
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 90 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Change Log
* Fixed a 3D Tiles point cloud bug causing a stray point to appear at the center of the screen on certain hardware. [#5599](https://github.com/AnalyticalGraphicsInc/cesium/issues/5599)
* Fixed removing multiple event listeners within event callbacks. [#5827](https://github.com/AnalyticalGraphicsInc/cesium/issues/5827)
* Running `buildApps` now creates a built version of Sandcastle which uses the built version of Cesium for better performance.
* Fixed a tileset traversal bug when the `skipLevelOfDetail` optimization is off. [#5869](https://github.com/AnalyticalGraphicsInc/cesium/issues/5869)
* Fixed bug with placemarks in imported KML: placemarks with no specified icon would be displayed with default icon. [#5819](https://github.com/AnalyticalGraphicsInc/cesium/issues/5819)

### 1.37 - 2017-09-01
Expand Down
11 changes: 9 additions & 2 deletions Source/Scene/Cesium3DTilesetTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ define([
if (!tile.hasTilesetContent) {
if (tile.refine === Cesium3DTileRefine.ADD) {
// Always load additive tiles
loadTile(tileset, tile, this.frameState);
loadTile(tileset, tile, this.frameState, true);
if (hasAdditiveContent(tile)) {
tileset._desiredTiles.push(tile);
}
Expand Down Expand Up @@ -635,9 +635,16 @@ define([
}
}

function checkAdditiveVisibility(tileset, tile, frameState) {
if (defined(tile.parent) && (tile.parent.refine === Cesium3DTileRefine.ADD)) {
return isVisibleAndMeetsSSE(tileset, tile, frameState);
}
return true;
}

function loadTile(tileset, tile, frameState, checkVisibility) {
if ((tile.contentUnloaded || tile.contentExpired) && tile._requestedFrame !== frameState.frameNumber) {
if (!checkVisibility || isVisibleAndMeetsSSE(tileset, tile, frameState)) {
if (!checkVisibility || checkAdditiveVisibility(tileset, tile, frameState)) {
tile._requestedFrame = frameState.frameNumber;
tileset._requestedTiles.push(tile);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ThirdParty/GltfPipeline/addDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ define([
var defaults = {
ambient: [0.0, 0.0, 0.0, 1.0],
emission: [0.0, 0.0, 0.0, 1.0],
transparency: [1.0]
transparency: 1.0
};
if (technique !== 'CONSTANT') {
defaults.diffuse = [0.0, 0.0, 0.0, 1.0];
if (technique !== 'LAMBERT') {
defaults.specular = [0.0, 0.0, 0.0, 1.0];
defaults.shininess = [0.0];
defaults.shininess = 0.0;
}
}
return {
Expand Down
31 changes: 0 additions & 31 deletions Source/ThirdParty/GltfPipeline/getUniqueId.js

This file was deleted.

1 change: 0 additions & 1 deletion Source/ThirdParty/GltfPipeline/parseBinaryGltf.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ define([
}
// Load Binary chunk
else if (chunkType === 0x004E4942) {
// Clone just the binary chunk so the underlying buffer can be freed
binaryBuffer = chunkBuffer;
}
}
Expand Down
54 changes: 26 additions & 28 deletions Source/ThirdParty/GltfPipeline/processPbrMetallicRoughness.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ define([
for (var name in parameterValues) {
//generate shader parameters
if (parameterValues.hasOwnProperty(name)) {
var valType = getPBRValueType(name, parameterValues[name]);
var valType = getPBRValueType(name);
if (!hasTexCoords && (valType === WebGLConstants.SAMPLER_2D)) {
hasTexCoords = true;
}
Expand Down Expand Up @@ -373,37 +373,37 @@ define([
fragmentShader += 'const float M_PI = 3.141592653589793;\n';

fragmentShader += 'vec3 lambertianDiffuse(vec3 baseColor) \n' +
'{\n' +
' return baseColor / M_PI;\n' +
'}\n\n';
'{\n' +
' return baseColor / M_PI;\n' +
'}\n\n';

fragmentShader += 'vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH) \n' +
'{\n' +
' return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n' +
'}\n\n';
'{\n' +
' return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n' +
'}\n\n';

fragmentShader += 'vec3 fresnelSchlick(float metalness, float VdotH) \n' +
'{\n' +
' return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);\n' +
'}\n\n';
'{\n' +
' return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);\n' +
'}\n\n';

fragmentShader += 'float smithVisibilityG1(float NdotV, float roughness) \n' +
'{\n' +
' float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n' +
' return NdotV / (NdotV * (1.0 - k) + k);\n' +
'}\n\n';
'{\n' +
' float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n' +
' return NdotV / (NdotV * (1.0 - k) + k);\n' +
'}\n\n';

fragmentShader += 'float smithVisibilityGGX(float roughness, float NdotL, float NdotV) \n' +
'{\n' +
' return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);\n' +
'}\n\n';
'{\n' +
' return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);\n' +
'}\n\n';

fragmentShader += 'float GGX(float roughness, float NdotH) \n' +
'{\n' +
' float roughnessSquared = roughness * roughness;\n' +
' float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n' +
' return roughnessSquared / (M_PI * f * f);\n' +
'}\n\n';
'{\n' +
' float roughnessSquared = roughness * roughness;\n' +
' float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n' +
' return roughnessSquared / (M_PI * f * f);\n' +
'}\n\n';

fragmentShader += 'void main(void) \n{\n';

Expand All @@ -421,9 +421,9 @@ define([
} else {
// Add standard derivatives extension
fragmentShader = '#ifdef GL_OES_standard_derivatives\n' +
'#extension GL_OES_standard_derivatives : enable\n' +
'#endif\n' +
fragmentShader;
'#extension GL_OES_standard_derivatives : enable\n' +
'#endif\n' +
fragmentShader;
// Compute tangents
fragmentShader += '#ifdef GL_OES_standard_derivatives\n';
fragmentShader += ' vec3 pos_dx = dFdx(v_positionEC);\n';
Expand Down Expand Up @@ -675,9 +675,7 @@ define([
return techniqueId;
}

function getPBRValueType(paramName, paramValue) {
var value;

function getPBRValueType(paramName) {
switch (paramName) {
case 'baseColorFactor':
return WebGLConstants.FLOAT_VEC4;
Expand Down
27 changes: 1 addition & 26 deletions Source/ThirdParty/GltfPipeline/updateVersion.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
define([
'./addExtensionsRequired',
'./addToArray',
'./findAccessorMinMax',
'./ForEach',
'./getAccessorByteStride',
'../../Core/Cartesian3',
Expand All @@ -14,7 +13,6 @@ define([
], function(
addExtensionsRequired,
addToArray,
findAccessorMinMax,
ForEach,
getAccessorByteStride,
Cartesian3,
Expand Down Expand Up @@ -645,17 +643,6 @@ define([
});
}

function makeTechniqueValuesArrays(gltf) {
ForEach.technique(gltf, function(technique) {
ForEach.techniqueParameter(technique, function(parameter) {
var value = parameter.value;
if (defined(value) && !Array.isArray(value)) {
parameter.value = [value];
}
});
});
}

function removeScissorFromTechniques(gltf) {
ForEach.technique(gltf, function(technique) {
var techniqueStates = technique.states;
Expand Down Expand Up @@ -754,6 +741,7 @@ define([

var bufferViewShiftMap = {};
var bufferViewRemovalCount = 0;
/* jshint unused:vars */
ForEach.bufferView(gltf, function(bufferView, bufferViewId) {
if (defined(bufferViewsToDelete[bufferViewId])) {
bufferViewRemovalCount++;
Expand Down Expand Up @@ -805,16 +793,6 @@ define([
});
}

function requireAccessorMinMax(gltf) {
ForEach.accessor(gltf, function(accessor) {
if (!defined(accessor.min) || !defined(accessor.max)) {
var minMax = findAccessorMinMax(gltf, accessor);
accessor.min = minMax.min;
accessor.max = minMax.max;
}
});
}

function stripTechniqueAttributeValues(gltf) {
ForEach.technique(gltf, function(technique) {
ForEach.techniqueAttribute(technique, function(attribute) {
Expand Down Expand Up @@ -872,8 +850,6 @@ define([
requireAttributeSetIndex(gltf);
// Add underscores to application-specific parameters
underscoreApplicationSpecificSemantics(gltf);
// technique.parameters.value should be arrays
makeTechniqueValuesArrays(gltf);
// remove scissor from techniques
removeScissorFromTechniques(gltf);
// clamp technique function states to min/max
Expand All @@ -887,6 +863,5 @@ define([
// add KHR_technique_webgl extension
addKHRTechniqueExtension(gltf);
}

return updateVersion;
});
8 changes: 8 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,14 @@ defineSuite([
});
});

it('does not load additive tiles that are out of view', function() {
viewBottomLeft();
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
var statistics = tileset._statistics;
expect(statistics.numberOfTilesWithContentReady).toEqual(2);
});
});

it('culls with content box', function() {
// Root tile has a content box that is half the extents of its box
// Expect to cull root tile and three child tiles
Expand Down

0 comments on commit be26845

Please sign in to comment.