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

add param computeLength and append v_distanceCamera when needed #12343

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mickae1
Copy link

@mickae1 mickae1 commented Nov 27, 2024

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 :

" distanceSq = max(distanceSq, 0.0); \n" +

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,

Copy link

Thank you for the pull request, @mickae1!

✅ We can confirm we have a CLA on file for you.

…parameter to the custom shader, usefull for dash polyline

add out float v_distanceCamera when Primitive._appendDistanceDisplayConditionToShader is running
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant