Skip to content

Commit

Permalink
Use RGB textures for imagery without alpha.
Browse files Browse the repository at this point in the history
Currently only Bing imagery claims to not have alpha.
  • Loading branch information
kring committed Mar 30, 2014
1 parent 0ef2bf8 commit 75a88c8
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Source/Scene/ArcGisMapServerImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,20 @@ define([
get : function() {
return this._useTiles;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/BingMapsImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,20 @@ define([
get : function() {
return this._credit;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. Setting this property to false reduces memory usage
* and texture upload time.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return false;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/GoogleEarthImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,20 @@ define([
get : function() {
return this._credit;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/GridImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ define([
get : function() {
return undefined;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
5 changes: 4 additions & 1 deletion Source/Scene/ImageryLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ define([
'../Core/GeometryAttribute',
'../Renderer/BufferUsage',
'../Renderer/MipmapHint',
'../Renderer/PixelFormat',
'../Renderer/TextureMagnificationFilter',
'../Renderer/TextureMinificationFilter',
'../Renderer/TextureWrap',
Expand Down Expand Up @@ -48,6 +49,7 @@ define([
GeometryAttribute,
BufferUsage,
MipmapHint,
PixelFormat,
TextureMagnificationFilter,
TextureMinificationFilter,
TextureWrap,
Expand Down Expand Up @@ -675,7 +677,8 @@ define([

// Imagery does not need to be discarded, so upload it to WebGL.
var texture = context.createTexture2D({
source : imagery.image
source : imagery.image,
pixelFormat : imageryProvider.hasAlphaChannel ? PixelFormat.RGBA : PixelFormat.RGB
});

imagery.texture = texture;
Expand Down
12 changes: 12 additions & 0 deletions Source/Scene/ImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ define([
*/
proxy : {
get : DeveloperError.throwInstantiationError
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : DeveloperError.throwInstantiationError
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/OpenStreetMapImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,20 @@ define([
get : function() {
return this._credit;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/SingleTileImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,20 @@ define([
get : function() {
return this._credit;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/TileCoordinatesImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,20 @@ define([
get : function() {
return undefined;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. Setting this property to false reduces memory usage
* and texture upload time.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/TileMapServiceImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,20 @@ define([
get : function() {
return this._credit;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Scene/WebMapServiceImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,20 @@ define([
get : function() {
return this._credit;
}
},

/**
* Gets a value indicating whether or not the images provided by this imagery provider
* include an alpha channel. If this property is false, an alpha channel, if present, will
* be ignored. If this property is true, any images without an alpha channel will be treated
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
* and texture upload time are reduced.
* @type {Boolean}
*/
hasAlphaChannel : {
get : function() {
return true;
}
}
});

Expand Down
1 change: 1 addition & 0 deletions Specs/Scene/SingleTileImageryProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ defineSuite([

expect(provider.url).toEqual(url);
expect(provider.extent).toEqual(extent);
expect(provider.hasAlphaChannel).toEqual(true);

waitsFor(function() {
return provider.ready;
Expand Down

0 comments on commit 75a88c8

Please sign in to comment.