Skip to content

Instantly share code, notes, and snippets.

@k0ffinz
k0ffinz / HSL2RGB.hlsl
Created November 19, 2024 18:25
HLSL shader code to convert HSL to RGB
// adapted from https://labex.io/tutorials/28378
float3 HSL2RGB(float h, float s, float l) {
float a = s * min(l, 1. - l);
return float3(
l - a * max(-1., min(((h / 30.) % 12.) - 3., min(9. - ((h / 30.) % 12.), 1.))),
l - a * max(-1., min(((8. + h / 30.) % 12.) - 3., min(9. - ((8. + h / 30.) % 12.), 1.))),
l - a * max(-1., min(((4. + h / 30.) % 12.) - 3., min(9. - ((4. + h / 30.) % 12.), 1.)))
);
}
float3 HSL2RGB(float3 hsl) {
@k0ffinz
k0ffinz / RalLib-Module-Require.lua
Last active November 19, 2024 18:29
Psych Engine Lua snippet to use RalLib. This way the module can be placed into the scripts folder as well as providing support to Android system.
local scriptFileName = stringSplit(scriptName, '/')
scriptFileName = scriptFileName[#scriptFileName]
local src = scriptName:sub(1, - #scriptFileName - 1)
local function warn()
debugPrint('Please download and put RalLib into the same folder as script.')
debugPrint('RalLib.lua file is not present in the scripts directory.')
debugPrint('')
debugPrint('')
end
if buildTarget == 'windows' then -- windows