Sets vertex RGBA color (RGB as 0-255 integers, Alpha as 0.0-1.0 double).
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based), r/g/b (color components 0-255 integers), a (alpha transparency 0.0-1.0 double).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
meshInt
surfaceInt
vertexIndexInt
rInt
gInt
bInt
aDouble
Returns
Void
Quick Summary
Sets vertex RGBA color (RGB as 0-255 integers, Alpha as 0.0-1.0 double).
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based), r/g/b (color components 0-255 integers), a (alpha transparency 0.0-1.0 double).
Returns nothing.
Technical Exegesis...
Sets vertex RGBA color (RGB as 0-255 integers, Alpha as 0.0-1.0 double). Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based), r/g/b (color components 0-255 integers), a (alpha transparency 0.0-1.0 double). Returns nothing. Validates mesh exists, type is ENTITY_MESH, is surface-based, surface index valid, and vertex index valid. Converts RGB to internal format: color.x = r/255.0, color.y = g/255.0, color.z = b/255.0, color.w = a.
Sets vertex RGBA color (RGB as 0-255 integers, Alpha as 0.0-1.0 double). Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based), r/g/b (color components 0-255 integers), a (alpha transparency 0.0-1.0 double). Returns nothing. Validates mesh exists, type is ENTITY_MESH, is surface-based, surface index valid, and vertex index valid. Converts RGB to internal format: color.x = r/255.0, color.y = g/255.0, color.z = b/255.0, color.w = a. Sets surface->needsGPUUpload=true and mesh->needsGPUUpload=true. Silently returns on validation errors.
This function sets vertex color for per-vertex tinting and transparency. Vertex colors multiply with texture colors during rendering: final = vertex_color x texture_color. RGB range: 0-255 integers (standard 8-bit color). Alpha range: 0.0-1.0 double (0.0 = transparent, 1.0 = opaque). IMPORTANT: RGB uses integer range 0-255, Alpha uses double range 0.0-1.0 - different types! Must lock mesh before calling. Use cases: (1) Vertex painting (artistic per-vertex colors for terrain, characters), (2) Team colors (red vs blue tinting), (3) Damage indication (red tint on damaged areas), (4) Fade effects (animate alpha for dissolve), (5) Height-based coloring (green valleys, white peaks), (6) Ambient occlusion (darken vertices in crevices). Common pattern: b3dLockMesh(mesh), For i=0 To b3dCountVertices(mesh, surf)-1, y=b3dVertexY(mesh, surf, i), If y > 10.0 Then r=255:g=255:b=255 Else r=0:g=128:b=0, b3dVertexColor(mesh, surf, i, r, g, b, 1.0), b3dUnlockMesh(mesh). Color multiplication example: vertex RGB (128, 255, 64) x texture RGB (200, 100, 50) = final RGB (100, 100, 12) after normalization. Default color: b3dAddVertex sets (255, 255, 255, 1.0) white opaque - no tinting. Alpha blending: requires material transparency enabled, GPU blends using formula: final = src x alpha + dst x (1-alpha). RGB conversion: integers divided by 255.0 to get 0.0-1.0 float for GPU. GPU upload deferred: changes rendered on b3dUnlockMesh. Alternative: material colors (entire mesh), texture colors (per-pixel). Performance: O(1) per vertex, vertex colors processed in vertex shader. Precision: RGB integers (no loss), Alpha double->float (slight loss). Typical values: white=(255,255,255,1.0), black=(0,0,0,1.0), half-transparent=(255,255,255,0.5).