silphius/app/react/components/pixi/light.jsx
2024-07-30 09:56:53 -05:00

35 lines
960 B
JavaScript

import {PixiComponent} from '@pixi/react';
import {PointLight} from './lights.js';
const LightInternal = PixiComponent('Light', {
create({brightness}) {
const light = new PointLight(
0xffffff - 0x2244cc,
brightness,
);
// light.shader.program.fragmentSrc = light.shader.program.fragmentSrc.replace(
// 'float D = length(lightVector)',
// 'float D = length(lightVector) / 1.0',
// );
// light.shader.program.fragmentSrc = light.shader.program.fragmentSrc.replace(
// 'intensity = diffuse * attenuation',
// 'intensity = diffuse * (attenuation * 2.0)',
// );
// light.falloff = [0.5, 5, 50];
// light.falloff = light.falloff.map((n, i) => n / (2 + i));
// light.parentGroup = deferredLighting.lightGroup;
// delete light.parentGroup;
return light;
},
});
export default function Light({brightness}) {
return (
<LightInternal
brightness={brightness}
/>
)
}