mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 17:54:00 +02:00
Adding stuff that seems to break?
This commit is contained in:
parent
225d2bbbb4
commit
577378f539
3 changed files with 58 additions and 17 deletions
|
@ -5400,6 +5400,9 @@ void Application::update(float deltaTime) {
|
|||
AnimDebugDraw::getInstance().update();
|
||||
|
||||
DependencyManager::get<LimitlessVoiceRecognitionScriptingInterface>()->update();
|
||||
|
||||
// Game loopis done, mark the end of the frame for the scene transactions
|
||||
getMain3DScene()->enqueueFrame();
|
||||
}
|
||||
|
||||
void Application::sendAvatarViewFrustum() {
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
#include "Logging.h"
|
||||
#include "TransitionStage.h"
|
||||
|
||||
// Comment this to disable transitions (fades)
|
||||
#define SCENE_ENABLE_TRANSITIONS
|
||||
|
||||
using namespace render;
|
||||
|
||||
void Transaction::resetItem(ItemID id, const PayloadPointer& payload) {
|
||||
|
@ -101,16 +98,46 @@ void consolidateTransaction(TransactionQueue& queue, Transaction& singleBatch) {
|
|||
queue.pop();
|
||||
};
|
||||
}
|
||||
|
||||
void Scene::processTransactionQueue() {
|
||||
|
||||
uint32_t Scene::enqueueFrame() {
|
||||
PROFILE_RANGE(render, __FUNCTION__);
|
||||
Transaction consolidatedTransaction;
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_transactionQueueMutex);
|
||||
consolidateTransaction(_transactionQueue, consolidatedTransaction);
|
||||
}
|
||||
|
||||
|
||||
uint32_t frameNumber = 0;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_transactionFramesMutex);
|
||||
_transactionFrames.push_back(consolidatedTransaction);
|
||||
_transactionFrameNumber++;
|
||||
frameNumber = _transactionFrameNumber;
|
||||
}
|
||||
|
||||
return frameNumber;
|
||||
}
|
||||
|
||||
|
||||
void Scene::processTransactionQueue() {
|
||||
PROFILE_RANGE(render, __FUNCTION__);
|
||||
|
||||
TransactionFrames queuedFrames;
|
||||
{
|
||||
// capture the queued frames and clear the queue
|
||||
std::unique_lock<std::mutex> lock(_transactionFramesMutex);
|
||||
queuedFrames = _transactionFrames;
|
||||
_transactionFrames.clear();
|
||||
}
|
||||
|
||||
// go through the queue of frames and process them
|
||||
for (auto& frame : queuedFrames) {
|
||||
processTransactionFrame(frame);
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::processTransactionFrame(const Transaction& transaction) {
|
||||
PROFILE_RANGE(render, __FUNCTION__);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_itemsMutex);
|
||||
// Here we should be able to check the value of last ItemID allocated
|
||||
|
@ -123,32 +150,31 @@ void Scene::processTransactionQueue() {
|
|||
// capture anything coming from the transaction
|
||||
|
||||
// resets and potential NEW items
|
||||
resetItems(consolidatedTransaction._resetItems);
|
||||
resetItems(transaction._resetItems);
|
||||
|
||||
// Update the numItemsAtomic counter AFTER the reset changes went through
|
||||
_numAllocatedItems.exchange(maxID);
|
||||
|
||||
// updates
|
||||
updateItems(consolidatedTransaction._updatedItems);
|
||||
updateItems(transaction._updatedItems);
|
||||
|
||||
// removes
|
||||
removeItems(consolidatedTransaction._removedItems);
|
||||
removeItems(transaction._removedItems);
|
||||
|
||||
#ifdef SCENE_ENABLE_TRANSITIONS
|
||||
// add transitions
|
||||
transitionItems(consolidatedTransaction._addedTransitions);
|
||||
reApplyTransitions(consolidatedTransaction._reAppliedTransitions);
|
||||
queryTransitionItems(consolidatedTransaction._queriedTransitions);
|
||||
#endif
|
||||
transitionItems(transaction._addedTransitions);
|
||||
reApplyTransitions(transaction._reAppliedTransitions);
|
||||
queryTransitionItems(transaction._queriedTransitions);
|
||||
|
||||
// Update the numItemsAtomic counter AFTER the pending changes went through
|
||||
_numAllocatedItems.exchange(maxID);
|
||||
}
|
||||
|
||||
if (consolidatedTransaction.touchTransactions()) {
|
||||
if (transaction.touchTransactions()) {
|
||||
std::unique_lock<std::mutex> lock(_selectionsMutex);
|
||||
|
||||
// resets and potential NEW items
|
||||
resetSelections(consolidatedTransaction._resetSelections);
|
||||
resetSelections(transaction._resetSelections);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,9 @@ public:
|
|||
// Enqueue transaction to the scene
|
||||
void enqueueTransaction(const Transaction& transaction);
|
||||
|
||||
// Enqueue end of frame transactions boundary
|
||||
uint32_t enqueueFrame();
|
||||
|
||||
// Process the pending transactions queued
|
||||
void processTransactionQueue();
|
||||
|
||||
|
@ -162,6 +165,15 @@ protected:
|
|||
std::mutex _transactionQueueMutex;
|
||||
TransactionQueue _transactionQueue;
|
||||
|
||||
|
||||
std::mutex _transactionFramesMutex;
|
||||
using TransactionFrames = std::list<Transaction>;
|
||||
TransactionFrames _transactionFrames;
|
||||
uint32_t _transactionFrameNumber{ 0 };
|
||||
|
||||
// Process one transaction frame
|
||||
void processTransactionFrame(const Transaction& transaction);
|
||||
|
||||
// The actual database
|
||||
// database of items is protected for editing by a mutex
|
||||
std::mutex _itemsMutex;
|
||||
|
|
Loading…
Reference in a new issue