Enable separate orientation setting for non-equatorial rings

This commit is contained in:
Alexander Bock
2016-07-29 13:28:44 +02:00
parent 9f1abc67a2
commit 405c66d6f8
2 changed files with 8 additions and 2 deletions
+7 -2
View File
@@ -40,6 +40,7 @@ namespace {
const std::string KeySize = "Size";
const std::string KeyTexture = "Texture";
const std::string KeyFrame = "Frame";
const std::string KeyOrientation = "Orientation";
const std::string KeyOffset = "Offset";
const std::string KeyTransparency = "Transparency";
}
@@ -67,6 +68,10 @@ RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
if (dictionary.hasKeyAndValue<std::string>(KeyFrame)) {
_frame = dictionary.value<std::string>(KeyFrame);
}
if (dictionary.hasKeyAndValue<glm::mat3>(KeyOrientation)) {
_orientation = dictionary.value<glm::mat3>(KeyOrientation);
}
if (dictionary.hasKeyAndValue<std::string>(KeyTexture)) {
_texturePath = absPath(dictionary.value<std::string>(KeyTexture));
@@ -147,7 +152,7 @@ void RenderableRings::render(const RenderData& data) {
_shader->activate();
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
_shader->setUniform("ModelTransform", glm::mat4(_orientation));
_shader->setUniform("ModelTransform", glm::mat4(_orientation * _state));
_shader->setUniform("textureOffset", _offset);
_shader->setUniform("transparency", _transparency);
setPscUniforms(*_shader.get(), data.camera, data.position);
@@ -181,7 +186,7 @@ void RenderableRings::update(const UpdateData& data) {
}
if (!_frame.empty()) {
_orientation = SpiceManager::ref().positionTransformMatrix(_frame, "GALACTIC", data.time);
_state = SpiceManager::ref().positionTransformMatrix(_frame, "GALACTIC", data.time);
}
}
+1
View File
@@ -74,6 +74,7 @@ private:
std::string _frame;
glm::mat3 _orientation;
glm::mat3 _state;
};
} // namespace openspace