first pass at bvh construction (SAH), untested
[cyberay] / src / geom.h
index 50784a4..b0fbb1d 100644 (file)
@@ -20,17 +20,6 @@ struct aabox {
        cgm_vec3 vmin, vmax;
 };
 
-struct bvhnode {
-       struct aabox aabb;
-
-       struct triangle *faces;
-       int num_faces;
-
-       struct bvhnode *next;
-       struct bvhnode *sub;
-       int num_sub;
-};
-
 struct rayhit {
        float t;
        struct vertex v;
@@ -38,10 +27,13 @@ struct rayhit {
        struct material *mtl;
 };
 
-void free_bvh_tree(struct bvhnode *tree);
-
 int ray_triangle(cgm_ray *ray, struct triangle *tri, float tmax, struct rayhit *hit);
 int ray_aabox_any(cgm_ray *ray, struct aabox *box, float tmax);
-int ray_bvhnode(cgm_ray *ray, struct bvhnode *bn, float tmax, struct rayhit *hit);
+
+void aabox_init(struct aabox *box);
+void aabox_addface(struct aabox *box, struct triangle *tri);
+void aabox_union(struct aabox *res, struct aabox *a, struct aabox *b);
+float aabox_surf_area(struct aabox *box);
+float surf_area(float dx, float dy, float dz);
 
 #endif /* GEOM_H_ */