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
Josh Bernstein committed Oct 23, 2017
2 parents fa1e73e + 9758800 commit 6b6f55c
Show file tree
Hide file tree
Showing 15 changed files with 367 additions and 85 deletions.
110 changes: 110 additions & 0 deletions Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Set the texture minification and magnification filters of an imagery layer.">
<meta name="cesium-sandcastle-labels" content="Beginner, Tutorials, Showcases">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">

<style>
@import url(../templates/bucket.css);

#slider {
position: absolute;
left: 50%;
top: 0px;
background-color: #D3D3D3;
width: 2px;
height: 100%;
z-index: 9999;
}

#slider:hover {
cursor: ew-resize;
}

</style>

<div id="cesiumContainer" class="fullSize">
<div id="slider"></div>
</div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>

<script id="cesium_sandcastle_script">


function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.camera.flyTo({destination : new Cesium.Rectangle.fromDegrees(-84, 43, -80, 47)});

var layers = viewer.imageryLayers;
layers.removeAll();

var layerLinear = layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider({
url : require.toUrl('Assets/Textures/NaturalEarthII')
}));

var layerNearest = layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider({
url : require.toUrl('Assets/Textures/NaturalEarthII')
}));

// Set the texture minification and magnification filters of layerNearest. Default is LINEAR.
layerNearest.minificationFilter = Cesium.TextureMinificationFilter.NEAREST;
layerNearest.magnificationFilter = Cesium.TextureMagnificationFilter.NEAREST;

// The remaining code installs a split layer so the effect of the texture filters becomes apparent.

layerNearest.splitDirection = Cesium.ImagerySplitDirection.RIGHT;

var slider = document.getElementById('slider');
viewer.scene.imagerySplitPosition = (slider.offsetLeft) / slider.parentElement.offsetWidth;

var dragStartX = 0;

document.getElementById('slider').addEventListener('mousedown', mouseDown, false);
window.addEventListener('mouseup', mouseUp, false);

function mouseUp() {
window.removeEventListener('mousemove', sliderMove, true);
}

function mouseDown(e) {
var slider = document.getElementById('slider');
dragStartX = e.clientX - slider.offsetLeft;
window.addEventListener('mousemove', sliderMove, true);
}

function sliderMove(e) {
var slider = document.getElementById('slider');
var splitPosition = (e.clientX - dragStartX) / slider.parentElement.offsetWidth;
slider.style.left = 100.0 * splitPosition + "%";
viewer.scene.imagerySplitPosition = splitPosition;
}
//Sandcastle_End

Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>

</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Change Log
==========

### 1.39 - 2017-11-01

