Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mixbox for lua #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Mixbox is shipping in Rebelle 5 Pro as the [Rebelle Pigments](https://www.escape
- [Unity](unity): add package from git url `git://github.com/scrtwpns/mixbox.git#upm`
- [Godot](godot): copy `godot\addons` to the root of your project
- [Shaders](shaders): load `mixbox_lut.png` as texture and include `mixbox.glsl`/`.hlsl`/`.metal` code into your shader
- [Lua](lua): add the `.lua` files from `lua` to the root of your project

## Pigment Colors
| Pigment | | RGB | Float RGB | Linear RGB |
Expand Down Expand Up @@ -346,6 +347,20 @@ gl.bindTexture(gl.TEXTURE_2D, mixbox.lutTexture(gl));
gl.uniform1i(gl.getUniformLocation(shaderProgram, "mixbox_lut"), 0);
```

## Lua

```lua
local mixbox = require("mixbox")

local rgb1 = {0, 33, 133} -- blue
local rgb2 = {252, 211, 0} -- yellow
t = 0.5 -- mixing ratio

local rgb = mixbox.lerp(rgb1, rgb2, t)

print(table.unpack(rgb))
```

## Examples

| Gradients | Mountains | Palette Snakes |
Expand Down
Loading