Get RAPTOR

RaptorRtLightSources

The Ray-traced preview's light sources.

NamespaceAssemblyKindStability
Raptor.Render.EditorToolsRaptorRender.Editorclasspreview, since 0.1.0

Active follows the active light backend. When Bakery is installed, the Ray-traced preview, the Lights tool and its Inspector section read Bakery lights. A backend without a registered source reads Unity lights.

public static class RaptorRtLightSources

Fields

Bakery

public static readonly IRaptorRtLightSource Bakery;

Reads Bakery's light components by reflection when the project has Bakery.

Unity

public static readonly IRaptorRtLightSource Unity;

Reads Unity's Baked and Mixed lights (RaptorRtUnityLights).

Properties

Active

public static IRaptorRtLightSource Active { get; }

The source for the active light backend.

All

public static IReadOnlyList<IRaptorRtLightSource> All { get; }

Every source, built-in sources first.

Methods

For

public static IRaptorRtLightSource For(string backendId)

Returns the source registered for backendId, otherwise the Unity source.

ParameterTypeDescription
backendIdstringThe light backend's id.

Returns: The source, never null.

Gather

public static int Gather(List<RaptorRtLight> lights, List<Vector4> areaTris, List<float> areaCdf, out RaptorRtSceneSettings settings, out int hash, out Cubemap skyCube, out Matrix4x4 skyRotation)

Gathers the active source's settings and lights for the preview in one call. The Bakery source's hash is passed through unchanged. Other sources' hashes also include the source id, so switching sources always re-uploads.

ParameterTypeDescription
lightsList<RaptorRtLight>Filled with the GPU light list.
areaTrisList<Vector4>Filled with the area-light triangles.
areaCdfList<float>Filled with the area lights' per-light CDF.
settingsout RaptorRtSceneSettingsSet to the source's settings.
hashout intA hash of what was read.
skyCubeout CubemapThe sky cubemap, or null.
skyRotationout Matrix4x4The sky's rotation.

Returns: The light count.

IsLightType

public static bool IsLightType(Type t)

Returns whether the active source reads components of type t. Those components use the Lights tool's Inspector section.

ParameterTypeDescription
tTypeThe component type.

Returns: True if the source reads t.

LightOn

public static Component LightOn(GameObject go)

Returns the active source's light component on go.

ParameterTypeDescription
goGameObjectThe GameObject.

Returns: The component, or null if there is none or the source does not trace it.

Register

public static bool Register(IRaptorRtLightSource source)

Adds a source for an added light backend. Each id can have one source.

ParameterTypeDescription
sourceIRaptorRtLightSourceThe source.

Returns: False when the id is taken.

Call from an [InitializeOnLoad] static constructor on the main thread.

Unregister

public static bool Unregister(string id)

Removes an added source. The built-in Bakery and Unity sources cannot be removed.

ParameterTypeDescription
idstringThe source's id.

Returns: True if a source was removed.