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()), _lastNackTime(usecTimestampNow()),
_lastSendDownstreamAudioStats(usecTimestampNow()) _lastSendDownstreamAudioStats(usecTimestampNow())
{ {
// read the ApplicationInfo.ini file for Name/Version/Domain information // read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);

View file

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

View file

@ -15,7 +15,7 @@
LocalModelsOverlay::LocalModelsOverlay(ModelTreeRenderer* modelTreeRenderer) : LocalModelsOverlay::LocalModelsOverlay(ModelTreeRenderer* modelTreeRenderer) :
Volume3DOverlay(), Volume3DOverlay(),
_modelTreeRenderer(modelTree) { _modelTreeRenderer(modelTreeRenderer) {
} }
LocalModelsOverlay::~LocalModelsOverlay() { LocalModelsOverlay::~LocalModelsOverlay() {
@ -28,18 +28,13 @@ void LocalModelsOverlay::update(float deltatime) {
void LocalModelsOverlay::render() { void LocalModelsOverlay::render() {
if (_visible) { if (_visible) {
glPushMatrix(); { glPushMatrix(); {
glTranslatef(_position.x, _position.y, _position.z); Application* app = Application::getInstance();
glScalef(_size, _size, _size); glm::vec3 oldTranslation = app->getViewMatrixTranslation();
app->setViewMatrixTranslation(oldTranslation + _position);
_modelTreeRenderer->render(); _modelTreeRenderer->render();
Application::getInstance()->setViewMatrixTranslation(oldTranslation);
} glPopMatrix(); } 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 update(float deltatime);
virtual void render(); virtual void render();
virtual void setProperties(const QScriptValue& properties);
private: private:
ModelTreeRenderer *_modelTreeRenderer; ModelTreeRenderer *_modelTreeRenderer;