Controls named rendering profiles on a View.

ViewProfiles is the runtime owner of profile-based render state for one View. It coordinates effect components, lighting components and rendering controls from a single symbolic profile ID, without adding render-mode logic to the View or to individual effects.

Profiles are sparse two-level property maps. The first key identifies a profileable View component, such as sao, ibl or tonemap; the nested keys are writable properties on that component. This lets each profile express only the properties it cares about while leaving unrelated runtime state alone.

When a profile is active, enabled has closed-world semantics. An effect is enabled only when the active profile explicitly contains {enabled: true} for that effect. Other properties remain sparse overrides: omitted properties are left outside profile control and are restored when profile ownership ends.

The class tracks only properties it has taken over. When switching profiles, it computes a single transition: removed properties are restored, newly controlled properties capture restore values, shared properties transition directly to their new profile values, and redundant setter calls are avoided. Calls to setProperties can explicitly override the current live value without mutating the active profile definition.

Use setActiveProfile to switch profiles when callers need structured failure reporting. The active profile ID is exposed as a read-only property for queries.

const profiles = new ViewProfiles(view, {
profiles: {
fast: {
sao: {enabled: false},
ibl: {enabled: false},
resolutionScale: {enabled: true, resolutionScale: 0.75}
},
realistic: {
sao: {enabled: true, intensity: 0.16},
ibl: {enabled: true, intensity: 0.7},
shadows: {enabled: true}
}
},
activeProfile: "realistic"
});

profiles.setActiveProfile("fast");

Constructors

Properties

view: View

View whose effect and lighting components are controlled by this ViewProfiles instance.

Accessors

Methods

  • Replaces this instance's serializable configuration from plain params.

    Profiles and the requested active profile are validated before existing state is cleared. If validation succeeds, current profile ownership is cleared, the registry is replaced, and the requested active profile is activated through setActiveProfile.

    Runtime restore values and external override state are not accepted from params; they are recomputed for the current View.

    Parameters

    Returns SDKResult<void>

    An SDKResult containing validation or activation errors.

  • Activates a profile or clears profile control.

    Passing null restores all state currently owned by ViewProfiles and leaves the View without an active profile. Passing an ID applies that profile as a single diff: properties already controlled by both profiles transition directly to their new values, removed properties are restored, new properties capture restore values, and redundant setter calls are avoided.

    While a profile is active, only effects explicitly configured with enabled: true remain enabled. Omitted effects, and effects without enabled: true, are disabled.

    Parameters

    • id: string

      Profile ID to activate, or null to clear.

    Returns SDKResult<void>

    An SDKResult containing not-found or validation errors.

  • Writes effect properties as explicit runtime state.

    This accepts the same shape as a profile but does not mutate profile definitions. If a written property is currently profile-managed, its restore value is updated and the live property is marked as externally overridden for the current activation. Subsequent unrelated active-profile edits will not reapply the old profile value; a transition to another profile, or an edit to that exact active-profile property, can reclaim profile control.

    The full batch is validated before any effect is mutated.

    Parameters

    Returns SDKResult<void>

    An SDKResult containing validation errors, if any.