WireframeGeometry
WireframeGeometry ⟵ BufferGeometry
A geometry class that creates wireframe representation of any BufferGeometry.
WireframeGeometry takes any BufferGeometry and creates a wireframe version by extracting edges from the geometry's faces. This is useful for debugging, visualization, and creating wireframe effects on any 3D object.
Methods
WireframeGeometry(BufferGeometry* geometry)
Constructor that creates wireframe from existing geometry
| geometry | Source geometry to create wireframe from | nullptr |
WireframeGeometry* clone() const
Creates a copy of this geometry
void copy(const WireframeGeometry& geometry)
Copies properties from another geometry
| geometry | Source geometry to copy from |
void setFromGeometry(BufferGeometry* geometry)
Updates wireframe from new source geometry
| geometry | Source geometry to create wireframe from |
void enableVertexColors(bool enable, const Color& color)
Toggles per-vertex coloring and sets wireframe color
| enable | Enable or disable vertex colors | |
| color | RGBA color used when enabled | 0xFFFFFFFF |
void setLineColor(const Color& color)
Sets the per-vertex line color without toggling
| color | RGBA color value |
void buildWireframe()
Builds the wireframe geometry from source geometry
void dispose()
Frees GPU-related resources
void extractEdges()
Extracts unique edges from the source geometry
void addEdge(u16 v1, u16 v2)
Adds an edge to the wireframe if not already present
| v1 | First vertex index of the edge | |
| v2 | Second vertex index of the edge |
bool isUniqueEdge(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, std::set<std::string>& edges)
Checks if an edge is unique and adds it to the set
| x1,y1,z1 | First vertex position | |
| x2,y2,z2 | Second vertex position | |
| edges | Set of existing edge hashes |
std::string createEdgeHash(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2)
Creates a hash string for edge uniqueness checking
| x1,y1,z1 | First vertex position | |
| x2,y2,z2 | Second vertex position |
Properties
| sourceGeometry | BufferGeometry * | Source geometry to create wireframe from |
| useVertexColors | bool | emit per |
| lineColor | Color | color used when useVertexColors is true (RGBA) |