mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:37:46 +02:00
Move Baking Status
This commit is contained in:
parent
fd3156b57c
commit
859ec57ded
2 changed files with 25 additions and 12 deletions
|
@ -10,23 +10,26 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "AutoBaker.h"
|
#include "AutoBaker.h"
|
||||||
|
#include <shared/Algorithms.h>
|
||||||
|
|
||||||
|
using namespace alg;
|
||||||
|
|
||||||
void AutoBaker::addPendingBake(AssetHash hash) {
|
void AutoBaker::addPendingBake(AssetHash hash) {
|
||||||
_pendingBakes.push_back(hash);
|
_pendingBakes.push_back(hash);
|
||||||
|
|
||||||
|
// Maybe start baking it right away
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoBaker::assetNeedsBaking(AssetHash hash) {
|
bool AutoBaker::assetNeedsBaking(AssetHash hash) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoBaker::Status AutoBaker::getAssetStatus(AssetHash hash) {
|
BakingStatus AutoBaker::getAssetStatus(AssetHash hash) {
|
||||||
auto pendingIt = std::find(_pendingBakes.cbegin(), _pendingBakes.cend(), hash);
|
if (find(_pendingBakes, hash) != std::end(_pendingBakes)) {
|
||||||
if (pendingIt != _pendingBakes.cend()) {
|
|
||||||
return Pending;
|
return Pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bakingIt = std::find(_currentlyBaking.cbegin(), _currentlyBaking.cend(), hash);
|
if (find(_currentlyBaking, hash) != std::end(_currentlyBaking)) {
|
||||||
if (bakingIt != _currentlyBaking.cend()) {
|
|
||||||
return Baking;
|
return Baking;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,30 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Algorithms_h
|
#ifndef hifi_Algorithms_h
|
||||||
#define Algorithms_h
|
#define hifi_Algorithms_h
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iterator>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace alg {
|
namespace alg {
|
||||||
|
|
||||||
|
template <class Container, class ValueType>
|
||||||
|
auto find(const Container& container, const ValueType& value) -> decltype(std::begin(container)) {
|
||||||
|
return std::find(std::begin(container), std::end(container), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Container, class Predicate>
|
||||||
|
auto find_if(const Container& container, Predicate&& predicate) -> decltype(std::begin(container)) {
|
||||||
|
return std::find_if(std::begin(container), std::end(container), std::forward<Predicate>(predicate));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Container, class Predicate>
|
||||||
|
auto find_if_not(const Container& container, Predicate&& predicate) -> decltype(std::begin(container)) {
|
||||||
|
return std::find_if_not(std::begin(container), std::end(container), std::forward<Predicate>(predicate));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Algorithms_hpp */
|
#endif // hifi_Algorithms_hpp
|
||||||
|
|
Loading…
Reference in a new issue