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

Implement LineLoop using LINE_LOOP rendering #10643

Merged
merged 1 commit into from Jan 28, 2017

Conversation

mgreter
Copy link
Contributor

@mgreter mgreter commented Jan 24, 2017

This adds a LineLoop Object, which uses LINE_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.

@mrdoob
Copy link
Owner

mrdoob commented Jan 28, 2017

Oh! Heh... I was not aware that gltf also used LineSegments and Line names. I guess LineLoop is the least we can do in return 😁

FYI @WestLangley 😅

@mrdoob mrdoob merged commit 707d6ce into mrdoob:dev Jan 28, 2017
@mrdoob
Copy link
Owner

mrdoob commented Jan 28, 2017

Thanks!

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.

None yet

2 participants