Crates.io | dsa-lib |
lib.rs | dsa-lib |
version | 0.1.8 |
source | src |
created_at | 2022-07-02 20:48:44.66668 |
updated_at | 2022-07-03 14:43:30.635646 |
description | A Shader generation tool from TOML to GLSL written in Rust |
homepage | |
repository | https://github.com/Plixo2/dsa-lib |
max_upload_size | |
id | 617983 |
size | 21,877 |
version = 330
profile = "core"
[layout]
a_pos = "vec3"
a_uv = "vec2"
[uniform]
transform = "mat4"
texture_0 = "sampler2D"
[fragment]
output = { result = "vec4" }
source = '''
result = texture(texture_0, uv);
'''
[vertex]
output = { uv = "vec2" }
source = '''
gl_Position = transform * vec4(a_pos, 1.0);
uv = a_uv;
'''
let toml = fs::read_to_string("example/textured.toml").unwrap();
let (vertex,fragment, config) = compile_toml(toml.as_str()).unwrap();
println!("Vertex {}",vertex);
println!("Fragment {}",fragment);
#version 330 core
layout (location = 0) in vec3 a_pos;
layout (location = 1) in vec2 a_uv;
uniform mat4 transform;
uniform sampler2D texture_0;
out vec2 uv;
void main() {
gl_Position = transform * vec4(a_pos, 1.0);
uv = a_uv;
}
#version 330 core
uniform mat4 transform;
uniform sampler2D texture_0;
in vec2 uv;
out vec4 result;
void main() {
result = texture(texture_0, uv);
}
You can specify Functions
, Constants
and Output
per Shader.
But Uniforms
, Version
, Profile
and Layout
per Program.
Vertex Output
are also synced with Fragment Input
.
For all examples see examples/textured.toml
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in toml-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.