Update LocalModelOverlay to work prorperly with translations

This commit is contained in:
Ryan Huffman 2014-07-30 19:06:10 -07:00
parent 06e6505584
commit 01737e18b2
4 changed files with 9 additions and 14 deletions

View file

@ -179,6 +179,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_lastNackTime(usecTimestampNow()),
_lastSendDownstreamAudioStats(usecTimestampNow())
{
// read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);

View file

@ -227,6 +227,7 @@ public:
float getPacketsPerSecond() const { return _packetsPerSecond; }
float getBytesPerSecond() const { return _bytesPerSecond; }
const glm::vec3& getViewMatrixTranslation() const { return _viewMatrixTranslation; }
void setViewMatrixTranslation(const glm::vec3& translation) { _viewMatrixTranslation = translation; }
/// if you need to access the application settings, use lockSettings()/unlockSettings()
QSettings* lockSettings() { _settingsMutex.lock(); return _settings; }

View file

@ -15,7 +15,7 @@
LocalModelsOverlay::LocalModelsOverlay(ModelTreeRenderer* modelTreeRenderer) :
Volume3DOverlay(),
_modelTreeRenderer(modelTree) {
_modelTreeRenderer(modelTreeRenderer) {
}
LocalModelsOverlay::~LocalModelsOverlay() {
@ -28,18 +28,13 @@ void LocalModelsOverlay::update(float deltatime) {
void LocalModelsOverlay::render() {
if (_visible) {
glPushMatrix(); {
glTranslatef(_position.x, _position.y, _position.z);
glScalef(_size, _size, _size);
Application* app = Application::getInstance();
glm::vec3 oldTranslation = app->getViewMatrixTranslation();
app->setViewMatrixTranslation(oldTranslation + _position);
_modelTreeRenderer->render();
Application::getInstance()->setViewMatrixTranslation(oldTranslation);
} glPopMatrix();
}
}
void LocalModelsOverlay::setProperties(const QScriptValue &properties) {
Volume3DOverlay::setProperties(properties);
if (properties.property("scale").isValid()) {
setSize(properties.property("scale").toVariant().toFloat());
}
}

View file

@ -25,8 +25,6 @@ public:
virtual void update(float deltatime);
virtual void render();
virtual void setProperties(const QScriptValue& properties);
private:
ModelTreeRenderer *_modelTreeRenderer;