Skip to content

Commit

Permalink
Merge master to uniform-arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcozzi committed Feb 11, 2015
2 parents 7b0d9b1 + 9f5fa6a commit 031dd3d
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 31 deletions.
10 changes: 5 additions & 5 deletions Apps/Sandcastle/gallery/Labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
function addLabel() {
Sandcastle.declare(addLabel);
viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
label : {
text : 'Philadelphia'
}
Expand All @@ -42,7 +42,7 @@
function setFont() {
Sandcastle.declare(setFont);
viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
label : {
text : 'Philadelphia',
font : '24px Helvetica',
Expand All @@ -57,7 +57,7 @@
function setProperties() {
Sandcastle.declare(setProperties);
var entity = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57, 300000.0),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222, 300000.0),
label : {
text : 'Philadelphia'
}
Expand All @@ -71,9 +71,9 @@
var image = new Image();
image.onload = function() {
viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
billboard : {
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
scaleByDistance : new Cesium.NearFarScalar(1.5e2, 5.0, 1.5e7, 0.5),
image : image
},
Expand Down
12 changes: 6 additions & 6 deletions Apps/Sandcastle/gallery/development/Labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
scene.primitives.removeAll();
var labels = scene.primitives.add(new Cesium.LabelCollection());
labels.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
text : 'Philadelphia'
});
}
Expand All @@ -45,7 +45,7 @@
scene.primitives.removeAll();
var labels = scene.primitives.add(new Cesium.LabelCollection());
labels.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
text : 'Philadelphia',
// CSS font-family
font : '24px Helvetica',
Expand All @@ -61,11 +61,11 @@
scene.primitives.removeAll();
var labels = scene.primitives.add(new Cesium.LabelCollection());
var l = labels.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
text : 'Philadelphia'
});

l.position = Cesium.Cartesian3.fromDegrees(-75.10, 39.57, 300000.0);
l.position = Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222, 300000.0);
l.scale = 2.0;
}

Expand Down Expand Up @@ -100,14 +100,14 @@
image.onload = function() {
var billboards = scene.primitives.add(new Cesium.BillboardCollection());
billboards.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
scaleByDistance : new Cesium.NearFarScalar(1.5e2, 5.0, 1.5e7, 0.5),
image : image
});

