Enables/disables reflection rendering system (1=enable reflection material, 0=restore original materials).
Takes entity (reflective entity handle), enable (1 to enable, 0 to disable).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
entityInt
enableInt
Returns
Void
Quick Summary
Enables/disables reflection rendering system (1=enable reflection material, 0=restore original materials).
Takes entity (reflective entity handle), enable (1 to enable, 0 to disable).
Returns nothing.
Technical Exegesis...
Enables/disables reflection rendering system (1=enable reflection material, 0=restore original materials). Takes entity (reflective entity handle), enable (1 to enable, 0 to disable). Returns nothing. Validates entity is reflective and surface-based, if state changing: enable=1 applies reflection material to all surfaces, enable=0 restores original materials, sets mesh.needsGPUUpload flag, updates entity.reflectionEnabled state.
Enables/disables reflection rendering system (1=enable reflection material, 0=restore original materials). Takes entity (reflective entity handle), enable (1 to enable, 0 to disable). Returns nothing. Validates entity is reflective and surface-based, if state changing: enable=1 applies reflection material to all surfaces, enable=0 restores original materials, sets mesh.needsGPUUpload flag, updates entity.reflectionEnabled state. Controls entire reflection system on/off without destroying reflection camera or textures.
This function toggles reflection rendering without recreating resources. Material swapping: reflective entities have two material sets: (1) original materials (stored in reflectionOriginalMaterialIndices), (2) reflection material (stored in reflectionMaterialIndex). Enable=1: applies reflection material to all mesh surfaces (shows reflection texture), visible reflection rendering. Enable=0: restores original materials (hides reflection), shows base surface appearance without reflection. State tracking: entity.reflectionEnabled stores current state (true/false), prevents redundant material swaps if already in desired state. Use cases: (1) Toggle reflections on/off (mirror activate/deactivate effect), (2) Performance optimization (disable distant reflections), (3) Weather effects (disable water reflections during rain), (4) Cutscenes (disable reflections for performance), (5) Graphics quality settings (user preference). Common pattern: water=b3dCreateReflectiveGrid(...), b3dEnableReflection(water, 0), disables reflection initially (shows base grid), later b3dEnableReflection(water, 1) activates reflection. GPU upload: sets needsGPUUpload flag to rebuild buffers with new material assignments (deferred until render). Material preservation: original materials stored when reflection created, never lost (can toggle on/off repeatedly). Reflection camera: remains active when disabled (still renders but texture not applied to surface), camera can be hidden separately if needed. Performance: disabling saves material application cost but reflection camera still renders, use b3dHideEntity on reflection camera to fully disable rendering. Entity requirement: must be reflective (isReflective=true) AND surface-based (isSurfaceBased=true), loaded meshes rejected. Surface iteration: applies reflection material to all surfaces in mesh when enabling, restores from reflectionOriginalMaterialIndices array when disabling. State comparison: checks current reflectionEnabled against new state, only swaps materials if state actually changing (optimization). Typical usage: create reflective surface enabled by default, disable for performance or visual effect, re-enable when needed. Related: b3dCreateReflectiveGrid creates enabled reflective surface, b3dSetEntityReflectionAlphaFX controls reflection opacity (separate from enable/disable), b3dHideEntity hides reflection camera to fully stop rendering.