SLLightScene.sleela
lib/user-interface/SLLightScene.sleela · 103 line(s) · sleela
<< lib/user-interface/SLLightScene.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLLightScene — a collection of SleelaUI lights applied to
a draw context to light and relieve Canvas-aware objects. The scene owns the
SOURCE RESERVATION table: an anchor object can be used as a source at most
once (addSource refuses a second), while EMITTERS reserve nothing and may be
added freely and reused. It also holds the base ambient illumination so even
an unlit object is not pure black. Each method bottoms out in a `light*`
SLVM built-in that calls the SleelaUI Lighting C ABI (sleela_ui_light.h).
A scene is a VM-local handle (-1 = none). An SLLight is passed by its
descriptor fields through the built-ins.
Family: user-interface. Native VM/UI work crosses the explicit `light*` SLVM
bridge. >>
#sleela 2.5
material;
class SLLightScene {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 10378;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-07";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< VM-local scene handle (-1 = none) >
int scene;
void create() { scene = lightSceneCreate(); }
int handle() { return scene; }
boolean valid() { return scene >= 0; }
void destroy() { if (scene >= 0) { lightSceneDestroy(scene); scene = -1; } }
void clear() { if (scene >= 0) { lightSceneClear(scene); } }
int count() { if (scene < 0) { return 0; } return lightSceneCount(scene); }
< Add an EMITTER (reserves nothing). Returns its index (>=0), reusable. >
int addEmitter(SLLight l) {
if (scene < 0) { return -1; }
return lightSceneAddEmitter(scene, l.kind, l.polarity, l.x, l.y, l.z,
l.dx, l.dy, l.radius, l.intensity, l.softness,
l.color);
}
< Add a SOURCE bound to `anchor` (reserves it; the object is USED as a >
< source). Returns the light index (>=0), or a negative error if `anchor` is >
< already reserved by another source in this scene. >
int addSource(int anchor, SLLight l) {
if (scene < 0) { return -1; }
return lightSceneAddSource(scene, anchor, l.kind, l.polarity, l.x, l.y, l.z,
l.dx, l.dy, l.radius, l.intensity, l.softness,
l.color);
}
< True if `anchor` is currently reserved as a source in this scene. >
boolean anchorReserved(int anchor) {
if (scene < 0) { return false; }
return lightSceneAnchorReserved(scene, anchor) == 1;
}
< Release a source's reservation so the anchor can be a source again. >
void releaseSource(int anchor) {
if (scene >= 0) { lightSceneReleaseSource(scene, anchor); }
}
< The base ambient illumination applied before any light. >
void setAmbient(double intensity, int color) {
if (scene >= 0) { lightSceneSetAmbient(scene, intensity, color); }
}
}