var labels = scene.primitives.add(new Cesium.LabelCollection());
labels.add({
position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
text : 'Label on top of scaling billboard',
font : '20px sans-serif',
horizontalOrigin : Cesium.HorizontalOrigin.CENTER,
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Change Log
* Removed `Camera.heading` and `Camera.tilt`. They were deprecated in Cesium 1.6. Use `Camera.setView`.
* Removed `Camera.setPositionCartographic`, which was was deprecated in Cesium 1.6. Use `Camera.setView`.
* Fixed incorrect ellipse texture coordinates. [#2363](https://github.com/AnalyticalGraphicsInc/cesium/issues/2363) and [#2465](https://github.com/AnalyticalGraphicsInc/cesium/issues/2465)
* Fixed a bug in imagery loading that could cause some or all of the globe to be missing when using an imagery layer that does not cover the entire globe.
* Added `pack` and `unpack` functions to `Matrix2`, `Matrix3`, and TODO.

### 1.6 - 2015-02-02
Expand Down
17 changes: 17 additions & 0 deletions Source/Scene/Imagery.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,22 @@ define([
return this.referenceCount;
};

Imagery.prototype.processStateMachine = function(context) {
if (this.state === ImageryState.UNLOADED) {
this.state = ImageryState.TRANSITIONING;
this.imageryLayer._requestImagery(this);
}

if (this.state === ImageryState.RECEIVED) {
this.state = ImageryState.TRANSITIONING;
this.imageryLayer._createTexture(context, this);
}

if (this.state === ImageryState.TEXTURE_LOADED) {
this.state = ImageryState.TRANSITIONING;
this.imageryLayer._reprojectTexture(context, this);
}
};

return Imagery;
});
15 changes: 15 additions & 0 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,21 @@ define([
}
},

/**
* The maximum length in pixels of one edge of a cube map, supported by this WebGL implementation. It will be at least 16.
* @memberof Scene.prototype
*
* @type {Number}
* @readonly
*
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>GL_MAX_CUBE_MAP_TEXTURE_SIZE</code>.
*/
maximumCubeMapSize : {
get : function() {
return this._context.maximumCubeMapSize;
}
},

/**
* Gets or sets the depth-test ellipsoid.
* @memberof Scene.prototype
Expand Down
3 changes: 2 additions & 1 deletion Source/Scene/SkyBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ define([
/**
* A sky box around the scene to draw stars. The sky box is defined using the True Equator Mean Equinox (TEME) axes.
* <p>
* This is only supported in 3D. The sky box is faded out when morphing to 2D or Columbus view.
* This is only supported in 3D. The sky box is faded out when morphing to 2D or Columbus view. The size of
* the sky box must not exceed {@link Scene#maximumCubeMapSize}.
* </p>
*
* @alias SkyBox
Expand Down
37 changes: 18 additions & 19 deletions Source/Scene/TileImagery.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,7 @@ define([
var loadingImagery = this.loadingImagery;
var imageryLayer = loadingImagery.imageryLayer;

if (loadingImagery.state === ImageryState.UNLOADED) {
loadingImagery.state = ImageryState.TRANSITIONING;
imageryLayer._requestImagery(loadingImagery);
}

if (loadingImagery.state === ImageryState.RECEIVED) {
loadingImagery.state = ImageryState.TRANSITIONING;
imageryLayer._createTexture(context, loadingImagery);
}

if (loadingImagery.state === ImageryState.TEXTURE_LOADED) {
loadingImagery.state = ImageryState.TRANSITIONING;
imageryLayer._reprojectTexture(context, loadingImagery);
}
loadingImagery.processStateMachine(context);

if (loadingImagery.state === ImageryState.READY) {
if (defined(this.readyImagery)) {
Expand All @@ -75,9 +62,12 @@ define([

// Find some ancestor imagery we can use while this imagery is still loading.
var ancestor = loadingImagery.parent;
var ancestorsAreStillLoading = false;
var closestAncestorThatNeedsLoading;
while (defined(ancestor) && ancestor.state !== ImageryState.READY) {
ancestorsAreStillLoading = ancestorsAreStillLoading || (ancestor.state !== ImageryState.FAILED && ancestor.state !== ImageryState.INVALID);
if (ancestor.state !== ImageryState.FAILED && ancestor.state !== ImageryState.INVALID) {
// ancestor is still loading
closestAncestorThatNeedsLoading = closestAncestorThatNeedsLoading || ancestor;
}
ancestor = ancestor.parent;
}

Expand All @@ -94,9 +84,18 @@ define([
}
}

if (!ancestorsAreStillLoading && (loadingImagery.state === ImageryState.FAILED || loadingImagery.state === ImageryState.INVALID)) {
// This imagery tile is failed or invalid, and we have the "best available" substitute. So we're done loading.
return true; // done loading
if (loadingImagery.state === ImageryState.FAILED || loadingImagery.state === ImageryState.INVALID) {
// The imagery tile is failed or invalid, so we'd like to use an ancestor instead.
if (defined(closestAncestorThatNeedsLoading)) {
// Push the ancestor's load process along a bit. This is necessary because some ancestor imagery
// tiles may not be attached directly to a terrain tile. Such tiles will never load if
// we don't do it here.
closestAncestorThatNeedsLoading.processStateMachine(context);
return false; // not done loading
} else {
// This imagery tile is failed or invalid, and we have the "best available" substitute.
return true; // done loading
}
}

return false; // not done loading
Expand Down
40 changes: 40 additions & 0 deletions Specs/Scene/GlobeSurfaceTileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,43 @@
defineSuite([
'Scene/GlobeSurfaceTile',
'Core/Cartesian3',
'Core/Cartesian4',
'Core/CesiumTerrainProvider',
'Core/defined',
'Core/Ellipsoid',
'Core/GeographicTilingScheme',
'Core/Ray',
'Core/Rectangle',
'Core/WebMercatorTilingScheme',
'Scene/Imagery',
'Scene/ImageryLayer',
'Scene/ImageryLayerCollection',
'Scene/ImageryState',
'Scene/QuadtreeTile',
'Scene/QuadtreeTileLoadState',
'Scene/TerrainState',
'Scene/TileImagery',
'Specs/createContext',
'ThirdParty/when'
], function(
GlobeSurfaceTile,
Cartesian3,
Cartesian4,
CesiumTerrainProvider,
defined,
Ellipsoid,
GeographicTilingScheme,
Ray,
Rectangle,
WebMercatorTilingScheme,
Imagery,
ImageryLayer,
ImageryLayerCollection,
ImageryState,
QuadtreeTile,
QuadtreeTileLoadState,
TerrainState,
TileImagery,
createContext,
when) {
"use strict";
Expand Down Expand Up @@ -490,6 +502,34 @@ defineSuite([
expect(childTile.data.waterMaskTexture).toBeUndefined();
});
});

it('loads parent imagery tile even for root terrain tiles', function() {
var tile = new QuadtreeTile({
tilingScheme : new GeographicTilingScheme(),
level : 0,
x : 1,
y : 0
});

var imageryLayerCollection = new ImageryLayerCollection();

GlobeSurfaceTile.processStateMachine(tile, context, alwaysDeferTerrainProvider, imageryLayerCollection);

var layer = new ImageryLayer({
requestImage : function() {
return when.reject();
}
});
var imagery = new Imagery(layer, 0, 0, 1, Rectangle.MAX_VALUE);
tile.data.imagery.push(new TileImagery(imagery, new Cartesian4()));

expect(imagery.parent.state).toBe(ImageryState.UNLOADED);

waitsFor(function() {
GlobeSurfaceTile.processStateMachine(tile, context, alwaysDeferTerrainProvider, imageryLayerCollection);
return imagery.parent.state !== ImageryState.UNLOADED;
});
});
}, 'WebGL');

describe('pick', function() {
Expand Down
12 changes: 12 additions & 0 deletions Specs/Scene/SceneSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,4 +571,16 @@ defineSuite([

s.destroyForSpecs();
});

it('get maximumAliasedLineWidth', function() {
var s = createScene();
expect(s.maximumAliasedLineWidth).toBeGreaterThanOrEqualTo(1);
destroyScene(s);
});

it('get maximumCubeMapSize', function() {
var s = createScene();
expect(s.maximumCubeMapSize).toBeGreaterThanOrEqualTo(16);
destroyScene(s);
});
}, 'WebGL');

0 comments on commit 031dd3d

Please sign in to comment.