One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

LightmapResource

class · iOS 27.0+ · SDK 27.1

final class LightmapResource

A resource containing references to lightmap texture atlases and descriptions of how parts of the atlases map to meshes in the scene. At a high level, ``LightmapResource`` comprises two parts: a set of layered textures containing lightmap data, and a set of EntityLightmapDescriptors specifying atlas packing. Both parts (the lightmap data and atlas packing) are expected to be generated by an offline process. LightmapResource is only intended for storing and retrieving them. Importantly, ``LightmapResource`` does not store references to runtime Entities. The correspondence between runtime Entities and their matching EntityLightmapDescriptors is established by ``LightmapComponent``. ## See Also - ``LightmapComponent``

Members (4)

get · iOS 27.0+

entityCount

TypeScript
get entityCount(): number
Swift declaration
final var entityCount: Int { get }

Total number of entities in this lightmap.

init · iOS 27.0+

init

TypeScript
static initAtlasTexturesPerEntityData(atlasTextures: Array<TextureResource>, perEntityData: Array<LightmapResource_EntityLightmapDescriptor>): LightmapResource
Swift declaration
convenience init(atlasTextures: [TextureResource], perEntityData: [LightmapResource.EntityLightmapDescriptor]) throws

Initializes the resource with the given atlases and entity descriptors. The resources within `atlasTextures` must be 2D texture arrays. Textures containing data for ambient occlusion should be single-channel textures. Textures containing data for beauty bakes should contain RGBA color. Textures for diffuse irradiance should contain RGBA data. There should be 3 slices per atlas page. Lightmap textures use the Metal convention, where UV (0,0) corresponds to the top-left corner of the image while UV (1,1) corresponds to the bottom-right. Assuming a = sqrt(2), b = sqrt(3), c = sqrt(6), and N0 = (1/c, 1/a, 1/b), N1=(-1/c, -1/a, 1/b), N2 = (a/b, 0, 1/b), the first, second and third slices should contain lighting as if the surface normal was respectively N0, N1 and N2 in tangent space.

init · iOS 27.0+

init

TypeScript
static initPerEntityData(perEntityData: Array<LightmapResource_EntityLightmapDescriptor>): LightmapResource
Swift declaration
convenience init(perEntityData: [LightmapResource.EntityLightmapDescriptor]) throws

Initializes the resource with the given entity descriptors, but does not specify any atlas textures. Skips validation of atlas texture indices and slices within bake descriptors. This is helpful for providing a SurfaceExtractor with information about how entities are laid out in the lightmap without needing to provide any texture data along with it.

get · iOS 27.0+

bakeTypes

TypeScript
get bakeTypes(): Array<LightmapResource_BakeType>
Swift declaration
final var bakeTypes: [LightmapResource.BakeType] { get }

All bake types used by entities in this lightmap.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →