1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#version 400
struct Vertex {
vec3 position;
vec3 normal;
};
struct Light {
vec3 position;
vec3 color;
float intensity;
};
struct Camera {
mat4 viewMatrix;
mat4 projMatrix;
};
// Test various positions of struct parameters - these should be TYPE_NAME
void render(Vertex v, Light l, Camera c) {
// Function with struct parameters at start
}
void process(int id, Vertex v, float time) {
// Function with struct parameter in middle
}
void compute(float delta, int count, Light l, Camera c, bool enabled) {
// Function with multiple struct parameters mixed with other types
}
void single(Vertex v) {
// Function with single struct parameter
}
void multiple(Vertex v1, Vertex v2, Light l1, Light l2) {
// Function with multiple parameters of same struct type
}
void main() {
Vertex v = Vertex(vec3(0.0), vec3(1.0, 0.0, 0.0));
Light l = Light(vec3(10.0), vec3(1.0), 1.0);
Camera c = Camera(mat4(1.0), mat4(1.0));
render(v, l, c);
process(1, v, 0.5);
compute(0.016, 100, l, c, true);
}
|