Fool octree to avoid ui grid overlay culling

This commit is contained in:
Zach Pomerantz 2016-02-19 14:44:33 -08:00
parent 0b4e82405f
commit 3418488c2f
3 changed files with 14 additions and 1 deletions

View file

@ -13,6 +13,8 @@
#include <QScriptValue>
#include <OctreeConstants.h>
#include <avatar/AvatarManager.h>
#include <avatar/MyAvatar.h>
@ -38,6 +40,15 @@ Grid3DOverlay::Grid3DOverlay(const Grid3DOverlay* grid3DOverlay) :
updateGrid();
}
AABox Grid3DOverlay::getBounds() const {
if (_followCamera) {
// This is a UI element that should always be in view, lie to the octree to avoid culling
const AABox DOMAIN_BOX = AABox(glm::vec3(-TREE_SCALE / 2), TREE_SCALE);
return DOMAIN_BOX;
}
return Planar3DOverlay::getBounds();
}
void Grid3DOverlay::render(RenderArgs* args) {
if (!_visible) {
return; // do nothing if we're not visible

View file

@ -24,6 +24,8 @@ public:
Grid3DOverlay();
Grid3DOverlay(const Grid3DOverlay* grid3DOverlay);
virtual AABox getBounds() const;
virtual void render(RenderArgs* args);
virtual const render::ShapeKey getShapeKey() override;
virtual void setProperties(const QScriptValue& properties);

View file

@ -20,7 +20,7 @@ public:
Planar3DOverlay();
Planar3DOverlay(const Planar3DOverlay* planar3DOverlay);
AABox getBounds() const;
virtual AABox getBounds() const;
glm::vec2 getDimensions() const { return _dimensions; }
void setDimensions(float value) { _dimensions = glm::vec2(value); }