hadronized / spectra

Rust demoscene engine (currently on hold)
122 stars 6 forks source link

Where can I find a full shader example with map_vertex and map_frag_data? #39

Closed Boscop closed 5 years ago

Boscop commented 6 years ago
  1. Where can I find a full shader example with map_vertex and map_frag_data?

  2. And how to write fragment depth?

  3. Apart from these special functions and imports, does cheddar support everything that GLSL does? I'm asking because here you wrote:

    We need more built-ins, such as PI, PI_2, etc.

Boscop commented 6 years ago
  1. If at some time you come to the realization that you also need the position information in the result, you just have to change the above code to:

    
    struct Vertex {
    vec4 chdr_Position;
    vec3 position;
    vec4 color;
    };

Vertex map_vertex(vec3 position, vec4 color) { return Vertex(vec4(position, 1.), position, color); }


Why can't I just use `chdr_Position` in my fragment shader? Why do I have to add another `position` field?