Get RAPTOR

IRaptorLightBackend

Supplies the component on a placed RAPTOR light: a Bakery light when Bakery is installed, otherwise a Unity Light.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorinterfacepreview, since 0.1.0

RaptorLightBackends uses the backend that Owns a light, otherwise the active backend. The backend records Undo for every write; the caller owns the undo group.

public interface IRaptorLightBackend

Properties

Caps

RaptorLightCaps Caps { get; }

The values and light kinds this backend supports.

Id

string Id { get; }

A stable id, also used as the registry key (for example "Bakery").

IsAvailable

bool IsAvailable { get; }

Whether the backend's light components exist in this project.

Label

string Label { get; }

A short display name.

Methods

ApplyPreset

void ApplyPreset(RaptorLight light, RaptorLightPreset preset)

Writes preset's values to the light's existing component of the same family.

ParameterTypeDescription
lightRaptorLightThe light.
presetRaptorLightPresetThe preset.

CaptureInto

void CaptureInto(RaptorLight light, RaptorLightPreset preset)

Reads the light's current values into preset. Used by Save New and Push.

ParameterTypeDescription
lightRaptorLightThe light.
presetRaptorLightPresetThe preset.

Configure

void Configure(GameObject go, RaptorLightPreset preset, Vector3 normal, float offset)

Adds and configures the light component on a newly placed light. An Area light takes the preset's size and faces along normal.

ParameterTypeDescription
goGameObjectThe light's GameObject.
presetRaptorLightPresetThe preset.
normalVector3The normal of the surface the light was placed on.
offsetfloatThe distance from the surface.

GlowComponent

Component GlowComponent(GameObject go)

Returns the point-family light component on go (the one StampGlow adds), or null.

ParameterTypeDescription
goGameObjectThe light's GameObject.

Returns: The component, or null.

IsArea

bool IsArea(RaptorLight light)

Returns whether light has this backend's Area light.

ParameterTypeDescription
lightRaptorLightThe light.

Returns: True for an Area light.

KeepsUnityLight

bool KeepsUnityLight(Light light)

Returns whether light, a UnityEngine.Light on a light this backend owns, is the backend's own light and is kept when companion lights are stripped. The Bakery backend returns false, because RAPTOR's Bakery lights are bake-only and have no Light. The Unity backend keeps its Baked light and strips Realtime and Mixed ones.

ParameterTypeDescription
lightLightThe light.

Returns: True to keep the light.

LightComponent

Component LightComponent(GameObject go)

Returns this backend's light component on go, or null. The Light HUD records this component for undo.

ParameterTypeDescription
goGameObjectThe light's GameObject.

Returns: The component, or null.

Owns

bool Owns(RaptorLight light)

Returns whether light has this backend's light component.

ParameterTypeDescription
lightRaptorLightThe light.

Returns: True if it has one.

Rebuild

bool Rebuild(RaptorLight light, RaptorLightPreset preset)

Rebuilds the light component when preset's kind needs a different component family, or when the light has none.

ParameterTypeDescription
lightRaptorLightThe light.
presetRaptorLightPresetThe preset.

Returns: False when the light already has the right family.

StampGlow

Component StampGlow(GameObject go, Color color, float intensity, float range)

Adds an Omni point light for a Liquid glow and records Undo.

ParameterTypeDescription
goGameObjectThe light's GameObject.
colorColorThe glow colour.
intensityfloatThe glow intensity.
rangefloatThe glow range.

Returns: The component, or null when the backend cannot place one.

TryCaptureValues

bool TryCaptureValues(RaptorLight light, out LightValues values)

Reads the light's preset-level values.

ParameterTypeDescription
lightRaptorLightThe light.
valuesout LightValuesThe captured values.

Returns: False when the light has none of this backend's components.

WriteValues

void WriteValues(Component light, in LightValues values, RaptorLightCaps fields)

Writes the fields of values to light, a component this backend owns. The kind is not written, and RaptorLightCaps.Size is handled by placement (the Area quad, RaptorLightPlacement.AreaQuadResize). Does not record Undo; record light before calling.

ParameterTypeDescription
lightComponentThe light.
valuesin LightValuesThe values.
fieldsRaptorLightCapsWhich values to write.