mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 06:16:18 +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
|
||||
// to the element if they SHOULD be stored there.
|
||||
if (modelTreeElement->updateModel(_newModel)) {
|
||||
qDebug() << "model was updated!";
|
||||
_foundNew = true;
|
||||
// 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
|
||||
|
@ -227,8 +228,11 @@ OctreeElement* StoreModelOperator::PossiblyCreateChildAt(OctreeElement* element,
|
|||
|
||||
|
||||
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..
|
||||
StoreModelOperator theOperator(this, model);
|
||||
|
||||
recurseTreeWithOperator(&theOperator);
|
||||
_isDirty = true;
|
||||
|
||||
|
@ -498,7 +502,9 @@ int ModelTree::processEditPacketData(PacketType packetType, const unsigned char*
|
|||
bool isValid;
|
||||
ModelItem newModel = ModelItem::fromEditPacket(editData, maxLength, processedBytes, this, isValid);
|
||||
if (isValid) {
|
||||
lockForWrite();
|
||||
storeModel(newModel, senderNode);
|
||||
unlock();
|
||||
if (newModel.isNewlyCreated()) {
|
||||
notifyNewlyCreatedModel(newModel, senderNode);
|
||||
}
|
||||
|
|
|
@ -363,6 +363,9 @@ bool ModelTreeElement::updateModel(const ModelItem& model) {
|
|||
for (uint16_t i = 0; i < numberOfModels; i++) {
|
||||
ModelItem& thisModel = (*_modelItems)[i];
|
||||
if (thisModel.getID() == model.getID()) {
|
||||
if (wantDebug) {
|
||||
qDebug() << "found model with id";
|
||||
}
|
||||
int difference = thisModel.getLastUpdated() - model.getLastUpdated();
|
||||
bool changedOnServer = thisModel.getLastEdited() <= model.getLastEdited();
|
||||
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
|
||||
// changed or has not been set?
|
||||
_myTree->setContainingElement(model.getModelItemID(), this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -640,16 +644,3 @@ bool ModelTreeElement::collapseChildren() {
|
|||
// nothing to do here yet...
|
||||
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:
|
||||
virtual void init(unsigned char * octalCode);
|
||||
|
||||
void storeModel(const ModelItem& model);
|
||||
|
||||
ModelTree* _myTree;
|
||||
QList<ModelItem>* _modelItems;
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "AABoxCubeTests.h"
|
||||
|
||||
void AABoxCubeTests::AABoxCubeTests() {
|
||||
void AABoxCubeTests::AABoxCubeTests(bool verbose) {
|
||||
qDebug() << "******************************************************************************************";
|
||||
qDebug() << "AABoxCubeTests::AABoxCubeTests()";
|
||||
|
||||
|
@ -95,6 +95,6 @@ void AABoxCubeTests::AABoxCubeTests() {
|
|||
qDebug() << "******************************************************************************************";
|
||||
}
|
||||
|
||||
void AABoxCubeTests::runAllTests() {
|
||||
AABoxCubeTests();
|
||||
void AABoxCubeTests::runAllTests(bool verbose) {
|
||||
AABoxCubeTests(verbose);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#define hifi_AABoxCubeTests_h
|
||||
|
||||
namespace AABoxCubeTests {
|
||||
void AABoxCubeTests();
|
||||
void runAllTests();
|
||||
void AABoxCubeTests(bool verbose);
|
||||
void runAllTests(bool verbose);
|
||||
}
|
||||
|
||||
#endif // hifi_AABoxCubeTests_h
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
//
|
||||
|
||||
#include "AABoxCubeTests.h"
|
||||
#include "ModelTests.h"
|
||||
#include "OctreeTests.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
|
@ -17,6 +18,7 @@ int main(int argc, const char* argv[]) {
|
|||
bool verbose = cmdOptionExists(argc, argv, VERBOSE);
|
||||
qDebug() << "OctreeTests::runAllTests()";
|
||||
OctreeTests::runAllTests(verbose);
|
||||
AABoxCubeTests::runAllTests();
|
||||
AABoxCubeTests::runAllTests(verbose);
|
||||
ModelTests::runAllTests(verbose);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue