Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the texture is not rotated, the rendering fails #4535

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/Core/RectangleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ define([
options.textureMatrix = textureMatrix;
options.tangentRotationMatrix = tangentRotationMatrix;
options.size = options.width * options.height;
options.stRotation = stRotation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually used anywhere? I traced through the code visually and didn't see this particular options object including stRotation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's used to make a textureMatrix that rotates the st coordinates

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be dense, but where is that happening? From what I can tell, only constructRectangle and constructExtrudedRectangle get called with this specific options object and neither of them use it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I see it now. Sorry for the noise.


var geometry;
var boundingSphere;
Expand Down
9 changes: 7 additions & 2 deletions Source/Core/RectangleGeometryLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ 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);

if (!options.stRotation) {
st.x = st.x * options.lonScalar;
st.y = st.y * options.latScalar;
}

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