mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:57:43 +02:00
mostly working, but some blinking when setting glow
This commit is contained in:
parent
ab95370a62
commit
618f538be5
6 changed files with 18 additions and 22 deletions
|
@ -182,6 +182,7 @@ bool StoreModelOperator::PreRecursion(OctreeElement* element) {
|
||||||
// Note: updateModel() will only operate on correctly found models and/or add them
|
// Note: updateModel() will only operate on correctly found models and/or add them
|
||||||
// to the element if they SHOULD be stored there.
|
// to the element if they SHOULD be stored there.
|
||||||
if (modelTreeElement->updateModel(_newModel)) {
|
if (modelTreeElement->updateModel(_newModel)) {
|
||||||
|
qDebug() << "model was updated!";
|
||||||
_foundNew = true;
|
_foundNew = true;
|
||||||
// NOTE: don't change the keepSearching here, if it came in here
|
// NOTE: don't change the keepSearching here, if it came in here
|
||||||
// false then we stay false, if it came in here true, then it
|
// false then we stay false, if it came in here true, then it
|
||||||
|
@ -227,8 +228,11 @@ OctreeElement* StoreModelOperator::PossiblyCreateChildAt(OctreeElement* element,
|
||||||
|
|
||||||
|
|
||||||
void ModelTree::storeModel(const ModelItem& model, const SharedNodePointer& senderNode) {
|
void ModelTree::storeModel(const ModelItem& model, const SharedNodePointer& senderNode) {
|
||||||
|
// NOTE: callers must lock the tree before using this method
|
||||||
|
|
||||||
// First, look for the existing model in the tree..
|
// First, look for the existing model in the tree..
|
||||||
StoreModelOperator theOperator(this, model);
|
StoreModelOperator theOperator(this, model);
|
||||||
|
|
||||||
recurseTreeWithOperator(&theOperator);
|
recurseTreeWithOperator(&theOperator);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
|
||||||
|
@ -498,7 +502,9 @@ int ModelTree::processEditPacketData(PacketType packetType, const unsigned char*
|
||||||
bool isValid;
|
bool isValid;
|
||||||
ModelItem newModel = ModelItem::fromEditPacket(editData, maxLength, processedBytes, this, isValid);
|
ModelItem newModel = ModelItem::fromEditPacket(editData, maxLength, processedBytes, this, isValid);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
lockForWrite();
|
||||||
storeModel(newModel, senderNode);
|
storeModel(newModel, senderNode);
|
||||||
|
unlock();
|
||||||
if (newModel.isNewlyCreated()) {
|
if (newModel.isNewlyCreated()) {
|
||||||
notifyNewlyCreatedModel(newModel, senderNode);
|
notifyNewlyCreatedModel(newModel, senderNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,6 +363,9 @@ bool ModelTreeElement::updateModel(const ModelItem& model) {
|
||||||
for (uint16_t i = 0; i < numberOfModels; i++) {
|
for (uint16_t i = 0; i < numberOfModels; i++) {
|
||||||
ModelItem& thisModel = (*_modelItems)[i];
|
ModelItem& thisModel = (*_modelItems)[i];
|
||||||
if (thisModel.getID() == model.getID()) {
|
if (thisModel.getID() == model.getID()) {
|
||||||
|
if (wantDebug) {
|
||||||
|
qDebug() << "found model with id";
|
||||||
|
}
|
||||||
int difference = thisModel.getLastUpdated() - model.getLastUpdated();
|
int difference = thisModel.getLastUpdated() - model.getLastUpdated();
|
||||||
bool changedOnServer = thisModel.getLastEdited() <= model.getLastEdited();
|
bool changedOnServer = thisModel.getLastEdited() <= model.getLastEdited();
|
||||||
bool localOlder = thisModel.getLastUpdated() < model.getLastUpdated();
|
bool localOlder = thisModel.getLastUpdated() < model.getLastUpdated();
|
||||||
|
@ -401,6 +404,7 @@ bool ModelTreeElement::updateModel(const ModelItem& model) {
|
||||||
// TODO: can this be optimized to only set the containing element in cases where it could have
|
// TODO: can this be optimized to only set the containing element in cases where it could have
|
||||||
// changed or has not been set?
|
// changed or has not been set?
|
||||||
_myTree->setContainingElement(model.getModelItemID(), this);
|
_myTree->setContainingElement(model.getModelItemID(), this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -640,16 +644,3 @@ bool ModelTreeElement::collapseChildren() {
|
||||||
// nothing to do here yet...
|
// nothing to do here yet...
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
void ModelTreeElement::storeModel(const ModelItem& model) {
|
|
||||||
_modelItems->push_back(model);
|
|
||||||
markWithChangedTime();
|
|
||||||
|
|
||||||
// TODO: can this be optimized to only set the containing element in cases where it could have
|
|
||||||
// changed or has not been set?
|
|
||||||
_myTree->setContainingElement(model.getModelItemID(), this);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
|
@ -148,9 +148,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void init(unsigned char * octalCode);
|
virtual void init(unsigned char * octalCode);
|
||||||
|
|
||||||
void storeModel(const ModelItem& model);
|
|
||||||
|
|
||||||
ModelTree* _myTree;
|
ModelTree* _myTree;
|
||||||
QList<ModelItem>* _modelItems;
|
QList<ModelItem>* _modelItems;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "AABoxCubeTests.h"
|
#include "AABoxCubeTests.h"
|
||||||
|
|
||||||
void AABoxCubeTests::AABoxCubeTests() {
|
void AABoxCubeTests::AABoxCubeTests(bool verbose) {
|
||||||
qDebug() << "******************************************************************************************";
|
qDebug() << "******************************************************************************************";
|
||||||
qDebug() << "AABoxCubeTests::AABoxCubeTests()";
|
qDebug() << "AABoxCubeTests::AABoxCubeTests()";
|
||||||
|
|
||||||
|
@ -95,6 +95,6 @@ void AABoxCubeTests::AABoxCubeTests() {
|
||||||
qDebug() << "******************************************************************************************";
|
qDebug() << "******************************************************************************************";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AABoxCubeTests::runAllTests() {
|
void AABoxCubeTests::runAllTests(bool verbose) {
|
||||||
AABoxCubeTests();
|
AABoxCubeTests(verbose);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#define hifi_AABoxCubeTests_h
|
#define hifi_AABoxCubeTests_h
|
||||||
|
|
||||||
namespace AABoxCubeTests {
|
namespace AABoxCubeTests {
|
||||||
void AABoxCubeTests();
|
void AABoxCubeTests(bool verbose);
|
||||||
void runAllTests();
|
void runAllTests(bool verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // hifi_AABoxCubeTests_h
|
#endif // hifi_AABoxCubeTests_h
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "AABoxCubeTests.h"
|
#include "AABoxCubeTests.h"
|
||||||
|
#include "ModelTests.h"
|
||||||
#include "OctreeTests.h"
|
#include "OctreeTests.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ int main(int argc, const char* argv[]) {
|
||||||
bool verbose = cmdOptionExists(argc, argv, VERBOSE);
|
bool verbose = cmdOptionExists(argc, argv, VERBOSE);
|
||||||
qDebug() << "OctreeTests::runAllTests()";
|
qDebug() << "OctreeTests::runAllTests()";
|
||||||
OctreeTests::runAllTests(verbose);
|
OctreeTests::runAllTests(verbose);
|
||||||
AABoxCubeTests::runAllTests();
|
AABoxCubeTests::runAllTests(verbose);
|
||||||
|
ModelTests::runAllTests(verbose);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue