Returns vertex red color component (0-255 integer).
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based).
Returns red component as integer (0-255) or 255 on error.
3D Graphics
Parameters & Returns
Parameters
meshInt
surfaceInt
vertexIndexInt
Returns
Int
Quick Summary
Returns vertex red color component (0-255 integer).
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based).
Returns red component as integer (0-255) or 255 on error.
Technical Exegesis...
Returns vertex red color component (0-255 integer). Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based). Returns red component as integer (0-255) or 255 on error. Validates mesh exists, type is ENTITY_MESH, is surface-based, surface index valid, and vertex index valid. Converts internal float color (0.0-1.0) to integer: (int)(color.x * 255.0f).
Returns vertex red color component (0-255 integer). Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based). Returns red component as integer (0-255) or 255 on error. Validates mesh exists, type is ENTITY_MESH, is surface-based, surface index valid, and vertex index valid. Converts internal float color (0.0-1.0) to integer: (int)(color.x * 255.0f). Returns 255 if: invalid mesh, not surface-based, invalid surface, vertex index out of range (255 = white/full intensity, error default).
This function retrieves vertex red color component for per-vertex coloring. Vertex colors multiply with texture colors during rendering: final_color = vertex_color x texture_color. Red component range: 0 = no red (black/cyan/blue/green), 255 = full red intensity. Internal storage: color.x as float (0.0 to 1.0), converted to 0-255 integer for user convenience. Return value 255 ambiguous (could be full red or error) - validate mesh/surface/vertex separately. Use cases: (1) Vertex color queries (check per-vertex tinting), (2) Color-based mesh editing (select vertices by color), (3) Vertex painting validation (verify colors applied correctly), (4) Procedural coloring (read, modify, write with b3dVertexColor), (5) Debug visualization (color vertices by property like height, slope). Common pattern: For i=0 To b3dCountVertices(mesh, surf)-1, r=b3dVertexRed(mesh, surf, i), g=b3dVertexGreen(mesh, surf, i), b=b3dVertexBlue(mesh, surf, i), If r > 200 Then Print "Vertex " + i + " is mostly red". Default color: b3dAddVertex sets color to (1, 1, 1, 1) = white (255, 255, 255, 255) - no tinting. Color multiplication: vertex color (128, 255, 64) x texture pixel (200, 100, 50) = final (100, 100, 12) after normalization. Vertex color setting: use b3dVertexColor(mesh, surf, index, r, g, b, a) to modify. RGB range: Red=0-255, Green=0-255, Blue=0-255 (standard 24-bit RGB). Typical values: 255 = full intensity (no darkening), 128 = half intensity (50% brightness), 0 = no component (removes red channel). Use cases: terrain vertex coloring (red for lava, green for grass), damage indication (red tint on damaged areas), team colors (red vs blue teams). Alternative: use material colors instead of vertex colors, apply color via shaders. Precision: integer (rounded from float), slight precision loss possible (254.4 -> 254). Performance: fast conversion and array access. Alpha separate: use b3dVertexAlpha for transparency component.