Blitz3D+ Command Reference

PlanarReflectionEnabled reflection[,enabled]

Parameters

reflection - live managed reflection handle

enabled (optional) - non-zero enables capture (default); zero disables it

Description

Enables or disables a reflection's capture without changing receiver associations or materials.

Disabling retires its capture resources safely and uses each receiver's explicit fallback. Enabling resumes updates when a supported receiver is potentially visible and the source camera faces the plane.

Disabled, hidden, back-facing or unavailable views never reuse an old reflection image. A disabled handle does not count toward the two-enabled-planes-per-camera limit; enabling a third reports an error.

The mirror material uses FallbackColor, optional panoramic FallbackTexture and FallbackIntensity. Associated water uses its equivalent controls for the reflection component while retaining its other water settings. Shader Strength zero only changes the material weight; use this command to stop capture work.

Requires Extended mode.

See also: CreatePlanarReflection, PlanarReflectionSettings, EntityPlanarReflection, FreePlanarReflection.

Example

; Extended mode. A finite vertical mirror reflects the moving marker.
Graphics3D 800,600,0,2
SetBuffer BackBuffer()
camera=CreateCamera():PositionEntity camera,3,2.7,-7
light=CreateLight():RotateEntity light,35,-25,0
AmbientLight 65,65,65
plane=CreatePivot():PositionEntity plane,0,1.8,3:RotateEntity plane,-90,0,0
PointEntity camera,plane
mirror=CreateMesh():surface=CreateSurface(mirror)
AddVertex surface,-2,0,-1.5,0,0:AddVertex surface,2,0,-1.5,1,0
AddVertex surface,2,0,1.5,1,1:AddVertex surface,-2,0,1.5,0,1
AddTriangle surface,0,3,1:AddTriangle surface,1,3,2:UpdateNormals mirror
PositionEntity mirror,0,1.8,3:RotateEntity mirror,-90,0,0
material=LoadShader("builtin:planar-reflection")
ShaderColor material,"FallbackColor",35,65,80
EntityShader mirror,material
reflection=CreatePlanarReflection(camera,plane)
EntityPlanarReflection mirror,reflection
marker=CreateCone(16):ScaleEntity marker,.55,1.2,.55:PositionEntity marker,-1.4,1,-4
EntityColor marker,240,160,35
arm=CreateCylinder(12,True,marker):ScaleEntity arm,.12,.9,.12
RotateEntity arm,0,0,90:PositionEntity arm,.7,.4,0:EntityColor arm,50,170,190
floor=CreatePlane():PositionEntity floor,0,-.3,0:EntityColor floor,40,50,65
active=True:scale#=.5
While Not KeyHit(1)
    TurnEntity marker,0,.4,0
    If KeyHit(57) Then active=Not active:PlanarReflectionEnabled reflection,active
    RenderWorld
    Text 12,12,"Space toggles capture and its fallback; Esc exits"
    Flip
Wend
FreePlanarReflection reflection
FreeShader material
ClearWorld
End

Index