-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre.glsl
54 lines (46 loc) · 895 Bytes
/
pre.glsl
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
49
50
51
52
53
54
/** Struct typedefs */
struct Mat {
vec3 albedo;
float metallic;
float roughness;
float ambient;
float reflectance;
float refractance;
float ior;
};
struct Light {
vec3 pos;
vec3 intensity;
};
struct Camera {
vec3 pos;
vec3 look;
};
struct Hit {
float dist;
uint id;
};
struct ObjHit {
vec3 norm;
Mat mat;
};
/** Forward Declaration */
vec3 calcNormal(vec3 p);
vec4 shade(ObjHit oh, vec3 p, vec3 eye, Lights l);
float shadow(vec3 lightDir, float lightDist, vec3 p);
float shadow(vec3 lightDir, vec3 p);
/** Helper functions */
// min between hits
Hit min(Hit x, Hit y) {
if (x.dist < y.dist) {
return x;
} else {
return y;
}
}
/** Constants */
#define UP vec3(0, 1, 0)
#define PI 3.1415926538
/** Shader io */
layout (set = 0, binding = 2) buffer bframe { float aframe[]; };
float frame = aframe[0];