b3dUnweldVertices

Duplicates vertices so each triangle has its own unique set of vertices (opposite of welding). Takes mesh (mesh entity handle). Returns nothing. Mesh must be locked before calling.

3D Graphics

Parameters & Returns

Parameters

mesh Int

Returns

void

Quick Summary

Duplicates vertices so each triangle has its own unique set of vertices (opposite of welding). Takes mesh (mesh entity handle). Returns nothing. Mesh must be locked before calling.

Technical Exegesis...

Duplicates vertices so each triangle has its own unique set of vertices (opposite of welding). Takes mesh (mesh entity handle). Returns nothing. Mesh must be locked before calling (use b3dLockMesh). Validates entity exists and type is ENTITY_MESH. Validates mesh is surface-based. Requires mesh to be locked (errors if not locked). For each triangle, duplicates its three vertices into new unique vertices. Updates indices to point to newly duplicated vertices (sequential: 0,1,2,3,4,5...).

Example

Example.bam
; Create a subdivided sphere with duplicate vertices
Local sphere:Int = b3dCreateSphere(1, 0, 0, 16)

b3dLockMesh(sphere)
b3dSubdivideMesh(sphere, 2, 1, 0.5)  ; Creates duplicates

; Count before welding
Local beforeWeld:Int = b3dCountVertices(sphere, 0)
Print("Before weld: " + ToString(beforeWeld) + " vertices")

; Weld to merge duplicates (good for smooth shapes)
b3dWeldVertices(sphere, 0.01)
Local afterWeld:Int = b3dCountVertices(sphere, 0)
Print("After weld: " + ToString(afterWeld) + " vertices")

; If we wanted flat shading instead (unusual for sphere):
b3dUnweldVertices(sphere)         ; Split back
b3dUpdateNormalsFlat(sphere)      ; Calculate flat normals
Local afterUnweld:Int = b3dCountVertices(sphere, 0)
Print("After unweld: " + ToString(afterUnweld) + " vertices")

b3dUnlockMesh(sphere)

; Result: Sphere now has faceted/low-poly appearance