Skip to content

Commit

Permalink
Minor tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Mar 12, 2013
1 parent 1f7c18b commit a3dae84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 9 additions & 9 deletions Source/Scene/ImageryLayer.js
Expand Up @@ -736,6 +736,9 @@ define([
imagery.state = ImageryState.READY;
};

var tileTextureWidth = 256;
var tileTextureHeight = 256;

/**
* Copies an imagery tile to the terrain tile's texture for the corresponding layer, reprojecting
* from Web Mercator to Geographic along the way, if necessary. Mip levels are not filled until
Expand All @@ -758,8 +761,8 @@ define([
// the texture before using it, because imagery might not completely overlap this
// terrain tile.
tile.textures[this._layerIndex] = tileTexture = context.createTexture2D({
width : 256,
height : 256
width : tileTextureWidth,
height : tileTextureHeight
});

if (typeof this._mipmapSampler === 'undefined') {
Expand Down Expand Up @@ -922,11 +925,8 @@ define([

texture.setSampler(imageryLayer._copySampler);

var width = 256;
var height = 256;

uniformMap.textureDimensions.x = width;
uniformMap.textureDimensions.y = height;
uniformMap.textureDimensions.x = tileTextureWidth;
uniformMap.textureDimensions.y = tileTextureHeight;
uniformMap.texture = texture;

// Reproject this texture if it is not already in a geographic projection and
Expand Down Expand Up @@ -965,8 +965,8 @@ define([
viewport = new BoundingRectangle();
renderState.viewport = viewport;
}
viewport.width = width;
viewport.height = height;
viewport.width = tileTextureWidth;
viewport.height = tileTextureHeight;

context.draw({
framebuffer : imageryLayer._fbCopy,
Expand Down
6 changes: 4 additions & 2 deletions Source/Scene/TileCoordinatesImageryProvider.js
Expand Up @@ -44,6 +44,8 @@ define([
this._tilingScheme = defaultValue(description.tilingScheme, new GeographicTilingScheme());
this._color = defaultValue(description.color, 'yellow');
this._errorEvent = new Event();
this._tileWidth = defaultValue(description.tileWidth, 256);
this._tileHeight = defaultValue(description.tileHeight, 256);
};

/**
Expand All @@ -57,7 +59,7 @@ define([
* @exception {DeveloperError} <code>getTileWidth</code> must not be called before the imagery provider is ready.
*/
TileCoordinatesImageryProvider.prototype.getTileWidth = function() {
return 256;
return this._tileWidth;
};

/**
Expand All @@ -71,7 +73,7 @@ define([
* @exception {DeveloperError} <code>getTileHeight</code> must not be called before the imagery provider is ready.
*/
TileCoordinatesImageryProvider.prototype.getTileHeight = function() {
return 256;
return this._tileHeight;
};

/**
Expand Down

0 comments on commit a3dae84

Please sign in to comment.