Application prototype #14

Merged
glen merged 101 commits from app-proto into main 2024-10-21 23:38:28 +00:00
Showing only changes of commit f62f44b5a7 - Show all commits

View File

@ -25,10 +25,10 @@ vecInv sphere(vec3 center, float radius) {
// construction. the SPHERE_MAX array size seems to affect frame rate a lot, // construction. the SPHERE_MAX array size seems to affect frame rate a lot,
// even though we should only be using the first few elements of each array // even though we should only be using the first few elements of each array
const int SPHERE_MAX = 12; const int SPHERE_MAX_UNIFORM = 12;
uniform int sphere_cnt; uniform int sphere_cnt;
uniform vecInv sphere_list[SPHERE_MAX]; uniform vecInv sphere_list[SPHERE_MAX_UNIFORM];
uniform vec3 color_list[SPHERE_MAX]; uniform vec3 color_list[SPHERE_MAX_UNIFORM];
// view // view
uniform vec2 resolution; uniform vec2 resolution;
@ -135,8 +135,9 @@ void main() {
vec3 dir = vec3(focal_slope * scr, -1.); vec3 dir = vec3(focal_slope * scr, -1.);
// cast rays through the spheres // cast rays through the spheres
vec2 depth_pairs [SPHERE_MAX]; const int SPHERE_MAX_INTERNAL = 6;
taggedFrag frags [2*SPHERE_MAX]; vec2 depth_pairs [SPHERE_MAX_INTERNAL];
taggedFrag frags [2*SPHERE_MAX_INTERNAL];
int frag_cnt = 0; int frag_cnt = 0;
for (int i = 0; i < sphere_cnt; ++i) { for (int i = 0; i < sphere_cnt; ++i) {
vec2 hit_depths = sphere_cast(sphere_list[i], dir); vec2 hit_depths = sphere_cast(sphere_list[i], dir);