Reverses triangle winding order for all surfaces in mesh (flips entire mesh inside-out).
Takes mesh (surface-based mesh entity).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
meshInt
Returns
Void
Quick Summary
Reverses triangle winding order for all surfaces in mesh (flips entire mesh inside-out).
Takes mesh (surface-based mesh entity).
Returns nothing.
Technical Exegesis...
Reverses triangle winding order for all surfaces in mesh (flips entire mesh inside-out). Takes mesh (surface-based mesh entity). Returns nothing. Validates mesh exists, type is ENTITY_MESH, and is surface-based. Iterates all surfaces, for each surface swaps indices 1 and 2 of each triangle: (v0, v1, v2) becomes (v0, v2, v1). Reverses winding order mesh-wide: CCW -> CW or CW -> CCW. Sets surface->needsGPUUpload=true for all surfaces and mesh->needsGPUUpload=true. Silently returns on validation errors.
Reverses triangle winding order for all surfaces in mesh (flips entire mesh inside-out). Takes mesh (surface-based mesh entity). Returns nothing. Validates mesh exists, type is ENTITY_MESH, and is surface-based. Iterates all surfaces, for each surface swaps indices 1 and 2 of each triangle: (v0, v1, v2) becomes (v0, v2, v1). Reverses winding order mesh-wide: CCW -> CW or CW -> CCW. Sets surface->needsGPUUpload=true for all surfaces and mesh->needsGPUUpload=true. Silently returns on validation errors.
This function fixes entire inside-out meshes by reversing all face orientations. Convenience wrapper for b3dFlipSurfaceWindingOrder applied to all surfaces - equivalent to calling b3dFlipSurfaceWindingOrder for each surface individually. Winding order: Counter-Clockwise = front-facing, Clockwise = back-facing. Use cases: (1) Fix entire imported mesh with inverted normals, (2) Convert coordinate system (left-handed <-> right-handed), (3) Prepare mesh for mirror duplication, (4) Correct modeling software export issues. Common pattern: Load mesh (b3dLoadMesh), if appears dark/invisible check normals, b3dFlipMeshWindingOrder(mesh), b3dUpdateNormals(mesh) to recalculate normals pointing outward. Multi-surface meshes: processes all surfaces automatically - don't need to iterate manually. Must lock: not required, function handles iteration. GPU upload deferred: changes rendered on b3dUnlockMesh. Alternative: b3dFlipSurfaceWindingOrder for selective flipping, scale by negative (also flips but distorts), rebuild mesh with reversed topology. Normal update critical: after flipping, normals point inward (incorrect lighting) - always call b3dUpdateNormals afterward. Performance: O(T) where T=total triangle count across all surfaces. Inside-out symptoms: mesh appears black from outside (normals inward), or invisible (backface culled). Coordinate system: DirectX left-handed (Y-up, Z-forward), OpenGL right-handed (Y-up, Z-backward) - flipping converts between conventions when combined with axis swap. Use after: importing mesh from different 3D system, mirroring via negative scale (scale by -1 on X-axis flips winding, need to flip back for correct rendering). Batch operation: more efficient than manual per-surface loop for multi-surface meshes.