Skip to content

Commit

Permalink
Merge pull request #5367 from klingerj/billboard-alignment-fix
Browse files Browse the repository at this point in the history
Fixed the billboard alignedaxis issue.
  • Loading branch information
bagnell authored May 25, 2017
2 parents 8905593 + 790067b commit 6eb0439
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Change Log
* Updated documentation for Quaternion.fromHeadingPitchRoll [#5264](https://github.com/AnalyticalGraphicsInc/cesium/issues/5264)
* Fixed an issue where using the depth fail material for polylines would cause a crash in Edge. [#5359](https://github.com/AnalyticalGraphicsInc/cesium/pull/5359)
* Fixed a crash where EllipsoidGeometry and EllipsoidOutlineGeometry were given floating point values when expecting integers. [#5260](https://github.com/AnalyticalGraphicsInc/cesium/issues/5260)
* Fixed an issue where billboards were not properly aligned. [#2487](https://github.com/AnalyticalGraphicsInc/cesium/issues/2487)

### 1.33 - 2017-05-01

Expand Down
8 changes: 3 additions & 5 deletions Source/Shaders/BillboardCollectionVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ vec4 computePositionWindowCoordinates(vec4 positionEC, vec2 imageSize, float sca
float angle = rotation;
if (validAlignedAxis)
{
vec3 pos = positionEC.xyz + czm_encodedCameraPositionMCHigh + czm_encodedCameraPositionMCLow;
vec3 normal = normalize(cross(alignedAxis, pos));
vec4 tangent = vec4(normalize(cross(pos, normal)), 0.0);
tangent = czm_modelViewProjection * tangent;
angle += sign(-tangent.x) * acos(tangent.y / length(tangent.xy));
vec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);
angle += sign(-projectedAlignedAxis.x) * acos( sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y) );
}

float cosTheta = cos(angle);
Expand Down

0 comments on commit 6eb0439

Please sign in to comment.