Skip to content

Commit

Permalink
scale geometric error alongside tileset
Browse files Browse the repository at this point in the history
  • Loading branch information
geoscan-builder committed Dec 7, 2018
1 parent 92817d1 commit 3632059
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
11 changes: 11 additions & 0 deletions Source/Core/Matrix4.js
Original file line number Diff line number Diff line change
Expand Up @@ -2149,6 +2149,10 @@ define([
return result;
};


var UNIT = new Cartesian3(1, 1, 1);
var scratchScale = new Cartesian3();

/**
* Gets the upper left 3x3 rotation matrix of the provided matrix, assuming the matrix is a affine transformation matrix.
*
Expand Down Expand Up @@ -2186,6 +2190,13 @@ define([
result[6] = matrix[8];
result[7] = matrix[9];
result[8] = matrix[10];
Matrix3.multiplyByScale(
result,
Cartesian3.divideComponents(
UNIT, Matrix3.getScale(result, scratchScale), scratchScale
),
result
)
return result;
};

Expand Down
16 changes: 12 additions & 4 deletions Source/Scene/Cesium3DTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ define([
* @type {Number}
* @readonly
*/
this.geometricError = header.geometricError;
this._geometricError = header.geometricError;

if (!defined(this.geometricError)) {
this.geometricError = defined(parent) ? parent.geometricError : tileset._geometricError;
if (!defined(this._geometricError)) {
this._geometricError = defined(parent) ? parent.geometricError : tileset._geometricError;
Cesium3DTile._deprecationWarning('geometricErrorUndefined', 'Required property geometricError is undefined for this tile. Using parent\'s geometric error instead.');
}

Expand Down Expand Up @@ -349,6 +349,8 @@ define([
// This can be overridden for testing purposes
Cesium3DTile._deprecationWarning = deprecationWarning;

var scratchScale = new Cartesian3();

defineProperties(Cesium3DTile.prototype, {
/**
* The tileset containing this tile.
Expand Down Expand Up @@ -602,7 +604,13 @@ define([
get : function() {
return this._commandsLength;
}
}
},

geometricError : {
get : function() {
return Cartesian3.maximumComponent(Matrix4.getScale(this.computedTransform, scratchScale)) * this._geometricError;
}
}
});

var scratchJulianDate = new JulianDate();
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/PointCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ define([
vs += ' v_color = color; \n' +
' gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n';

if (usesNormals && backFaceCulling) {
if (usesNormals && true) {
vs += ' float visible = step(-normal.z, 0.0); \n' +
' gl_Position *= visible; \n' +
' gl_PointSize *= visible; \n';
Expand Down

0 comments on commit 3632059

Please sign in to comment.