mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 14:56:23 +02:00
Add LocalModelsOverlay
This commit is contained in:
parent
06294b403b
commit
051bbd5d34
2 changed files with 80 additions and 0 deletions
45
interface/src/ui/overlays/LocalModelsOverlay.cpp
Normal file
45
interface/src/ui/overlays/LocalModelsOverlay.cpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
//
|
||||||
|
// LocalModelsOverlay.cpp
|
||||||
|
// interface/src/ui/overlays
|
||||||
|
//
|
||||||
|
// Created by Ryan Huffman on 07/08/14.
|
||||||
|
// Copyright 2014 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 "Application.h"
|
||||||
|
|
||||||
|
#include "LocalModelsOverlay.h"
|
||||||
|
|
||||||
|
LocalModelsOverlay::LocalModelsOverlay(ModelTreeRenderer* modelTreeRenderer) :
|
||||||
|
Volume3DOverlay(),
|
||||||
|
_modelTreeRenderer(modelTree) {
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalModelsOverlay::~LocalModelsOverlay() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalModelsOverlay::update(float deltatime) {
|
||||||
|
_modelTreeRenderer->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalModelsOverlay::render() {
|
||||||
|
if (_visible) {
|
||||||
|
glPushMatrix(); {
|
||||||
|
glTranslatef(_position.x, _position.y, _position.z);
|
||||||
|
glScalef(_size, _size, _size);
|
||||||
|
_modelTreeRenderer->render();
|
||||||
|
} glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalModelsOverlay::setProperties(const QScriptValue &properties) {
|
||||||
|
Volume3DOverlay::setProperties(properties);
|
||||||
|
|
||||||
|
if (properties.property("scale").isValid()) {
|
||||||
|
setSize(properties.property("scale").toVariant().toFloat());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
35
interface/src/ui/overlays/LocalModelsOverlay.h
Normal file
35
interface/src/ui/overlays/LocalModelsOverlay.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// LocalModelsOverlay.h
|
||||||
|
// interface/src/ui/overlays
|
||||||
|
//
|
||||||
|
// Created by Ryan Huffman on 07/08/14.
|
||||||
|
// Copyright 2014 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_LocalModelsOverlay_h
|
||||||
|
#define hifi_LocalModelsOverlay_h
|
||||||
|
|
||||||
|
// #include "models/ModelTree.h"
|
||||||
|
#include "models/ModelTreeRenderer.h"
|
||||||
|
|
||||||
|
#include "Volume3DOverlay.h"
|
||||||
|
|
||||||
|
class LocalModelsOverlay : public Volume3DOverlay {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
LocalModelsOverlay(ModelTreeRenderer* modelTreeRenderer);
|
||||||
|
~LocalModelsOverlay();
|
||||||
|
|
||||||
|
virtual void update(float deltatime);
|
||||||
|
virtual void render();
|
||||||
|
|
||||||
|
virtual void setProperties(const QScriptValue& properties);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ModelTreeRenderer *_modelTreeRenderer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_LocalModelsOverlay_h
|
Loading…
Reference in a new issue