     vec3 color;
     int shader;
 };
-// struct Heightmap {
-//     vec3 position;
-//     vec3 size;
-//     //    sampler2D texture;
-//     vec3 color;
-//     int shader;
-// };
 struct Ray {
     vec3 origin;
     vec3 direction;

    }
    return ret;
}
// Intersection heightmapIntersect(Ray ray) {
//     Intersection ret;
//     ret.object = -1;

//     for(int i = 0; i < numHeightmaps; i++) {
//         vec3 bmin = heightmaps[i].position;
//         vec3 bmax = heightmaps[i].position + heightmaps[i].size;

//         if(ray.origin.y < bmin.y) {
//             continue;
//         } else if(ray.origin.y > bmax.y && ray.direction.y >= 0) {
//             continue;
//         } else if(ray.origin.x >= bmin.x && ray.origin.x <= bmax.x &&
//                   ray.origin.z >= bmin.z && ray.origin.z <= bmax.z) {
//             ret.object = i;
//             ret.normal = -ray.direction;
//             ret.distance = 0;
//             return ret;
//         }

//         float tmin = -1e10, tmax = 1e10;

//         vec3 normal;
//         if(ray.direction.x != 0) {
//             float tx1 = (bmin.x - ray.origin.x) / ray.direction.x;
//             float tx2 = (bmax.x - ray.origin.x) / ray.direction.x;
//             tmin = min(tx1, tx2);
//             tmax = max(tx1, tx2);
//             normal = vec3(-sign(ray.direction.x), 0, 0);
//         }
//         if(ray.direction.y != 0) {
//             float ty1 = (bmin.y - ray.origin.y) / ray.direction.y;
//             float ty2 = (bmax.y - ray.origin.y) / ray.direction.y;
//             tmax = min(tmax, max(ty1, ty2));
//             if(min(ty1, ty2) > tmin) {
//                 tmin = min(ty1, ty2);
//                 normal = vec3(0, -sign(ray.direction.y), 0);
//             }
//         }
//         if(ray.direction.z != 0) {
//             float tz1 = (bmin.z - ray.origin.z) / ray.direction.z;
//             float tz2 = (bmax.z - ray.origin.z) / ray.direction.z;
//             tmax = min(tmax, max(tz1, tz2));
//             if(min(tz1, tz2) > tmin) {
//                 tmin = min(tz1, tz2);
//                 normal = vec3(0, 0, -sign(ray.direction.z));
//             }
//         }

//         if(tmin > 0 && tmax > tmin &&
//            (tmin < ret.distance || ret.object == -1)) {
//             ret.distance = tmin;
//             ret.normal = normal;
//             ret.object = i;
//         }
//     }
//     return ret;
// }

vec3 shade(int shader, vec3 color, vec3 point, vec3 normal,
           out float reflect_weight, out float refract_weight) {
    if(shader == DIFFUSE_SHADER) {


layout(location = 16) uniform int numLights = 1;
layout(location = 17) uniform int numSpheres = 2;

/*layout(location = 64) uniform*/ Light lights[8];
/*layout(location = 128) uniform*/ Sphere spheres[8];

Intersection sphereIntersect(Ray ray) {
    Intersection ret;
