bool Renderer::ShouldDraw(const Renderable* renderable, const Frustum& frustum) { // Testing all vertices against frustum. // TODO: Implement tests with bounding boxes const int NUM_PLANES = 6; bool bShouldDraw = false; const Plane(&planes)[NUM_PLANES] = frustum.GetPlanes(); std::vector<Vertex> vertices = renderable->GetMesh()->GetVertices(); for (size_t i = 0; i < vertices.size(); ++i) { unsigned int numPlanesInside = 0; for (size_t j = 0; j < NUM_PLANES; ++j) { if (!planes[j].IsInFront(vertices[i].position)) { break; } ++numPlanesInside; } if (numPlanesInside == 6) { bShouldDraw = true; break; } } return bShouldDraw; }