Implement LineLoop using LINE_LOOP
rendering
#10643
Merged
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.
This adds a
LineLoop
Object, which usesLINE_LOOP
to draw a closed polygonal chain.I know this is a very minor optimization in most cases, as one can simply achieve the same with regular lines by adding a duplicate start vertice at the end. I've looked in the issue history and it doesn't seem to have come up before, so I hope this is considered for inclusion. In the end this is a direct feature of webgl, so making it available for use in three.js seems a good thing. Also see my use case below:
The vertice positions are dynamically calculated in the vertex shader including a newton-raphson solver logic, so I really would like to avoid the overhead to calculate the position of the start/end vertice twice. The goal is to draw orbitals for kepler elements and I already use a instanced buffered geometry with interleaved buffers, so this was the easiest way to optimize it a little further. I sure hope that my assumptions are correct that in this case the position will only be calculated once and resused in the draw call.
Tried to include the documentation and other needed hook-ins. But I probably have missed a few spots.