* Added the ability to load Cesium's assets from the local file system if security permissions allow it. [#5830](https://github.com/AnalyticalGraphicsInc/cesium/issues/5830)
* Added function that inserts missing namespace declarations into KML files. [#5860](https://github.com/AnalyticalGraphicsInc/cesium/pull/5860)
* Added support for the layer.json `parentUrl` property in `CesiumTerrainProvider` to allow for compositing of tilesets.
* Fixed a bug that caused KML ground overlays to appear distorted when rotation was applied. [#5914](https://github.com/AnalyticalGraphicsInc/cesium/issues/5914)
* Added two new properties to `ImageryLayer` that allow for adjusting the texture sampler used for up- and down-sampling of image tiles, namely `minificationFilter` and `magnificationFilter` with possible values `LINEAR` (the default) and `NEAREST` defined in `TextureMinificationFilter` and `TextureMagnificationFilter`. [#5846](https://github.com/AnalyticalGraphicsInc/cesium/issues/5846)
* The enums `TextureMinificationFilter` and `TextureMagnificationFilter` have been made public to support the new texture filter properties mentioned above.
* KML files load when a Network Link fails [#5871](https://github.com/AnalyticalGraphicsInc/cesium/pull/5871)
* Adds `invertClassification` and `invertClassificationColor` to `Scene`. When `invertClassification` is `true`, any 3D Tiles geometry that is not classified by a `ClassificationPrimitive` or `GroundPrimitive` will have its color multiplied by `invertClassificationColor`. [#5836](https://github.com/AnalyticalGraphicsInc/cesium/pull/5836)
* Added `eyeSeparation` and `focalLength` properties to `Scene` to configure VR settings. [#5917](https://github.com/AnalyticalGraphicsInc/cesium/pull/5917)
Expand Down
28 changes: 27 additions & 1 deletion Source/Renderer/TextureMagnificationFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,38 @@ define([
'use strict';

/**
* @private
* Enumerates all possible filters used when magnifying WebGL textures, which takes places when zooming
* into imagery. Provides the possible values for the {@link ImageryLayer#magnificationFilter} property.
*
* @exports TextureMagnificationFilter
*
* @see TextureMinificationFilter
* @see ImageryLayer#magnificationFilter
*/
var TextureMagnificationFilter = {
/**
* Nearest neighbor sampling of image pixels to texture.
*
* @type {Number}
* @constant
*/
NEAREST : WebGLConstants.NEAREST,
/**
* Bi-linear interpolation of image pixels to texture.
*
* @type {Number}
* @constant
*/
LINEAR : WebGLConstants.LINEAR,

/**
* Validates the given <code>textureMinificationFilter</code> with respect to the possible enum values.
*
* @private
*
* @param textureMagnificationFilter
* @returns {Boolean} <code>true</code> if <code>textureMagnificationFilter</code> is valid.
*/
validate : function(textureMagnificationFilter) {
return ((textureMagnificationFilter === TextureMagnificationFilter.NEAREST) ||
(textureMagnificationFilter === TextureMagnificationFilter.LINEAR));
Expand Down
52 changes: 51 additions & 1 deletion Source/Renderer/TextureMinificationFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,66 @@ define([
'use strict';

/**
* @private
* Enumerates all possible filters used when minifying WebGL textures, which takes places when zooming
* out of imagery. Provides the possible values for the {@link ImageryLayer#minificationFilter} property.
*
* @exports TextureMinificationFilter
*
* @see TextureMagnificationFilter
* @see ImageryLayer#minificationFilter
*/
var TextureMinificationFilter = {
/**
* Nearest neighbor sampling of image pixels to texture.
*
* @type {Number}
* @constant
*/
NEAREST : WebGLConstants.NEAREST,
/**
* Bi-linear interpolation of image pixels to texture.
*
* @type {Number}
* @constant
*/
LINEAR : WebGLConstants.LINEAR,
/**
* WebGL <code>NEAREST_MIPMAP_NEAREST</code> interpolation of image pixels to texture.
*
* @type {Number}
* @constant
*/
NEAREST_MIPMAP_NEAREST : WebGLConstants.NEAREST_MIPMAP_NEAREST,
/**
* WebGL <code>LINEAR_MIPMAP_NEAREST</code> interpolation of image pixels to texture.
*
* @type {Number}
* @constant
*/
LINEAR_MIPMAP_NEAREST : WebGLConstants.LINEAR_MIPMAP_NEAREST,
/**
* WebGL <code>NEAREST_MIPMAP_LINEAR</code> interpolation of image pixels to texture.
*
* @type {Number}
* @constant
*/
NEAREST_MIPMAP_LINEAR : WebGLConstants.NEAREST_MIPMAP_LINEAR,
/**
* WebGL <code>LINEAR_MIPMAP_LINEAR</code> interpolation of image pixels to texture.
*
* @type {Number}
* @constant
*/
LINEAR_MIPMAP_LINEAR : WebGLConstants.LINEAR_MIPMAP_LINEAR,

/**
* Validates the given <code>textureMinificationFilter</code> with respect to the possible enum values.
*
* @private
*
* @param textureMinificationFilter
* @returns {Boolean} <code>true</code> if <code>textureMinificationFilter</code> is valid.
*/
validate : function(textureMinificationFilter) {
return ((textureMinificationFilter === TextureMinificationFilter.NEAREST) ||
(textureMinificationFilter === TextureMinificationFilter.LINEAR) ||
Expand Down
Loading

0 comments on commit 6b6f55c

Please sign in to comment.