mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
Enable separate orientation setting for non-equatorial rings
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ private:
|
||||
|
||||
std::string _frame;
|
||||
glm::mat3 _orientation;
|
||||
glm::mat3 _state;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user