void OcTree::GetVisibleSceneNodes(const Collidable &collider, SceneNodes &sceneNodes) const { sceneNodes.clear(); WalkScene(collider, [&](const SceneNode::Ptr &sceneNode) { sceneNodes.push_back(sceneNode); }); }
void OcTree::GetVisibleRenderables(const Collidable &collider, SceneNodes &renderables) const { renderables.clear(); WalkScene(collider, [&](const SceneNode::Ptr &sceneNode) { auto render = sceneNode->GetComponent<MeshRender>(); if (render != nullptr && render->GetRenderable()) renderables.push_back(sceneNode); }); }
void OcTree::GetVisibleLights(const Collidable &collider, SceneNodes &lights) const { lights.clear(); WalkScene(collider, [&](const SceneNode::Ptr &sceneNode) { if (sceneNode->GetComponent<Light>() != nullptr) lights.push_back(sceneNode); }); }
void OcTree::GetVisibleShadowCasters(const Collidable &collider, SceneNodes &renderables, bool clear) const { if (clear) renderables.clear(); WalkScene(collider, [&](const SceneNode::Ptr &sceneNode) { auto render = sceneNode->GetComponent<MeshRender>(); if (render != nullptr && render->GetRenderable() && render->GetMesh()->GetCastShadows()) renderables.push_back(sceneNode); }); }
void OcTree::GetRenderQuery(const Collidable &collider, const std::shared_ptr<RenderQuery> &renderQuery) const { renderQuery->Clear(); WalkScene(collider, [&](const SceneNode::Ptr &sceneNode) { if (sceneNode->GetComponent<Light>() != nullptr) renderQuery->AddLight(sceneNode); if (auto render = sceneNode->GetComponent<MeshRender>()) { if (render->GetRenderable()) renderQuery->AddRenderable(sceneNode); } }); }
void OcTree::GetVisibleRenderableAndLights(const Collidable &collider, SceneNodes &renderables, SceneNodes &lights, bool clear) const { if (clear) { renderables.clear(); lights.clear(); } WalkScene(collider, [&](const SceneNode::Ptr &sceneNode) { auto render = sceneNode->GetComponent<MeshRender>(); if (render != nullptr && render->GetRenderable()) renderables.push_back(sceneNode); else if (sceneNode->GetComponent<Light>() != nullptr) lights.push_back(sceneNode); }); }