Skip to content

Commit

Permalink
Fixed additional texture rotation issue. See Issue CesiumGS#2737.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhipps committed Oct 24, 2016
1 parent 4a6d632 commit 941790b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Source/Core/RectangleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,12 @@ define([
}
}

var XRANGE = (maxX - minX);
var YRANGE = (maxY - minY);
if (vertexFormat.st && (minX < 0.0 || minY < 0.0 || maxX > 1.0 || maxY > 1.0)) {
for (var k = 0; k < textureCoordinates.length; k += 2) {
textureCoordinates[k] = (textureCoordinates[k] - minX) / (maxX - minX);
textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minY) / (maxY - minY);
textureCoordinates[k] = (textureCoordinates[k] - minX) / XRANGE;
textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minY) / YRANGE;
}
}

Expand Down Expand Up @@ -796,8 +798,6 @@ define([
Matrix3.clone(Matrix3.IDENTITY, tangentRotationMatrix);
}

options.lonScalar = 1.0 / rectangle.width;
options.latScalar = 1.0 / rectangle.height;
options.vertexFormat = vertexFormat;
options.textureMatrix = textureMatrix;
options.tangentRotationMatrix = tangentRotationMatrix;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/RectangleGeometryLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ define([
position.z = kZ / gamma;

if (defined(options.vertexFormat) && options.vertexFormat.st) {
st.x = (stLongitude - rectangle.west) * options.lonScalar;
st.y = (stLatitude - rectangle.south) * options.latScalar;
st.x = (stLongitude - rectangle.west);
st.y = (stLatitude - rectangle.south);

Matrix2.multiplyByVector(options.textureMatrix, st, st);
}
Expand Down

0 comments on commit 941790b

Please sign in to comment.