Skip to content

Commit

Permalink
Merge branch 'master' into oriented-bounding-box
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Jun 24, 2015
2 parents d6a7389 + e0f1a72 commit 37ae29a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/ArcGIS MapServer.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// Add an ArcGIS MapServer imagery layer
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.ArcGisMapServerImageryProvider({
url : 'http://www.ga.gov.au/gis/rest/services/earth_science/GA_Surface_Geology_of_Australia_WM/MapServer'
url : '//nationalmap.gov.au/proxy/http://www.ga.gov.au/gis/rest/services/earth_science/GA_Surface_Geology_of_Australia_WM/MapServer'
}));

// Start off looking at Australia.
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Interpolation.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

//Use STK World Terrain
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : '//cesiumjs.org/stk-terrain/world',
url : '//assets.agi.com/stk-terrain/world',
requestWaterMask : true,
requestVertexNormals : true
});
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Web Map Service (WMS).html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// Add a WMS imagery layer
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url : 'http://nationalmap.nicta.com.au/proxy/http://geoserver.nationalmap.nicta.com.au/geotopo_250k/ows',
url : '//nationalmap.gov.au/proxy/http://geoserver.nationalmap.nicta.com.au/geotopo_250k/ows',
layers : 'Hydrography:bores',
parameters : {
transparent : true,
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Change Log
### 1.11 - 2015-07-01

* Deprecated
* The STK World Terrain url `cesiumjs.org/stk-terrain/world` has been deprecated, use `assets.agi.com/stk-terrain/world` instead. A redirect will be in place until 1.14.
* Deprecated `AxisAlignedBoundingBox.intersect` and `BoundingSphere.intersect`. These will be removed in 1.13. Use `.intersectPlane` and, if necessary, `Plane.fromCartesian4`.
* Deprecated the `ObjectOrientedBoundingBox` class. It will be removed in 1.12. Use `OrientedBoundingBox` instead.
* Improved the algorithm that `Camera.viewRectangle` uses to select the position of the camera, so that the specified rectangle is now better centered on the screen [#2764](https://github.com/AnalyticalGraphicsInc/cesium/issues/2764).
Expand All @@ -15,6 +16,7 @@ Change Log
* Added `UrlTemplateImageryProvider`. This new imagery provider allows access to a wide variety of imagery sources, including OpenStreetMap, TMS, WMTS, WMS, WMS-C, and various custom schemes, by specifying a URL template to use to request imagery tiles.
* The camera now zooms to the point under the mouse cursor.
* Fixed a bug in `ImageryLayer` that could cause an exception and the render loop to stop when the base layer did not cover the entire globe.
* Fixed flash/streak rendering artifacts when picking [#2790](https://github.com/AnalyticalGraphicsInc/cesium/issues/2790), [#2811](https://github.com/AnalyticalGraphicsInc/cesium/issues/2811).
* Added `Plane.fromCartesian4` to convert old `Cartesian4` plane representations to the new `Plane` format.
* Added `Plane.ORIGIN_XY_PLANE`/`ORIGIN_YZ_PLANE`/`ORIGIN_ZX_PLANE` constants for commonly-used planes.
* Added `Matrix2`/`Matrix3`/`Matrix4.ZERO` constants for zero matrices.
Expand Down
12 changes: 6 additions & 6 deletions Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ define([

this._us = us;
this._currentRenderState = rs;
this._currentPassState = ps;
this._currentFramebuffer = undefined;
this._maxFrameTextureUnitIndex = 0;

Expand Down Expand Up @@ -1703,12 +1704,11 @@ define([
}

function applyRenderState(context, renderState, passState) {
var previousState = context._currentRenderState;
if (previousState !== renderState) {
context._currentRenderState = renderState;
RenderState.partialApply(context._gl, previousState, renderState, passState);
}
// else same render state as before so state is already applied.
var previousRenderState = context._currentRenderState;
var previousPassState = context._currentPassState;
context._currentRenderState = renderState;
context._currentPassState = passState;
RenderState.partialApply(context._gl, previousRenderState, renderState, previousPassState, passState);
}

var scratchBackBufferArray;
Expand Down
64 changes: 37 additions & 27 deletions Source/Renderer/RenderState.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,15 @@ define([
applyCull(gl, renderState);
applyLineWidth(gl, renderState);
applyPolygonOffset(gl, renderState);
applyScissorTest(gl, renderState, passState);
applyDepthRange(gl, renderState);
applyDepthTest(gl, renderState);
applyColorMask(gl, renderState);
applyDepthMask(gl, renderState);
applyStencilMask(gl, renderState);
applyBlending(gl, renderState, passState);
applyStencilTest(gl, renderState);
applySampleCoverage(gl, renderState);
applyScissorTest(gl, renderState, passState);
applyBlending(gl, renderState, passState);
applyViewport(gl, renderState, passState);
};

Expand All @@ -472,9 +472,6 @@ define([
funcs.push(applyPolygonOffset);
}

// For now, always apply because of passState
funcs.push(applyScissorTest);

if ((previousState.depthRange.near !== nextState.depthRange.near) || (previousState.depthRange.far !== nextState.depthRange.far)) {
funcs.push(applyDepthRange);
}
Expand All @@ -494,9 +491,6 @@ define([
funcs.push(applyDepthMask);
}

// For now, always apply because of passState
funcs.push(applyBlending);

if (previousState.stencilMask !== nextState.stencilMask) {
funcs.push(applyStencilMask);
}
Expand All @@ -520,28 +514,44 @@ define([
funcs.push(applySampleCoverage);
}

// For now, always apply because of passState
funcs.push(applyViewport);

return funcs;
}

RenderState.partialApply = function(gl, previousState, nextState, passState) {
// When a new render state is applied, instead of making WebGL calls for all the states or first
// comparing the states one-by-one with the previous state (basically a linear search), we take
// advantage of RenderState's immutability, and store a dynamically populated sparse data structure
// containing functions that make the minimum number of WebGL calls when transitioning from one state
// to the other. In practice, this works well since state-to-state transitions generally only require a
// few WebGL calls, especially if commands are stored by state.
var funcs = nextState._applyFunctions[previousState.id];
if (!defined(funcs)) {
funcs = createFuncs(previousState, nextState);
nextState._applyFunctions[previousState.id] = funcs;
}

var len = funcs.length;
for (var i = 0; i < len; ++i) {
funcs[i](gl, nextState, passState);
RenderState.partialApply = function(gl, previousRenderState, renderState, previousPassState, passState) {
if (previousRenderState !== renderState) {
// When a new render state is applied, instead of making WebGL calls for all the states or first
// comparing the states one-by-one with the previous state (basically a linear search), we take
// advantage of RenderState's immutability, and store a dynamically populated sparse data structure
// containing functions that make the minimum number of WebGL calls when transitioning from one state
// to the other. In practice, this works well since state-to-state transitions generally only require a
// few WebGL calls, especially if commands are stored by state.
var funcs = renderState._applyFunctions[previousRenderState.id];
if (!defined(funcs)) {
funcs = createFuncs(previousRenderState, renderState);
renderState._applyFunctions[previousRenderState.id] = funcs;
}

var len = funcs.length;
for (var i = 0; i < len; ++i) {
funcs[i](gl, renderState);
}
}

var previousScissorTest = (defined(previousPassState.scissorTest)) ? previousPassState.scissorTest : previousRenderState.scissorTest;
var scissorTest = (defined(passState.scissorTest)) ? passState.scissorTest : renderState.scissorTest;
if (previousScissorTest !== scissorTest) {
applyScissorTest(gl, renderState, passState);
}

var previousBlendingEnabled = (defined(previousPassState.blendingEnabled)) ? previousPassState.blendingEnabled : previousRenderState.blending.enabled;
var blendingEnabled = (defined(passState.blendingEnabled)) ? passState.blendingEnabled : renderState.blending.enabled;
if ((previousBlendingEnabled !== blendingEnabled) ||
(blendingEnabled && (previousRenderState.blending !== renderState.blending))) {
applyBlending(gl, renderState, passState);
}

if (previousRenderState !== renderState || previousPassState.context !== passState.context) {
applyViewport(gl, renderState, passState);
}
};

Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ define([
* // Create a polyline collection with two polylines
* var polylines = new Cesium.PolylineCollection();
* polylines.add({
* position : Cesium.Cartesian3.fromDegreesArray([
* positions : Cesium.Cartesian3.fromDegreesArray([
* -75.10, 39.57,
* -77.02, 38.53,
* -80.50, 35.14,
Expand Down

0 comments on commit 37ae29a

Please sign in to comment.