void LodNode::Update(float32 timeElapsed) { if (flags&Entity::NODE_VISIBLE) { lastLodUpdateFrame++; if (lastLodUpdateFrame > RECHECK_LOD_EVERY_FRAME) { lastLodUpdateFrame = 0; LodData *oldLod = currentLod; RecheckLod(); if (oldLod != currentLod) { if (oldLod) { int32 size = oldLod->nodes.size(); for (int i = 0; i < size; i++) { oldLod->nodes[i]->SetUpdatable(false); } } int32 size = currentLod->nodes.size(); for (int i = 0; i < size; i++) { currentLod->nodes[i]->SetUpdatable(true); } } } } else { lastLodUpdateFrame = RECHECK_LOD_EVERY_FRAME + 1; } }
void LodSystem::UpdateLod(SceneNode * entity) { LodComponent * lodComponent = static_cast<LodComponent*>(entity->GetComponent(Component::LOD_COMPONENT)); LodComponent::LodData * oldLod = lodComponent->currentLod; RecheckLod(entity); if (oldLod != lodComponent->currentLod) { if (oldLod) { int32 size = oldLod->nodes.size(); for (int i = 0; i < size; i++) { oldLod->nodes[i]->SetLodVisible(false); } } int32 size = lodComponent->currentLod->nodes.size(); for (int i = 0; i < size; i++) { lodComponent->currentLod->nodes[i]->SetLodVisible(true); } } }