SLLight.sleela
lib/user-interface/SLLight.sleela · 120 line(s) · sleela
<< lib/user-interface/SLLight.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLLight — a SleelaUI light descriptor used to light and
relieve Canvas-aware objects. A light has a KIND (point, directional,
ambient), a ROLE, a POLARITY, a position/direction, a reach, an intensity,
a softness (penumbra width), and a colour. It is a pure value object the
host fills and hands to an SLLightScene; the scene decides whether it is a
SOURCE (reserves an anchor object — the object is used as the light) or an
EMITTER (reserves nothing, reusable).
Both light and shadow come from either a source or an emitter: the POLARITY
decides whether the emission brightens (light) or darkens (shadow/umbra).
Family: user-interface. Mirrors SLUILight in the SleelaUI Lighting C ABI
(sleela_ui_light.h). >>
#sleela 2.5
material;
class SLLight {
< ---- 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 = 10377;
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; }
< Kind ordinals (mirror SLUILightKind). >
static final int POINT = 0;
static final int DIRECTIONAL = 1;
static final int AMBIENT = 2;
< Role ordinals (mirror SLUILightRole). >
< reserves its anchor object (object USED) >
static final int SOURCE = 0;
< reserves nothing; reusable >
static final int EMITTER = 1;
< Polarity ordinals (mirror SLUIPolarity). >
< brightens >
static final int LIGHT = 0;
< darkens (umbra emission) >
static final int SHADOW = 1;
int kind;
int role;
int polarity;
< point position + height above the plane >
double x; double y; double z;
< directional unit vector >
double dx; double dy;
< point reach in px (0 = infinite) >
double radius;
< 0..N emission multiplier >
double intensity;
< 0..1 penumbra width for cast shadows >
double softness;
< 0xRRGGBBAA emission (shadow colour if SHADOW) >
int color;
< for a SOURCE: the reserved anchor id >
int anchor;
< A point light at (x,y) reaching `radius` px, with an intensity + colour. >
void point(double px, double py, double reach, double i, int c) {
kind = POINT; role = EMITTER; polarity = LIGHT;
x = px; y = py; z = reach * 0.5 + 24.0;
dx = 0.0; dy = 0.0; radius = reach; intensity = i; softness = 0.5;
color = c; anchor = -1;
}
< A directional "sun" travelling along (ux,uy). >
void directional(double ux, double uy, double i, int c) {
kind = DIRECTIONAL; role = EMITTER; polarity = LIGHT;
x = 0.0; y = 0.0; z = 0.6; dx = ux; dy = uy;
radius = 0.0; intensity = i; softness = 0.4; color = c; anchor = -1;
}
< A uniform ambient fill. >
void ambient(double i, int c) {
kind = AMBIENT; role = EMITTER; polarity = LIGHT;
x = 0.0; y = 0.0; z = 0.0; dx = 0.0; dy = 0.0;
radius = 0.0; intensity = i; softness = 0.0; color = c; anchor = -1;
}
< Turn this light into a shadow (negative-polarity) emission. >
void asShadow() { polarity = SHADOW; }
< Turn this light into a light (positive-polarity) emission. >
void asLight() { polarity = LIGHT; }
}