add param computeLength and append v_distanceCamera when needed #12343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm working on custom shader, and I've some change needed to be done, on the core of cesium that I think will help others also.
By example, the dash material for polyline will be improved later ( the dash pattern depend of the position of the camera, which make the dash pattern move when the camera move which is not nice )
To help that, I need to know the distance of the fragment shader from the first point of the polyline.
That why, I added an attribute in the class PolylineGeometry. By default it's desactived, and it can be activated with the option computeLength.
In my custom shader, I need also to know the distance of the camera, which is already done here :
cesium/packages/engine/Source/Scene/Primitive.js
Line 1004 in c403b50
so I just prepend in the vertexshader :
"out float v_distanceCamera; \n" +
when the function _appendDistanceDisplayConditionToShader is called.
which help me to show/hide, change object property in the custom shader depending of the distance of the camera from the object.
I think this will help also other.
Michael,