在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):sleexyz/hylogen开源软件地址(OpenSource Url):https://github.com/sleexyz/hylogen开源编程语言(OpenSource Language):Haskell 47.1%开源软件介绍(OpenSource Introduction):H Y L O G E NAn embedding of GLSL in Haskell. H Y L I D EA live coding environment for writing shaders with Hylogen.
InstallBuild from source, using Stack:
This is the recommended method of using Hylogen, because using Stack you can share your projects and be confident that others will be using the same version of Hylogen as you. To install it to your system so it can be used anywhere, not just inside the Hylogen can also be installed to your system using the Haskell Platform:
ExampleHere's a simple Hylogen shader to be used with Hylide, saved as module Example where
import Hylogen.WithHylide
output :: Program
output = toProgram color
color :: Vec4
color = vec4 (a, a, a, 1)
where
k = 20
f = (*k) . sin . (/k)
a = sum [ cos (x_ uvN * f time + x_ mouse )
, sin (y_ uvN * f time + y_ mouse )
] Run Hylide:
If Hylide was installed using the haskell platform, you can omit
Now go to localhost:5678 in your browser. You'll see a live rendering of the corresponding generated GLSL: void main() {
float _7 = uvN.x;
float _10 = (time / 20.0);
float _9 = sin(_10);
float _8 = (_9 * 20.0);
float _6 = (_7 * _8);
float _11 = mouse.x;
float _5 = (_6 + _11);
float _4 = cos(_5);
float _3 = (0.0 + _4);
float _15 = uvN.y;
float _18 = (time / 20.0);
float _17 = sin(_18);
float _16 = (_17 * 20.0);
float _14 = (_15 * _16);
float _19 = mouse.y;
float _13 = (_14 + _19);
float _12 = sin(_13);
float _2 = (_3 + _12);
vec4 _1 = vec4(_2, _2, _2, 1.0);
gl_FragColor = _1;
} Hylide will recompile on changes to the Haskell source, sending generated GLSL to the WebGL client over websockets. References
Conceived of at the Recurse Center :) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论