iesna
v1.0.0
Published
<div align="center"> <img src="https://emoji2svg.deno.dev/api/💡" height="160px"> <h1>IESNA</h1> <p> <strong> TypeScript library for parsing, inspecting, sampling and rendering <br/> the IESNA LM-63 Photometric file format.
Downloads
3
Readme
About
This project is heavily based on the original publication "Parsing The IESNA
LM-63 Photometric Data File" and its accompanying source code that is available
at http://lumen.iee.put.poznan.pl/kw/iesna.txt. For reference purposes, a copy
of the original publication is included in this repository under
/vendor/iesna-c/
.
Usage
To render an IES document to an HTML canvas using this library:
import * as IESNA from "iesna";
IESNA.renderToCanvas({
iesData: IESNA.parse("IES document goes here"),
canvas: document.getElementsByTagName("canvas")[0],
});
In addition to the IESNA.renderToCanvas()
method, light sampling can be done
using the IESNA.sample()
function. This function takes an IES data object and
an x,y,z coordinate in light space and returns the light intensity at that
position.
const iesData = IESNA.parse("IES document goes here");
const intensity = IESNA.sample({ iesData, x, y, z });
Demo
There is a demo of rendering IES documents in the browser available here.
To run it locally: npm install && npm run dev
.