Returns the number of vertices in a surface.
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based).
Returns vertex count (integer, 0 or more) or 0 on error.
3D Graphics
Parameters & Returns
Parameters
meshInt
surfaceInt
Returns
Int
Quick Summary
Returns the number of vertices in a surface.
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based).
Returns vertex count (integer, 0 or more) or 0 on error.
Technical Exegesis...
Returns the number of vertices in a surface. Takes mesh (surface-based mesh entity), surface (surface handle, 0-based). Returns vertex count (integer, 0 or more) or 0 on error. Validates mesh exists, type is ENTITY_MESH, is surface-based, and surface index valid. Returns surface->vertices.size() as integer. Returns 0 if: invalid handle, not a mesh, not surface-based, invalid surface index.
This function queries vertex array size for iteration or validation.
Returns the number of vertices in a surface. Takes mesh (surface-based mesh entity), surface (surface handle, 0-based). Returns vertex count (integer, 0 or more) or 0 on error. Validates mesh exists, type is ENTITY_MESH, is surface-based, and surface index valid. Returns surface->vertices.size() as integer. Returns 0 if: invalid handle, not a mesh, not surface-based, invalid surface index.
This function queries vertex array size for iteration or validation. Vertex count starts at 0 for newly created surface (b3dCreateSurface), increments with each b3dAddVertex call, decrements with b3dDeleteVertex. Return value 0 ambiguous (could be valid empty surface or error) - check mesh/surface validity separately if needed. Use cases: (1) Vertex iteration loops (For i=0 To b3dCountVertices(mesh, surf)-1), (2) Validation before access (If vertexIndex < b3dCountVertices(mesh, surf) Then...), (3) Debug info (Print "Surface has " + b3dCountVertices(mesh, surf) + " vertices"). Vertex indices 0-based: valid indices range from 0 to (count-1). Empty surface valid: surface with 0 vertices legal but not renderable (needs at least 1 triangle = 3 vertices). Maximum vertices: no hard limit, constrained by memory and GPU buffer size (practical limit ~millions). Each vertex = position + normal + UV + color + tangent/bitangent (48-128 bytes depending on texture slots). Alternative: track vertex count in own variables if created sequentially. Fast operation - simple array size query. Common pattern: count=b3dCountVertices(mesh, surf), For i=0 To count-1, x=b3dVertexX(mesh, surf, i), process vertex data. Vertex count may differ between surfaces - each surface has independent vertex array. Loaded meshes (b3dLoadMesh) return 0 - not surface-based, use different query methods.