37 lines
No EOL
2.8 KiB
HTML
37 lines
No EOL
2.8 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Light.point — Ludic</title>
|
||
<meta name="description" content="Add a radial glow that falls off with distance.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="ns-light.html">Light</a> <span>›</span> <span class="here">Light.point</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Light.point</h1>
|
||
</div>
|
||
<code class="sig">Light.point(x, y, radius, color, energy)</code>
|
||
<div class="desc"><p>Additively accumulates a radial point light centred at <code>(x, y)</code>. Brightness is full at the centre and falls off linearly to zero at <code>radius</code> pixels, scaled by <code>energy</code> (a <code>fixed</code> multiplier — <code>1.0</code> is full, <code>2.0</code> over-drives toward white, <code>0.5</code> is dim), and clamped per channel at 255 so overlapping lights add without wrapping. Only the light's bounding box is touched, and any <a href="light-occlude"><code>Light.occlude</code></a> rectangle between the centre and a pixel puts that pixel in shadow. Colours are <code>0x00RRGGBB</code>.</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-radius"><code class="pname">radius</code><span class="pdesc">the reach in pixels; brightness is zero at and beyond it</span></div><div class="param" id="param-color"><code class="pname">color</code><span class="pdesc">the light colour, <code>0x00RRGGBB</code></span></div><div class="param" id="param-energy"><code class="pname">energy</code><span class="pdesc">a <code>fixed</code> brightness multiplier (<code>1.0</code> = full)</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Demo {
|
||
property Torch { x: int = 0, y: int = 0 }
|
||
model Lamp { Torch }
|
||
handler Render phase Update {
|
||
Screen.clear(0)
|
||
Light.ambient(Color.rgb(32, 32, 48))
|
||
Light.point(80, 60, 70, Color.rgb(255, 210, 130), 1.0) # a warm torch
|
||
Screen.show()
|
||
}
|
||
}</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |