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
support Lines in glTFloader #754
Comments
or is there a way to render a mesh (data from glb file) as a wireframe? where can I adjust the source? please give me a hint |
Here is all the gltf handling: https://github.com/x3dom/x3dom/blob/master/src/util/glTF/ The final render function called from gfx_webgl.js is here: https://github.com/x3dom/x3dom/blob/master/src/util/glTF/glTFContainer.js#L96 Here is the TODO for points and lines: https://github.com/x3dom/x3dom/blob/master/src/util/glTF/glTFLoader.js#L165 but it appears that loadPrimitive() is not used. Instead, the very similar .loadgltfMesh() is used https://github.com/x3dom/x3dom/blob/master/src/util/glTF/glTFLoader.js#L234 and would need the POINT and LINE handling instead, at the equivalent places. See whereever else faces or numfaces or similar are expected since lines would not have faces. https://github.com/x3dom/x3dom/blob/master/src/nodes/Rendering/IndexedLineSet.js shows how the x3dom ._mesh object needs to be constructed. gltfLoader probably already does most of this. _mesh.primType is "LINES". This is translated by gfx_webgl.js may not need adjustments but is important to walk through as well. It is large but manageable. (Ignore picking, background, foreground ..). In the end not too much code may be needed but it will take time. |
for wireframe see #756 (comment) |
thanks for your long answer. I will look into it although I have many question marks in my head for now. |
It will take a while to work through the existing render path. Thinking about it, a simpler solution may be to make polyMode here |
I looked at the gltf loader code more and went through some experiments, so I think I understand it better now. It still looks like not too much is needed. If you have a (simple) gltf v.1.0 example binary gltf with LINES primitives (primitive mode: GL_LINES (1)), I could give it a spin. Most gltf viewers and loaders probably currently only support triangles, and I could not find any gltf 1.0 examples for LINES, even in the official gltf example models: |
I created a simple python glb generator for testing purposes of glb in x3dom: https://github.com/doczoidberg/glbgenerator any ideas why x3dom throws the error?
|
You would need to step through with the debugger. |
works with the gltf 2.0 loader now. example file: https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/models/gltf/OutlinedBox/OutlinedBox.gltf |
please support Lines in the glTFloader.
I looked at the source coude and think that deeper knowledge of x3dom is necessary to implement it?
The text was updated successfully, but these errors were encountered: