RaptorRtLightSources
The Ray-traced preview's light sources.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.Render.EditorTools | RaptorRender.Editor | class | preview, 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 RaptorRtLightSourcesFields
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.
| Parameter | Type | Description |
|---|---|---|
backendId | string | The 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.
| Parameter | Type | Description |
|---|---|---|
lights | List<RaptorRtLight> | Filled with the GPU light list. |
areaTris | List<Vector4> | Filled with the area-light triangles. |
areaCdf | List<float> | Filled with the area lights' per-light CDF. |
settings | out RaptorRtSceneSettings | Set to the source's settings. |
hash | out int | A hash of what was read. |
skyCube | out Cubemap | The sky cubemap, or null. |
skyRotation | out Matrix4x4 | The 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.
| Parameter | Type | Description |
|---|---|---|
| t | Type | The 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.
| Parameter | Type | Description |
|---|---|---|
go | GameObject | The 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.
| Parameter | Type | Description |
|---|---|---|
source | IRaptorRtLightSource | The 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.
| Parameter | Type | Description |
|---|---|---|
id | string | The source's id. |
Returns: True if a source was removed.
Related types
- RaptorRtSceneSettings: Scene-wide settings from a light source that affect how a bake looks.
- IRaptorRtLightSource: Reads one light system's scene lights for the Ray-traced preview and the Lights tool.