Skip to content

Commit

Permalink
Merge branch 'master' into maintain-camera-heading-on-zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
wallw-bits authored Jul 28, 2017
2 parents 533ce64 + ecfd3cb commit 6210bf2
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 12 deletions.
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Change Log
* Fixed a bug when reading CRN compressed textures with multiple mip levels. [#5618](https://github.com/AnalyticalGraphicsInc/cesium/pull/5618)
* Fixed issue where composite 3D Tiles that contained instanced 3D Tiles with an external model reference would fail to download the model.
* Added behavior to `Cesium3DTilesInspector` that selects the first tileset hovered over if no tilest is specified. [#5139](https://github.com/AnalyticalGraphicsInc/cesium/issues/5139)
* Added `tileLoad` event to `Cesium3DTileset`. [#5628](https://github.com/AnalyticalGraphicsInc/cesium/pull/5628)
* Added ability to provide a `width` and `height` to `scene.pick`. [#5602](https://github.com/AnalyticalGraphicsInc/cesium/pull/5602)
* Added `Entity.computeModelMatrix` which returns the model matrix representing the entity's transformation. [#5584](https://github.com/AnalyticalGraphicsInc/cesium/pull/5584)
* Added ability to set a style's `color`, `show`, or `pointSize` with a string or object literal. `show` may also take a boolean and `pointSize` may take a number. [#5412](https://github.com/AnalyticalGraphicsInc/cesium/pull/5412)
Expand All @@ -32,7 +33,8 @@ Change Log
* Added `FrustumGeometry` and `FrustumOutlineGeometry`. [#5649](https://github.com/AnalyticalGraphicsInc/cesium/pull/5649)
* Added an `options` parameter to the constructors of `PerspectiveFrustum`, `PerspectiveOffCenterFrustum`, `OrthographicFrustum`, and `OrthographicOffCenterFrustum` to set properties. [#5649](https://github.com/AnalyticalGraphicsInc/cesium/pull/5649)
* Added `ClassificationPrimitive` which defines a volume and draws the intersection of the volume and terrain or 3D Tiles. [#5625](https://github.com/AnalyticalGraphicsInc/cesium/pull/5625)
* Zoom about mouse now maintains camera heading, pitch, and roll [#4639](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603)
* Fix for dynamic polylines with polyline dash material [#5681](https://github.com/AnalyticalGraphicsInc/cesium/pull/5681)
* Zoom about mouse now maintains camera heading, pitch, and roll [#5603](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603)

### 1.35.2 - 2017-07-11

Expand Down Expand Up @@ -78,6 +80,7 @@ Change Log
* Updated glTF/glb MIME types. [#5420](https://github.com/AnalyticalGraphicsInc/cesium/issues/5420)
* Added `Cesium.Math.randomBetween`.
* Modified `defaultValue` to check for both `undefined` and `null`. [#5551](https://github.com/AnalyticalGraphicsInc/cesium/pull/5551)
* The `throttleRequestByServer` function has been removed. Instead use `RequestScheduler.throttleRequest` to throttle requests.

### 1.34 - 2017-06-01

Expand Down
26 changes: 25 additions & 1 deletion Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,27 @@ define([
*/
this.allTilesLoaded = new Event();

/**
* The event fired to indicate that a tile's content was loaded.
* <p>
* The loaded {@link Cesium3DTile} is passed to the event listener.
* </p>
* <p>
* This event is fired during the tileset traversal while the frame is being rendered
* so that updates to the tile take effect in the same frame. Do not create or modify
* Cesium entities or primitives during the event listener.
* </p>
*
* @type {Event}
* @default new Event()
*
* @example
* tileset.tileLoad.addEventListener(function(tile) {
* console.log('A tile was loaded.');
* });
*/
this.tileLoad = new Event();

/**
* The event fired to indicate that a tile's content was unloaded.
* <p>
Expand Down Expand Up @@ -1223,7 +1244,10 @@ define([

var removeFunction = removeFromProcessingQueue(tileset, tile);
tile.contentReadyToProcessPromise.then(addToProcessingQueue(tileset, tile));
tile.contentReadyPromise.then(removeFunction).otherwise(removeFunction);
tile.contentReadyPromise.then(function() {
removeFunction();
tileset.tileLoad.raiseEvent(tile);
}).otherwise(removeFunction);
}

function requestTiles(tileset, outOfCore) {
Expand Down
14 changes: 11 additions & 3 deletions Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1144,14 +1144,22 @@ define([
}

var defines = ['DISTANCE_DISPLAY_CONDITION'];

var fs = new ShaderSource({
sources : [this.material.shaderSource, PolylineFS]
});

// Check for use of v_polylineAngle in material shader
if (this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g) !== -1) {
defines.push('POLYLINE_DASH');
}

var vsSource = batchTable.getVertexShaderCallback()(PolylineVS);
var vs = new ShaderSource({
defines : defines,
sources : [PolylineCommon, vsSource]
});
var fs = new ShaderSource({
sources : [this.material.shaderSource, PolylineFS]
});

var fsPick = new ShaderSource({
sources : fs.sources,
pickColorQualifier : 'varying'
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/PolylineMaterialAppearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ define([
vertexShaderSource : {
get : function() {
var vs = this._vertexShaderSource;
if (this.material.shaderSource.search(/varying\s+float\s+v_angle;/g) !== -1) {
if (this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g) !== -1) {
vs = '#define POLYLINE_DASH\n' + vs;
}
return vs;
Expand Down
4 changes: 2 additions & 2 deletions Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ attribute float batchId;

varying float v_width;
varying vec2 v_st;
varying float v_angle;
varying float v_polylineAngle;

void main()
{
Expand All @@ -25,6 +25,6 @@ void main()
v_width = width;
v_st = st;

vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_angle);
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);
gl_Position = czm_viewportOrthographic * positionWC;
}
4 changes: 2 additions & 2 deletions Source/Shaders/Materials/PolylineDashMaterial.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ uniform vec4 color;
uniform vec4 gapColor;
uniform float dashLength;
uniform float dashPattern;
varying float v_angle;
varying float v_polylineAngle;

const float maskLength = 16.0;

Expand All @@ -19,7 +19,7 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);

vec2 pos = rotate(v_angle) * gl_FragCoord.xy;
vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;

// Get the relative position within the dash from 0 to 1
float dashPosition = fract(pos.x / dashLength);
Expand Down
4 changes: 2 additions & 2 deletions Source/Shaders/PolylineVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ attribute vec4 texCoordExpandAndBatchIndex;
varying vec2 v_st;
varying float v_width;
varying vec4 czm_pickColor;
varying float v_angle;
varying float v_polylineAngle;

void main()
{
Expand Down Expand Up @@ -90,7 +90,7 @@ void main()
}
#endif

vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_angle);
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);
gl_Position = czm_viewportOrthographic * positionWC * show;

v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));
Expand Down
28 changes: 28 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,34 @@ defineSuite([
});
});

it('tile load event is raised', function() {
viewNothing();
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
var spyUpdate = jasmine.createSpy('listener');
tileset.tileLoad.addEventListener(spyUpdate);
tileset.maximumMemoryUsage = 0;
viewRootOnly();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
// Root is loaded
expect(spyUpdate.calls.count()).toEqual(1);
expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset._root);
spyUpdate.calls.reset();

// Unload from cache
viewNothing();
scene.renderForSpecs();
expect(tileset.statistics.numberOfTilesWithContentReady).toEqual(0);

// Look at root again
viewRootOnly();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(spyUpdate.calls.count()).toEqual(1);
expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset._root);
});
});
});
});

it('destroys', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
var root = tileset._root;
Expand Down

0 comments on commit 6210bf2

Please sign in to comment.