mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-09 16:52:28 +02:00
add simple and fast DirtyOctreeElementOperator
This commit is contained in:
parent
959f924b1d
commit
af57f5d120
2 changed files with 60 additions and 0 deletions
30
libraries/octree/src/DirtyOctreeElementOperator.cpp
Normal file
30
libraries/octree/src/DirtyOctreeElementOperator.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// DirtyOctreeElementOperator.cpp
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Andrew Meawdows 2016.02.04
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "DirtyOctreeElementOperator.h"
|
||||
|
||||
DirtyOctreeElementOperator::DirtyOctreeElementOperator(OctreeElementPointer element)
|
||||
: _element(element) {
|
||||
assert(_element.get());
|
||||
_point = _element->getAACube().calcCenter();
|
||||
}
|
||||
|
||||
bool DirtyOctreeElementOperator::preRecursion(OctreeElementPointer element) {
|
||||
if (element == _element) {
|
||||
return false;
|
||||
}
|
||||
return element->getAACube().contains(_point);
|
||||
}
|
||||
|
||||
bool DirtyOctreeElementOperator::postRecursion(OctreeElementPointer element) {
|
||||
element->markWithChangedTime();
|
||||
return true;
|
||||
}
|
30
libraries/octree/src/DirtyOctreeElementOperator.h
Normal file
30
libraries/octree/src/DirtyOctreeElementOperator.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// DirtyOctreeElementOperator.h
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Andrew Meawdows 2016.02.04
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_DirtyOctreeElementOperator_h
|
||||
#define hifi_DirtyOctreeElementOperator_h
|
||||
|
||||
#include "Octree.h"
|
||||
|
||||
class DirtyOctreeElementOperator : public RecurseOctreeOperator {
|
||||
public:
|
||||
DirtyOctreeElementOperator(OctreeElementPointer element);
|
||||
|
||||
~DirtyOctreeElementOperator() {}
|
||||
|
||||
virtual bool preRecursion(OctreeElementPointer element);
|
||||
virtual bool postRecursion(OctreeElementPointer element);
|
||||
private:
|
||||
glm::vec3 _point;
|
||||
OctreeElementPointer _element;
|
||||
};
|
||||
|
||||
#endif // hifi_DirtyOctreeElementOperator_h
|
Loading…
Reference in a new issue