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 EncodePrebake(pair PrebakePair, layout Layout, document *world.Document) ([]byte, 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 StaticLightIDs(document *world.Document) ([]string, error)
- func Validate(layout *Layout, document *world.Document) error
- type Binding
- type Chart
- type InfluenceScope
- type Layout
- type OfflineBakeInputs
- type Options
- type Page
- type PrebakeManifest
- type PrebakePair
- type ReceiverSelection
- type RuntimeBake
- type Surface
Constants ¶
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@2" BoundedOfflinePrebakeProducer = "cpu-rnm3-pathtrace@3" 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 EncodePrebake ¶
EncodePrebake returns a canonical manifest only after complete pair validation.
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-2 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 preserves the unbounded revision-2 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 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.
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 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.
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 3
}
OfflineBakeInputs identifies the public deterministic CPU producer. Worker count is deliberately absent: changing parallelism must not change pixels.
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 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.