Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use eden_engine;
- component Camera {
- param mat4 model;
- param mat4 view;
- param mat4 proj;
- param mat4 view_proj = view * proj;
- }
- component Object {
- param mat4 model;
- }
- shader UnlitColor {
- // Instantiated components from another shader
- using cam = Camera;
- using obj = Object;
- // External parameters exposed to the UI
- #[display(Texture2D)] param texture2D albedo;
- // Shader inputs
- input vec3 pos;
- input vec3 normal;
- input vec3 uv;
- // Inter stage inputs
- varying vec3 v_normal;
- varying vec3 v_uv;
- // Shader outputs
- output vec3 out_color;
- // Standard "shader" program for an unlit mesh with a color and tint
- void vertex() {
- eden_position = mvp * vec4(normal, 1);
- v_normal = (obj.model * cam.view_proj * vec4(normal, 0)).xyz;
- v_uv = uv;
- }
- void fragment() {
- out_color = sample(albedo, v_uv);
- }
- }
- shader ComputeTest {
- param content int[1024];
- #[num_threads(8, 8, 1)]
- void compute() {
- int index = eden_tid.x + eden_tid.y * 128;
- int value = content[index];
- int result = value * value;
- content[index] = result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement