| 157 | } |
| 158 | |
| 159 | void |
| 160 | OutofcoreCloud::render (vtkRenderer* renderer) |
| 161 | { |
| 162 | vtkSmartPointer<vtkCamera> active_camera = renderer->GetActiveCamera (); |
| 163 | |
| 164 | Scene *scene = Scene::instance (); |
| 165 | Camera *camera = scene->getCamera (active_camera); |
| 166 | |
| 167 | if (render_camera_ != nullptr && render_camera_->getName() == camera->getName ()) |
| 168 | { |
| 169 | renderer->ComputeAspect (); |
| 170 | //double *aspect = renderer->GetAspect (); |
| 171 | int *size = renderer->GetSize (); |
| 172 | |
| 173 | OctreeDisk::BreadthFirstIterator breadth_first_it (*octree_); |
| 174 | breadth_first_it.setMaxDepth(display_depth_); |
| 175 | |
| 176 | double frustum[24]; |
| 177 | camera->getFrustum(frustum); |
| 178 | |
| 179 | Eigen::Vector3d eye = camera->getPosition(); |
| 180 | Eigen::Matrix4d view_projection_matrix = camera->getViewProjectionMatrix(); |
| 181 | //Eigen::Matrix4d view_projection_matrix = projection_matrix * model_view_matrix;//camera->getViewProjectionMatrix(); |
| 182 | |
| 183 | cloud_actors_->RemoveAllItems (); |
| 184 | |
| 185 | while ( *breadth_first_it !=nullptr ) |
| 186 | { |
| 187 | OctreeDiskNode *node = *breadth_first_it; |
| 188 | |
| 189 | Eigen::Vector3d min_bb, max_bb; |
| 190 | node->getBoundingBox(min_bb, max_bb); |
| 191 | |
| 192 | // Frustum culling |
| 193 | if (pcl::visualization::cullFrustum(frustum, min_bb, max_bb) == pcl::visualization::PCL_OUTSIDE_FRUSTUM) |
| 194 | { |
| 195 | breadth_first_it.skipChildVoxels(); |
| 196 | breadth_first_it++; |
| 197 | continue; |
| 198 | } |
| 199 | |
| 200 | // Bounding box lod projection |
| 201 | float coverage = pcl::visualization::viewScreenArea(eye, min_bb, max_bb, view_projection_matrix, size[0], size[1]); |
| 202 | if (coverage <= lod_pixel_threshold_) |
| 203 | { |
| 204 | breadth_first_it.skipChildVoxels(); |
| 205 | } |
| 206 | |
| 207 | // for (int i=0; i < node->getDepth(); i++) |
| 208 | // std::cout << " "; |
| 209 | // std::cout << coverage << "-" << pcd_file << std::endl;//" : " << (coverage > (size[0] * size[1])) << std::endl; |
| 210 | |
| 211 | std::string pcd_file = node->getPCDFilename ().string (); |
| 212 | |
| 213 | cloud_data_cache_mutex.lock(); |
| 214 | |
| 215 | PcdQueueItem pcd_queue_item(pcd_file, coverage); |
| 216 |
nothing calls this directly
no test coverage detected