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

Polyline Fixes #711

Merged
merged 4 commits into from
Apr 30, 2013
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 7 additions & 3 deletions Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ define([
};

var emptyArray = [];
var scracthBoundingSphere = new BoundingSphere();

/**
* @private
Expand Down Expand Up @@ -449,10 +450,13 @@ define([
if (frameState.mode === SceneMode.SCENE3D) {
boundingVolume = this._boundingVolume;
modelMatrix = this.modelMatrix;
} else if (frameState.mode === SceneMode.COLUMBUS_VIEW || frameState.mode === SceneMode.SCENE2D) {
} else if (frameState.mode === SceneMode.COLUMBUS_VIEW) {
boundingVolume = this._boundingVolume2D;
} else {
boundingVolume = this._boundingVolume && this._boundingVolume2D && this._boundingVolume.union(this._boundingVolume2D);
} else if (frameState.mode === SceneMode.SCENE2D) {
boundingVolume = BoundingSphere.clone(this._boundingVolume2D, scracthBoundingSphere);
boundingVolume.center.x = 0.0;
} else if (typeof this._boundingVolume !== 'undefined' && typeof this._boundingVolume2D !== 'undefined') {
boundingVolume = BoundingSphere.union(this._boundingVolume, this._boundingVolume2D, scracthBoundingSphere);
}

var pass = frameState.passes;
Expand Down
7 changes: 7 additions & 0 deletions Source/Shaders/PolylineVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ void clipLineSegmentToNearPlane(

void main()
{
// cull if width is less than 1.0
if (abs(texCoordExpandWidthAndShow.z) < 1.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

While I'm fine with this. From a pure technical standpoint, should this be <= 0.0 instead of < 1.0? Is a width between 0 and 1 never valid use case? @pjcozzi ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest not doing this check here at all. A more efficient and convenient solution is to write the show component in the vertex data as (show && width > 0.0). For example, see writeOriginAndShow in BillboardCollection.js.

As for widths less than 1.0, I would have to try it.

{
gl_Position = czm_projection * vec4(0.0, 0.0, 0.0, 1.0);
return;
}

float texCoord = texCoordExpandWidthAndShow.x;
float expandDir = texCoordExpandWidthAndShow.y;
float width = abs(texCoordExpandWidthAndShow.z) + 0.5;
Expand Down