--- /dev/null
+varying vec3 v_rorg, v_rdir;
+
+vec3 shade(in vec3 pos, in vec3 norm);
+vec3 backdrop(in vec3 dir);
+float isect_plane(in vec3 ro, in vec3 rd, out vec3 norm_ret);
+
+void main()
+{
+ vec3 rdir = normalize(v_rdir);
+
+ float t = isect_floor(v_rorg, rdir);
+ if(t >= 0.0) {
+ gl_FragColor.rgb = shade(v_rorg + rdir * t, vec3(0.0, 1.0, 0.0));
+ } else {
+ gl_FragColor.rgb = backdrop(rdir);
+ }
+ gl_FragColor.a = 1.0;
+}
+
+vec3 shade(in vec3 pos, in vec3 norm)
+{
+}
+
+vec3 backdrop(in vec3 dir)
+{
+}
+
+float isect_floor(in vec3 ro, in vec3 rd)
+{
+ float t = isect_plane(ro, rd, vec4(0.0, 1.0, 0.0, -1.0));
+ if(t < 0.0) return t;
+
+ vec3 p = ro + rd * t;
+ float d = max(abs(p.x), max(abs(p.y), abs(p.z)));
+ if(d >= 1.0) return -1.0;
+
+ return t;
+}
+
+float isect_plane(in vec3 ro, in vec3 rd, in vec4 plane)
+{
+
+}
--- /dev/null
+#define FOV 0.873 /* about 50 deg */
+
+varying vec3 v_rorg, v_rdir;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+
+ float dist = 1.0 / tan(FOV / 2.0);
+ vec3 dir = vec3(gl_MultiTexCoord0.xy * 2.0 - 1.0, dist);
+ v_rdir = gl_NormalMatrix * dir;
+ v_rorg = (gl_ModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;
+}