Documentation
¶
Overview ¶
Code generated by internal/codegen/binary; DO NOT EDIT.
Package worldlightmap defines the independently versioned, build-generated static receiver layout. It has no renderer or private engine dependencies.
Index ¶
- Constants
- Variables
- func Encode(layout Layout, document *world.Document) ([]byte, error)
- func EncodeEnvironmentVariants(catalog EnvironmentVariants, layout Layout, document *world.Document) ([]byte, error)
- func EncodePrebake(pair PrebakePair, layout Layout, document *world.Document) ([]byte, error)
- func EnvironmentRGBMRange(environment *world.Environment, settings world.EnvironmentSettings, ...) (float64, error)
- func EnvironmentSurfaceDigest(document *world.Document) (string, error)
- func GeometryDigest(document *world.Document) (string, error)
- func LayoutDigest(layout *Layout) (string, error)
- func LightIDsInReceiverScope(document *world.Document, selection *ReceiverSelection, ids []string) ([]string, error)
- func OfflineDenoiseMode(producer string) (string, error)
- func OfflineDenoiseProducer(mode string) (string, error)
- func OfflineProducer(mode string, maxRayDistance float64) (string, error)
- func OfflineRGBMRange(layout Layout, document *world.Document, bounces int) (float64, error)
- func OfflineRGBMRangeBounded(layout Layout, document *world.Document, bounces int, maxRayDistance float64) (float64, error)
- func OfflineSurfaceDigest(document *world.Document) (string, error)
- func ReceiverScope(document *world.Document, selection *ReceiverSelection) ([]bool, []bool, error)
- func SelectEnvironmentVariants(catalog *EnvironmentVariants, settings world.EnvironmentSettings) (int, int, float64, error)
- func StaticLightIDs(document *world.Document) ([]string, error)
- func Validate(layout *Layout, document *world.Document) error
- func ValidateEnvironmentImage(variant EnvironmentVariant, encoded []byte, layout Layout) error
- func ValidateEnvironmentVariants(catalog *EnvironmentVariants, layout Layout, document *world.Document) error
- func ValidateEnvironmentVariantsArtifact(catalog *EnvironmentVariants, layout Layout) error
- func ValidateLayoutArtifact(layout *Layout, admission LayoutAdmission) error
- func ValidatePrebakeArtifact(pair PrebakePair, layout Layout) error
- type Binding
- type Chart
- type EnvironmentVariant
- type EnvironmentVariants
- type InfluenceScope
- type Layout
- func Compile(document world.Document, options Options) (Layout, error)
- func CompileReceivers(document world.Document, options Options, sectors, solids []int) (Layout, error)
- func Decode(encoded []byte, document *world.Document) (Layout, error)
- func DecodeLayoutArtifact(encoded []byte, admission LayoutAdmission) (Layout, error)
- type LayoutAdmission
- type OfflineBakeInputs
- type Options
- type Page
- type PrebakeManifest
- type PrebakePair
- func DecodePrebake(encoded, image []byte, layout Layout, document *world.Document) (PrebakePair, error)
- func DecodePrebakeArtifact(encoded, image []byte, layout Layout) (PrebakePair, error)
- func NewOfflinePrebake(layout Layout, document *world.Document, image []byte, ...) (PrebakePair, error)
- func NewPrebake(layout Layout, document *world.Document, image []byte) (PrebakePair, error)
- type ReceiverSelection
- type RuntimeBake
- type Surface
Constants ¶
const ( EnvironmentVariantsSchema = "karty.world-lightmap-environment-variants@1" EnvironmentVariantsEntryName = "@world/lightmaps/environment-variants" EnvironmentImageEntryName = "@world/lightmaps/environment-image" EnvironmentVariantsMetadataKey = "kartyWorldLightmapEnvironmentVariants" EnvironmentVariantMetadataKey = "kartyWorldLightmapEnvironmentVariant" EnvironmentVariantsFeature = cartridge.FeatureWorldLightmapsEnvironmentVariantsV1 EnvironmentPrebakeProducer = "cpu-environment-rnm3@2" MaxEnvironmentVariants = 32 MaxEnvironmentCatalogSize = 32 * 1024 )
const ( Schema = "karty.world-lightmaps@1" Algorithm = uint32(1) ReceiverAlgorithm = uint32(2) EntryName = "@world/lightmaps/layout" MetadataKey = "kartyWorldLightmaps" Feature = cartridge.FeatureWorldLightmapsV1 MaxEncodedSize = 8 * 1024 * 1024 MaxCharts = 8192 MaxTexels = 1024 * 1024 MaxBakeLights = world.MaxLights PointVisibilityEncoding = "point-visibility@1" DirectRNMEncoding = "direct-rnm3@1" BinaryMagic = "KLM1" )
const ( OfflinePrebakeAlgorithm = 2 OfflinePrebakeProducer = "cpu-rnm3-pathtrace@4" BoundedOfflinePrebakeProducer = "cpu-rnm3-pathtrace@5" LegacyOfflinePrebakeProducer = "cpu-rnm3-pathtrace@1" MaxOfflineSamples = 256 MaxOfflineBounces = 4 MaxDiffuseReflectance = .95 MaxBakeRayDistance = world.MaxCoordinate )
const ( PrebakeSchema = "karty.world-lightmap-prebake@1" PrebakeAlgorithm = 1 PrebakeEntryName = "@world/lightmaps/prebake" PrebakeImageEntryName = "@world/lightmaps/prebake-rnm3" PrebakeMetadataKey = "kartyWorldLightmapPrebake" PrebakeFeature = cartridge.FeatureWorldLightmapsPrebakedV1 MaxPrebakeManifestSize = 16 * 1024 MaxPrebakeImageSize = level.MaxEntrySize PrebakeBinaryMagic = "KPB1" )
Variables ¶
var ( ErrLayout = errors.New("world lightmap layout is invalid") // ErrPageCapacity identifies finite receiver charts that cannot fit the // requested page. Capacity errors also wrap ErrLayout. Invalid geometry, // options and lighting recipes do not wrap ErrPageCapacity. ErrPageCapacity = errors.New("world lightmap page capacity is exhausted") )
Functions ¶
func EncodeEnvironmentVariants ¶ added in v0.0.14
func EncodePrebake ¶
EncodePrebake returns a canonical manifest only after complete pair validation.
func EnvironmentRGBMRange ¶ added in v0.0.14
func EnvironmentRGBMRange(environment *world.Environment, settings world.EnvironmentSettings, bounces int) (float64, error)
func EnvironmentSurfaceDigest ¶ added in v0.0.14
func GeometryDigest ¶
GeometryDigest includes stable semantic identity, boundary topology and elevation geometry. Actor state, lighting, materials and UVs do not affect it.
func LayoutDigest ¶ added in v0.0.12
LayoutDigest hashes the exact canonical binary layout. It checks structural bounds and finite fields without a world; callers validate semantic bindings against the complete world before mounting a layout.
func LightIDsInReceiverScope ¶ added in v0.0.12
func LightIDsInReceiverScope(document *world.Document, selection *ReceiverSelection, ids []string) ([]string, error)
LightIDsInReceiverScope preserves the given source order while filtering to the receivers' ordinary physical component. Unknown and duplicate IDs fail even when their source would be outside that component.
func OfflineDenoiseMode ¶ added in v0.0.9
OfflineDenoiseMode rejects unknown producer versions before image allocation.
func OfflineDenoiseProducer ¶ added in v0.0.9
OfflineDenoiseProducer versions the complete filter, including its preset. Empty and off select the same revision-4 producer and manifest identity.
func OfflineProducer ¶ added in v0.0.12
OfflineProducer selects a separately versioned bounded producer only for a finite positive ray limit. Zero selects the unbounded revision-4 producer.
func OfflineRGBMRange ¶
OfflineRGBMRange reserves a conservative finite range for direct lighting plus bounded diffuse transport. Each bounce attenuates maximum radiance by MaxDiffuseReflectance; three coefficient lobes need the same factor as the direct producer. This is a storage bound, not a promised illumination level.
func OfflineRGBMRangeBounded ¶ added in v0.0.12
func OfflineRGBMRangeBounded(layout Layout, document *world.Document, bounces int, maxRayDistance float64) (float64, error)
OfflineRGBMRangeBounded uses exactly the producer's conservative source scope and clipped influence radii. Zero is identical to OfflineRGBMRange.
func OfflineSurfaceDigest ¶
OfflineSurfaceDigest binds material identities and authored projection data in addition to geometry. Actor state and artistic ambient are not transport inputs. The original albedo pixels are checked separately by the public CLI.
func ReceiverScope ¶ added in v0.0.12
ReceiverScope returns transport geometry in the selected receivers' ordinary physical component. Transformed and one-way portals are lighting boundaries. The caller must validate the complete document before using these masks. Solids touching multiple physical spaces are rejected: coordinate overlap cannot unambiguously assign an independently authored volume to either space.
func SelectEnvironmentVariants ¶ added in v0.0.14
func SelectEnvironmentVariants(catalog *EnvironmentVariants, settings world.EnvironmentSettings) (int, int, float64, error)
SelectEnvironmentVariants chooses one authored clock. Clear-only catalogs return the same index twice and zero blend regardless of cloud amount; cloud brightness remains a shader control and does not change the selected image. Paired catalogs return clear/overcast indexes and a linear weather blend. Clock distance wraps midnight. Ties retain the first authored time.
func StaticLightIDs ¶ added in v0.0.12
StaticLightIDs returns independently owned authored-order IDs of all fixed point sources without a nonzero linked emission pulse. It validates the world first. Compiler options decide the receiver/component scope separately.
func Validate ¶
Validate checks every record, rectangle, semantic binding and receiver before a caller can allocate GPU resources. The geometry digest prevents stale UVs.
func ValidateEnvironmentImage ¶ added in v0.0.14
func ValidateEnvironmentImage(variant EnvironmentVariant, encoded []byte, layout Layout) error
ValidateEnvironmentImage checks exact content, dimensions and complete QOI stream before callers allocate decoded pixels or replace a resident map.
func ValidateEnvironmentVariants ¶ added in v0.0.14
func ValidateEnvironmentVariants(catalog *EnvironmentVariants, layout Layout, document *world.Document) error
func ValidateEnvironmentVariantsArtifact ¶ added in v0.0.18
func ValidateEnvironmentVariantsArtifact(catalog *EnvironmentVariants, layout Layout) error
ValidateEnvironmentVariantsArtifact checks runtime references and allocation bounds. Builder callers retain ValidateEnvironmentVariants for source proof.
func ValidateLayoutArtifact ¶ added in v0.0.18
func ValidateLayoutArtifact(layout *Layout, admission LayoutAdmission) error
ValidateLayoutArtifact checks structural layout constraints only. Full authored-source proof remains available through Validate for build/cache use. Callers establish artifact integrity separately; the supplied counts are not evidence that an artifact was produced correctly. Inputs are read-only.
func ValidatePrebakeArtifact ¶ added in v0.0.18
func ValidatePrebakeArtifact(pair PrebakePair, layout Layout) error
ValidatePrebakeArtifact validates structural/resource identities against an already admitted immutable layout. BakeSHA256, SurfaceSHA256 and reflectance record compiler provenance; full source proof remains PrebakePair.Validate.
Types ¶
type Binding ¶
Binding associates a world surface with its receiver chart. Index addresses the world sector or solid array. Edge is -1 for caps, and addresses the directed wall or footprint edge otherwise. Chart -1 explicitly marks a wall with no opaque receiver. Array order is semantic discovery order.
type Chart ¶
type Chart struct {
ID int
Page int
Rect [4]int
ReceiverRect [4]int
Normal world.Vec3
Tangent world.Vec3
Bitangent world.Vec3
UPlane [4]float64
VPlane [4]float64
}
Chart describes a receiver's atlas placement and basis. Rectangles are [minimumX,minimumY,maximumX,maximumY] in page pixels, maximums exclusive. Plane values are normalized page coordinates.
type EnvironmentVariant ¶ added in v0.0.14
type EnvironmentVariants ¶ added in v0.0.14
type EnvironmentVariants struct {
Schema, GeometrySHA256, LayoutSHA256, SurfaceSHA256, ReflectanceSHA256, Producer string
Samples, Bounces int
Seed uint64
Denoise string
Default int
Variants []EnvironmentVariant
}
EnvironmentVariants binds one immutable receiver layout and a bounded set of content-addressed passive condition modules. The default image is embedded in the owning render chunk; other images need not be fetched until selected.
func DecodeEnvironmentVariants ¶ added in v0.0.14
func DecodeEnvironmentVariantsArtifact ¶ added in v0.0.18
func DecodeEnvironmentVariantsArtifact(encoded []byte, layout Layout) (EnvironmentVariants, error)
DecodeEnvironmentVariantsArtifact decodes a builder-approved catalog after whole-file integrity admission. It checks binary/resource bounds and identities without reconstructing source geometry, surface digests or lighting proofs.
type InfluenceScope ¶ added in v0.0.12
InfluenceScope describes conservative pixel dependencies in stable semantic surface and recipe order. SurfaceIndices index Surfaces(document); LightIDs never change which authored sources are classified as completed static lights.
func BoundedInfluenceScope ¶ added in v0.0.12
func BoundedInfluenceScope(document *world.Document, layout Layout, bounces int, maxRayDistance float64) (InfluenceScope, error)
BoundedInfluenceScope keeps geometry within (bounces+1)*distance of receiver bounds, and sources whose min(radius,distance) sphere reaches receiver bounds expanded by bounces*distance. Small guards cover ray-origin and raster rounding. Zero distance retains the complete ordinary physical-component dependency set.
type Layout ¶
type Layout struct {
Schema string
Algorithm uint32
GeometrySHA256 string
TexelsPerUnit float64
Padding int
Pages []Page
Charts []Chart
Bindings []Binding
RuntimeBake *RuntimeBake
Receivers *ReceiverSelection
}
func Compile ¶
Compile discovers and packs unique receiver coordinates without triangulating sectors or importing runtime code. Algorithm 1 merges only coplanar floors and ceilings across ordinary reciprocal portals, never across transformed or disconnected spaces. Walls and solid sides retain semantic chart identities.
func CompileReceivers ¶ added in v0.0.12
func CompileReceivers(document world.Document, options Options, sectors, solids []int) (Layout, error)
CompileReceivers packs only selected receivers at the requested density. Global bindings and the full geometry digest keep chunk identity stable. Algorithm 2 never merges charts across an unselected sector.
func DecodeLayoutArtifact ¶ added in v0.0.18
func DecodeLayoutArtifact(encoded []byte, admission LayoutAdmission) (Layout, error)
DecodeLayoutArtifact admits compiler-authoritative layout data after exact whole-child catalog hash/size verification. It validates bounded records, arrays, rectangles, references and finite fields, without rediscovering source surfaces, proving chart coverage/overlap or reconstructing authored geometry.
type LayoutAdmission ¶ added in v0.0.18
type LayoutAdmission struct{ SectorCount, SolidCount int }
LayoutAdmission supplies accepted root array bounds for compiled lightmap references. Geometry digest equality and the receiver selection's equality to its parent chunk descriptor are direct metadata checks performed by the host.
type OfflineBakeInputs ¶
type OfflineBakeInputs struct {
Samples, Bounces int
Seed uint64
ReflectanceSHA256 string
RGBMRange float64
Denoise string // empty/off, low or medium; encoded in the producer identity
MaxRayDistance float64 // zero is unbounded; positive selects producer revision 5
}
OfflineBakeInputs identifies the public deterministic CPU producer. Worker count is deliberately absent: changing parallelism must not change pixels.
type Options ¶
type Options struct {
TexelsPerUnit float64
PageSize, Padding, MaxPages, MaxTexels int
Light string
Lights []string
// AllStatic selects every fixed source without a nonzero emission pulse.
// It is build policy, not an additional runtime wire field.
AllStatic bool
ShadowSize int
// CapsWithinSourceRoom prevents cap charts from spanning authored room or
// prefab-instance boundaries, while retaining efficient cap merging inside
// each room. It is optional build policy; canonical layouts remain unchanged.
CapsWithinSourceRoom bool
// CompactPacking uses bounded free-rectangle packing and optional 90-degree
// chart turns instead of default shelves. Density and limits are retained.
CompactPacking bool
}
type PrebakeManifest ¶
type PrebakeManifest struct {
Schema string
Algorithm int
Encoding string
LayoutSHA256 string
BakeSHA256 string
ImageSHA256 string
ImageBytes int
Width int
Height int
RGBMRange float64
Producer string
Samples int
Bounces int
Seed uint64
ReflectanceSHA256 string
SurfaceSHA256 string
// MaxRayDistance is present on the wire only for bounded producer revision
// 3. Zero retains the exact unbounded revision-1/2 manifest bytes.
MaxRayDistance float64
}
PrebakeManifest binds one completed direct RNM image to exact layout and selected lighting inputs. Its canonical binary is the public manifest entry.
func DecodePrebakeManifest ¶ added in v0.0.12
func DecodePrebakeManifest(encoded []byte) (PrebakeManifest, error)
DecodePrebakeManifest inspects a bounded canonical binary manifest without decoding pixels. Full layout, source and image identity requires DecodePrebake.
type PrebakePair ¶
type PrebakePair struct {
Manifest PrebakeManifest
Image []byte
}
PrebakePair retains caller ownership of Image; consumers clone it before publication. It is not the wire format: levels carry two fixed data entries.
func DecodePrebake ¶
func DecodePrebake(encoded, image []byte, layout Layout, document *world.Document) (PrebakePair, error)
DecodePrebake rejects malformed binary fields before returning a completely validated pair. Image remains borrowed; JSON and trailing data are rejected.
func DecodePrebakeArtifact ¶ added in v0.0.18
func DecodePrebakeArtifact(encoded, image []byte, layout Layout) (PrebakePair, error)
DecodePrebakeArtifact admits a compiled RNM manifest and image after exact whole-artifact catalog integrity checks. Layout must already be admitted. It validates manifest shape, layout/image identity, complete bounded QOI and dimensions/range, without reconstructing geometry or authored bake inputs. Image remains borrowed and must stay immutable throughout pair publication.
func NewOfflinePrebake ¶
func NewOfflinePrebake(layout Layout, document *world.Document, image []byte, inputs OfflineBakeInputs) (PrebakePair, error)
NewOfflinePrebake binds a combined direct/indirect image to transport inputs. Format validation verifies identity and QOI integrity, not solver quality. ReflectanceSHA256 commits original decoded albedo; the CLI verifies it against source before packaging. Hosts can verify surface identity, but do not possess those original source images and cannot independently rehash their pixels.
func NewPrebake ¶
NewPrebake validates a completed raw linear RGBM QOI atlas and derives its identity. It neither decodes pixels nor imports runtime or filesystem code.
type ReceiverSelection ¶ added in v0.0.12
ReceiverSelection scopes an atlas to global sector/solid identities. The complete ordinary physical component remains the transport context.