Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use eden_engine;
- component Camera {
- param model : mat4;
- param view : mat4;
- param proj : mat4;
- param view_proj = view * proj : mat4;
- }
- 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 albedo: texture2D;
- // Shader inputs
- input pos : vec3;
- input normal : vec3;
- input uv : vec3;
- // Intra stage inputs
- varying v_normal : vec3;
- varying v_uv : vec3;
- // Shader outputs
- output out_color : vec3;
- // Standard "shader" program for an unlit mesh with a color and tint
- fn vertex() {
- eden_position = mvp * vec4(normal, 1);
- v_normal = (obj.model * cam.view_proj * vec4(normal, 0)).xyz;
- v_uv = uv;
- }
- fn fragment() {
- out_color = sample(albedo, v_uv);
- }
- }
- shader ComputeTest {
- param content: int[1024];
- #[num_threads(8, 8, 1)]
- fn compute() {
- let index = eden_tid.x + eden_tid.y * 128;
- let value = content[index];
- let result = value * value;
- content[index] = result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement