This pull request tries to addresses the issues described in #18.
It introduces a prototype for implementing flat end caps on the tube geometry. The end caps are designed to close the ends of the tube geometry, which enhances the overall appearance when using a standard material such as MeshPhongMaterial. However, there are a few issues that need to be addressed before this implementation can be considered complete.
Current Functionality: The current changes successfully add flat end caps to the tube geometry, controlled via a simple boolean option.
Known Issues
Mesh Topology
When switching to wireframe mode, the mesh topology reveals inconsistencies between the first and second end caps.
The second end cap (end) appears correct, featuring 1 center vertex connected to the last radial segment of the tube.
The first end cap (start), however, has redundant vertices. It includes 1 center vertex + (radialSegments + 1) rim vertices, which makes it geometrically inconsistent with the rest of the tube.
UV Textures
The UV mapping for the last segment of the tube (adjacent to the second end cap) is twisted.
The first end cap (start) also displays UV issues, likely caused by the redundant vertices. These issues prevent proper texture mapping on both ends of the tube.
Extensibility
While the current implementation allows toggling flat end caps, it lacks flexibility for future enhancements.
Future end cap types, such as round (semi-hemisphere) end caps, arrow-shaped end caps or squared (plug) end caps, cannot be easily introduced with the current design.
I have thoroughly investigated potential solutions for the issues above but was unable to resolve them with my current (very limited) knowledge level. I also reviewed the TubeBuilder.js code you provided but could not identify the cause of these problems or a way to fix them. I would appreciate if you could address the current issues (mesh topology und UV texture) and maybe make the implementation more robust for adding other types of end caps in the future. :pray:
This pull request tries to addresses the issues described in #18.
It introduces a prototype for implementing flat end caps on the tube geometry. The end caps are designed to close the ends of the tube geometry, which enhances the overall appearance when using a standard material such as MeshPhongMaterial. However, there are a few issues that need to be addressed before this implementation can be considered complete.
Current Functionality: The current changes successfully add flat end caps to the tube geometry, controlled via a simple boolean option.
Known Issues
Mesh Topology When switching to wireframe mode, the mesh topology reveals inconsistencies between the first and second end caps. The second end cap (end) appears correct, featuring 1 center vertex connected to the last radial segment of the tube. The first end cap (start), however, has redundant vertices. It includes 1 center vertex + (radialSegments + 1) rim vertices, which makes it geometrically inconsistent with the rest of the tube.
UV Textures The UV mapping for the last segment of the tube (adjacent to the second end cap) is twisted. The first end cap (start) also displays UV issues, likely caused by the redundant vertices. These issues prevent proper texture mapping on both ends of the tube.
Extensibility While the current implementation allows toggling flat end caps, it lacks flexibility for future enhancements. Future end cap types, such as round (semi-hemisphere) end caps, arrow-shaped end caps or squared (plug) end caps, cannot be easily introduced with the current design.
I have thoroughly investigated potential solutions for the issues above but was unable to resolve them with my current (very limited) knowledge level. I also reviewed the TubeBuilder.js code you provided but could not identify the cause of these problems or a way to fix them. I would appreciate if you could address the current issues (mesh topology und UV texture) and maybe make the implementation more robust for adding other types of end caps in the future. :pray: