Hooked up Clipboard preview

This commit is contained in:
Atlante45 2014-02-20 16:56:40 -08:00
parent 2152943a4d
commit 989a76fe6e
3 changed files with 73 additions and 1 deletions

View file

@ -0,0 +1,42 @@
//
// ClipboardOverlay.cpp
// hifi
//
// Created by Clément Brisset on 2/20/14.
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
//
// include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h"
#include <QGLWidget>
#include <SharedUtil.h>
#include "ClipboardOverlay.h"
#include "../Application.h"
ClipboardOverlay::ClipboardOverlay() {
}
ClipboardOverlay::~ClipboardOverlay() {
}
void ClipboardOverlay::render() {
if (!_visible) {
return; // do nothing if we're not visible
}
VoxelSystem* voxelSystem = Application::getInstance()->getSharedVoxelSystem();
VoxelTree* clipboard = Application::getInstance()->getClipboard();
if (voxelSystem->getTree() != clipboard) {
voxelSystem->changeTree(clipboard);
}
glPushMatrix();
glTranslatef(_position.x, _position.y, _position.z);
glScalef(_size, _size, _size);
voxelSystem->render();
glPopMatrix();
}

View file

@ -0,0 +1,25 @@
//
// ClipboardOverlay.h
// hifi
//
// Created by Clément Brisset on 2/20/14.
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
//
#ifndef __interface__ClipboardOverlay__
#define __interface__ClipboardOverlay__
#include "Volume3DOverlay.h"
class ClipboardOverlay : public Volume3DOverlay {
Q_OBJECT
public:
ClipboardOverlay();
~ClipboardOverlay();
virtual void render();
};
#endif /* defined(__interface__ClipboardOverlay__) */

View file

@ -12,7 +12,7 @@
#include "Overlays.h"
#include "Sphere3DOverlay.h"
#include "TextOverlay.h"
#include "ClipboardOverlay.h"
unsigned int Overlays::_nextOverlayID = 1;
@ -73,6 +73,11 @@ unsigned int Overlays::addOverlay(const QString& type, const QScriptValue& prope
thisOverlay->setProperties(properties);
created = true;
is3D = true;
} else if (type == "clipboard") {
thisOverlay = new ClipboardOverlay();
thisOverlay->init(_parent);
thisOverlay->setProperties(properties);
created = true;
}
if (created) {