/** * @brief Render the full map from the camera's current position. * @param camera The camera to render from */ void EQ3Map::render(RCamera* camera) { vector3 pos; int leaf, cluster; /* find the leaf and cluster the camera is at */ camera->get_position(&pos); leaf = find_leaf(&pos); cluster = leafs[leaf].cluster; //DEBUG("[Render::Q3Map] cluster = %i", cluster); #if 0 /* render everything */ int face = 0; for (; face < num_faces; ++face) { if (faces[face].type == Q3_FACETYPE_POLYGON) render_face(face); } #else int i = num_leafs; struct q3bsp_leaf_t* t_leaf = NULL; for (; i >= 0; --i) { t_leaf = &leafs[i]; /* check if this leaf cluster is visable from here */ if (!is_cluster_visable(cluster, t_leaf->cluster)) continue; /* if this cluster is not in the camera frustum, skip it */ if (!camera->is_box_visable(t_leaf->mins[0], t_leaf->mins[1], t_leaf->mins[2], t_leaf->maxs[0], t_leaf->maxs[1], t_leaf->maxs[2])) continue; /* render all the faces in this leaf */ int f = t_leaf->num_leaffaces; for (; f >= 0; --f) { int f_index = leaffaces[t_leaf->leafface + f].face; render_face(f_index); } } #endif }
void draw_face(void) { if (face_first) createface(); face_rotate = old_face_rotate; face_rotate = reduce_vsync(face_rotate); face_time += face_rotate; render_face(); drawface(); drawblur(5, 0.01f, 0.4f); }