mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:21:16 +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();
|
AnimDebugDraw::getInstance().update();
|
||||||
|
|
||||||
DependencyManager::get<LimitlessVoiceRecognitionScriptingInterface>()->update();
|
DependencyManager::get<LimitlessVoiceRecognitionScriptingInterface>()->update();
|
||||||
|
|
||||||
|
// Game loopis done, mark the end of the frame for the scene transactions
|
||||||
|
getMain3DScene()->enqueueFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::sendAvatarViewFrustum() {
|
void Application::sendAvatarViewFrustum() {
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "TransitionStage.h"
|
#include "TransitionStage.h"
|
||||||
|
|
||||||
// Comment this to disable transitions (fades)
|
|
||||||
#define SCENE_ENABLE_TRANSITIONS
|
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
void Transaction::resetItem(ItemID id, const PayloadPointer& payload) {
|
void Transaction::resetItem(ItemID id, const PayloadPointer& payload) {
|
||||||
|
@ -101,16 +98,46 @@ void consolidateTransaction(TransactionQueue& queue, Transaction& singleBatch) {
|
||||||
queue.pop();
|
queue.pop();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::processTransactionQueue() {
|
uint32_t Scene::enqueueFrame() {
|
||||||
PROFILE_RANGE(render, __FUNCTION__);
|
PROFILE_RANGE(render, __FUNCTION__);
|
||||||
Transaction consolidatedTransaction;
|
Transaction consolidatedTransaction;
|
||||||
|
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(_transactionQueueMutex);
|
std::unique_lock<std::mutex> lock(_transactionQueueMutex);
|
||||||
consolidateTransaction(_transactionQueue, consolidatedTransaction);
|
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);
|
std::unique_lock<std::mutex> lock(_itemsMutex);
|
||||||
// Here we should be able to check the value of last ItemID allocated
|
// 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
|
// capture anything coming from the transaction
|
||||||
|
|
||||||
// resets and potential NEW items
|
// resets and potential NEW items
|
||||||
resetItems(consolidatedTransaction._resetItems);
|
resetItems(transaction._resetItems);
|
||||||
|
|
||||||
// Update the numItemsAtomic counter AFTER the reset changes went through
|
// Update the numItemsAtomic counter AFTER the reset changes went through
|
||||||
_numAllocatedItems.exchange(maxID);
|
_numAllocatedItems.exchange(maxID);
|
||||||
|
|
||||||
// updates
|
// updates
|
||||||
updateItems(consolidatedTransaction._updatedItems);
|
updateItems(transaction._updatedItems);
|
||||||
|
|
||||||
// removes
|
// removes
|
||||||
removeItems(consolidatedTransaction._removedItems);
|
removeItems(transaction._removedItems);
|
||||||
|
|
||||||
#ifdef SCENE_ENABLE_TRANSITIONS
|
|
||||||
// add transitions
|
// add transitions
|
||||||
transitionItems(consolidatedTransaction._addedTransitions);
|
transitionItems(transaction._addedTransitions);
|
||||||
reApplyTransitions(consolidatedTransaction._reAppliedTransitions);
|
reApplyTransitions(transaction._reAppliedTransitions);
|
||||||
queryTransitionItems(consolidatedTransaction._queriedTransitions);
|
queryTransitionItems(transaction._queriedTransitions);
|
||||||
#endif
|
|
||||||
// Update the numItemsAtomic counter AFTER the pending changes went through
|
// Update the numItemsAtomic counter AFTER the pending changes went through
|
||||||
_numAllocatedItems.exchange(maxID);
|
_numAllocatedItems.exchange(maxID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consolidatedTransaction.touchTransactions()) {
|
if (transaction.touchTransactions()) {
|
||||||
std::unique_lock<std::mutex> lock(_selectionsMutex);
|
std::unique_lock<std::mutex> lock(_selectionsMutex);
|
||||||
|
|
||||||
// resets and potential NEW items
|
// resets and potential NEW items
|
||||||
resetSelections(consolidatedTransaction._resetSelections);
|
resetSelections(transaction._resetSelections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,9 @@ public:
|
||||||
// Enqueue transaction to the scene
|
// Enqueue transaction to the scene
|
||||||
void enqueueTransaction(const Transaction& transaction);
|
void enqueueTransaction(const Transaction& transaction);
|
||||||
|
|
||||||
|
// Enqueue end of frame transactions boundary
|
||||||
|
uint32_t enqueueFrame();
|
||||||
|
|
||||||
// Process the pending transactions queued
|
// Process the pending transactions queued
|
||||||
void processTransactionQueue();
|
void processTransactionQueue();
|
||||||
|
|
||||||
|
@ -162,6 +165,15 @@ protected:
|
||||||
std::mutex _transactionQueueMutex;
|
std::mutex _transactionQueueMutex;
|
||||||
TransactionQueue _transactionQueue;
|
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
|
// The actual database
|
||||||
// database of items is protected for editing by a mutex
|
// database of items is protected for editing by a mutex
|
||||||
std::mutex _itemsMutex;
|
std::mutex _itemsMutex;
|
||||||
|
|
Loading…
Reference in a new issue