Gets entity red component (0-255 int, returns 0 on error, 255 default).
Takes entity (mesh entity handle).
Returns red component 0-255 (converted from material.baseColorFactor.x), 0 if invalid handle/non-mesh, 255 if valid mesh without material.
3D Graphics
Parameters & Returns
Parameters
entityInt
Returns
Int
Quick Summary
Gets entity red component (0-255 int, returns 0 on error, 255 default).
Takes entity (mesh entity handle).
Returns red component 0-255 (converted from material.baseColorFactor.x), 0 if invalid handle/non-mesh, 255 if valid mesh without material.
Technical Exegesis...
Gets entity red component (0-255 int, returns 0 on error, 255 default). Takes entity (mesh entity handle). Returns red component 0-255 (converted from material.baseColorFactor.x), 0 if invalid handle/non-mesh, 255 if valid mesh without material. Checks material override first then base material. Mesh entities only.
This function retrieves red color. Color conversion: reads material.baseColorFactor.x (0.0-1.0 float), converts to 0-255 int (multiply by 255.0 and cast to int).
Gets entity red component (0-255 int, returns 0 on error, 255 default). Takes entity (mesh entity handle). Returns red component 0-255 (converted from material.baseColorFactor.x), 0 if invalid handle/non-mesh, 255 if valid mesh without material. Checks material override first then base material. Mesh entities only.
This function retrieves red color. Color conversion: reads material.baseColorFactor.x (0.0-1.0 float), converts to 0-255 int (multiply by 255.0 and cast to int). Material priority: checks entity.materialOverrideIndex first (if >= 0 uses override material, allows per-entity color reading), falls back to entity.mesh->materialIndex if no override (shared material reading). Use cases: (1) Color queries (read current entity color for UI display), (2) Color restoration (save color before modification, restore later), (3) Conditional logic (if b3dGetEntityRedFX(entity) > 128 then bright red tint), (4) Color manipulation (oldRed = b3dGetEntityRedFX(entity), newRed = oldRed * 0.5 for darkening), (5) Color interpolation (lerp between current and target color). Common patterns: save color oldRed = b3dGetEntityRedFX(entity), check brightness if b3dGetEntityRedFX(entity) + b3dGetEntityGreenFX(entity) + b3dGetEntityBlueFX(entity) > 128*3 then bright, extract RGB red% = b3dGetEntityRedFX(entity%), green% = b3dGetEntityGreenFX(entity%), blue% = b3dGetEntityBlueFX(entity%). Typical usage: read color before modification for later restoration, query color for conditional logic, extract RGB components for color math, display current color in UI. PBR baseColorFactor: .x component is red channel (RGBA order x=red, y=green, z=blue, w=alpha). Material override awareness: reads from correct material (override if exists, else base), consistent with SetEntityColorFX behavior (set and get use same material). Return value semantics: 0 on error (invalid handle, non-mesh entity, prints error to stderr), 255 on valid mesh without material (white default), 0-255 on success (actual red component). Default white: meshes without materials return 255 for red (white default color 255,255,255,255). Performance: O(1) lookup (simple material access and conversion). Validation: prints error if invalid mesh handle or non-mesh entity, silently returns 255 if mesh has no material. Related: b3dGetEntityGreenFX reads green component, b3dGetEntityBlueFX reads blue component, b3dSetEntityColorFX sets RGB color, b3dGetEntityAlphaFX reads alpha component.