Per default set the length of Uranus to a shorter value to allow for earlier time jumps with exceeding the spice kernel range

Set correct min/max values for static rotations
Enable rendering of matrix properties in ImGUI
This commit is contained in:
Alexander Bock
2017-11-24 15:31:19 -05:00
parent 8380b8f421
commit 182694422e
5 changed files with 191 additions and 61 deletions

View File

@@ -54,7 +54,18 @@ return {
Observer = "SUN"
},
Color = {0.2, 0.5, 1.0 },
Period = 60200,
-- Period = 60200,
-- Yes, this period is wrong, but the SPICE kernel we load by default only
-- goes back to 1850. Neptunes orbit is 164 years, which would mean that we
-- exceed the SPICE kernel if we go back before 2014, if we try to compute the
-- entire orbit. Cutting the orbit length to 100 years allows us to go back
-- to 1950 instead, which is good enough.
-- If the positions are needed before that, a different set of kernels are
-- needed, namely:
-- https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de431_part-1.bsp
-- https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de431_part-2.bsp
-- that cover a larger time span: -13201-MAY-06 00:00 to 17191-MAR-15 00:00
Period = 36500,
Resolution = 1000
},
Tag = { "planetTrail_solarSystem", "planetTrail_giants" },

View File

@@ -64,7 +64,7 @@ documentation::Documentation StaticRotation::Documentation() {
}
StaticRotation::StaticRotation()
: _rotationMatrix(RotationInfo, glm::dmat3(1.0))
: _rotationMatrix(RotationInfo, glm::dmat3(1.0), glm::dmat3(-1.0), glm::dmat3(1.0))
{
addProperty(_rotationMatrix);
_rotationMatrix.onChange([this]() { _matrix = _rotationMatrix; });

View File

@@ -105,6 +105,18 @@ void renderDVec4Property(properties::Property* prop, const std::string& ownerNam
IsRegularProperty isRegular = IsRegularProperty::Yes,
ShowToolTip showTooltip = ShowToolTip::Yes);
void renderDMat2Property(properties::Property* prop, const std::string& ownerName,
IsRegularProperty isRegular = IsRegularProperty::Yes,
ShowToolTip showTooltip = ShowToolTip::Yes);
void renderDMat3Property(properties::Property* prop, const std::string& ownerName,
IsRegularProperty isRegular = IsRegularProperty::Yes,
ShowToolTip showTooltip = ShowToolTip::Yes);
void renderDMat4Property(properties::Property* prop, const std::string& ownerName,
IsRegularProperty isRegular = IsRegularProperty::Yes,
ShowToolTip showTooltip = ShowToolTip::Yes);
void renderTriggerProperty(properties::Property* prop, const std::string& ownerName,
IsRegularProperty isRegular = IsRegularProperty::Yes,
ShowToolTip showTooltip = ShowToolTip::Yes);

View File

@@ -393,6 +393,9 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
{ "DVec2Property", &renderDVec2Property },
{ "DVec3Property", &renderDVec3Property },
{ "DVec4Property", &renderDVec4Property },
{ "DMat2Property", &renderDMat2Property },
{ "DMat3Property", &renderDMat3Property },
{ "DMat4Property", &renderDMat4Property },
{ "StringProperty", &renderStringProperty },
{ "OptionProperty", &renderOptionProperty },
{ "TriggerProperty", &renderTriggerProperty },

View File

@@ -28,6 +28,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/properties/matrixproperty.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/selectionproperty.h>
#include <openspace/properties/stringproperty.h>
@@ -300,8 +301,8 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
IVec2Property::ValueType value = *p;
int min = std::min(p->minValue().x, p->minValue().y);
int max = std::max(p->maxValue().x, p->maxValue().y);
int min = glm::compMin(p->minValue());
int max = glm::compMax(p->maxValue());
ImGui::SliderInt2(
name.c_str(),
&value.x,
@@ -315,7 +316,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}",
std::to_string(value),
isRegular
);
}
@@ -332,8 +333,8 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
IVec3Property::ValueType value = *p;
int min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
int max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
int min = glm::compMin(p->minValue());
int max = glm::compMax(p->maxValue());
ImGui::SliderInt3(
name.c_str(),
@@ -348,8 +349,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "," +
std::to_string(value.z) + "}",
std::to_string(value),
isRegular
);
}
@@ -365,12 +365,8 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
IVec4Property::ValueType value = *p;
int min = std::min(std::min(std::min(
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w
);
int max = std::max(std::max(std::max(
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w
);
int min = glm::compMin(p->minValue());
int max = glm::compMax(p->maxValue());
ImGui::SliderInt4(
name.c_str(),
@@ -385,10 +381,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "," +
std::to_string(value.w) + "}",
std::to_string(value),
isRegular
);
}
@@ -427,8 +420,9 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
Vec2Property::ValueType value = *p;
float min = std::min(p->minValue().x, p->minValue().y);
float max = std::max(p->maxValue().x, p->maxValue().y);
float min = static_cast<float>(glm::compMin(p->minValue()));
float max = static_cast<float>(glm::compMax(p->maxValue()));
ImGui::SliderFloat2(
name.c_str(),
&value.x,
@@ -443,7 +437,7 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}",
std::to_string(value),
isRegular
);
}
@@ -460,8 +454,8 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
Vec3Property::ValueType value = *p;
float min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
float max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
float min = static_cast<float>(glm::compMin(p->minValue()));
float max = static_cast<float>(glm::compMax(p->maxValue()));
if (prop->viewOption(Property::ViewOptions::Color)) {
ImGui::ColorEdit3(
@@ -485,9 +479,7 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "}",
std::to_string(value),
isRegular
);
}
@@ -504,10 +496,8 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
Vec4Property::ValueType value = *p;
float min = std::min(std::min(std::min(
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w);
float max = std::max(std::max(std::max(
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w);
float min = static_cast<float>(glm::compMin(p->minValue()));
float max = static_cast<float>(glm::compMax(p->maxValue()));
if (prop->viewOption(Property::ViewOptions::Color)) {
ImGui::ColorEdit4(
@@ -531,10 +521,7 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "," +
std::to_string(value.w) + "}",
std::to_string(value),
isRegular
);
}
@@ -551,8 +538,8 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
glm::vec2 value = glm::dvec2(*p);
float min = static_cast<float>(std::min(p->minValue().x, p->minValue().y));
float max = static_cast<float>(std::max(p->maxValue().x, p->maxValue().y));
float min = static_cast<float>(glm::compMin(p->minValue()));
float max = static_cast<float>(glm::compMax(p->maxValue()));
ImGui::SliderFloat2(
name.c_str(),
&value.x,
@@ -567,7 +554,7 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
if (glm::dvec2(value) != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}",
std::to_string(value),
isRegular
);
}
@@ -584,12 +571,8 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
glm::vec3 value = glm::dvec3(*p);
float min = static_cast<float>(
std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z)
);
float max = static_cast<float>(
std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z)
);
float min = static_cast<float>(glm::compMin(p->minValue()));
float max = static_cast<float>(glm::compMax(p->maxValue()));
bool changed = ImGui::SliderFloat3(
name.c_str(),
@@ -605,9 +588,7 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
if (changed) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "}",
std::to_string(value),
isRegular
);
}
@@ -624,16 +605,8 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + "." + name).c_str());
glm::vec4 value = glm::dvec4(*p);
float min = static_cast<float>(
std::min(std::min(std::min(
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w
)
);
float max = static_cast<float>(
std::max(std::max(std::max(
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w
)
);
float min = static_cast<float>(glm::compMin(p->minValue()));
float max = static_cast<float>(glm::compMax(p->maxValue()));
ImGui::SliderFloat4(
name.c_str(),
@@ -649,10 +622,141 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
if (glm::dvec4(value) != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "," +
std::to_string(value.w) + "}",
std::to_string(value),
isRegular
);
}
ImGui::PopID();
}
void renderDMat2Property(Property* prop, const std::string& ownerName,
IsRegularProperty isRegular, ShowToolTip showTooltip)
{
ghoul_assert(prop, "prop must not be nullptr");
DMat2Property* p = static_cast<DMat2Property*>(prop);
std::string name = p->guiName();
ImGui::PushID((ownerName + "." + name).c_str());
ImGui::Text("%s", name.c_str());
glm::mat2 value = glm::dmat2(*p);
glm::dvec2 minValues = {
glm::compMin(p->minValue()[0]),
glm::compMin(p->minValue()[1])
};
float min = static_cast<float>(glm::compMin(minValues));
glm::dvec2 maxValues = {
glm::compMax(p->maxValue()[0]),
glm::compMax(p->maxValue()[1])
};
float max = static_cast<float>(glm::compMax(maxValues));
ImGui::SliderFloat2("[0]", glm::value_ptr(value[0]), min, max);
ImGui::SliderFloat2("[1]", glm::value_ptr(value[1]), min, max);
if (showTooltip) {
renderTooltip(prop);
}
if (glm::dmat2(value) != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
std::to_string(value),
isRegular
);
}
ImGui::PopID();
}
void renderDMat3Property(Property* prop, const std::string& ownerName,
IsRegularProperty isRegular, ShowToolTip showTooltip)
{
ghoul_assert(prop, "prop must not be nullptr");
DMat3Property* p = static_cast<DMat3Property*>(prop);
std::string name = p->guiName();
ImGui::PushID((ownerName + "." + name).c_str());
ImGui::Text("%s", name.c_str());
glm::mat3 value = glm::dmat3(*p);
glm::dvec3 minValues = {
glm::compMin(p->minValue()[0]),
glm::compMin(p->minValue()[1]),
glm::compMin(p->minValue()[2])
};
float min = static_cast<float>(glm::compMin(minValues));
glm::dvec3 maxValues = {
glm::compMax(p->maxValue()[0]),
glm::compMax(p->maxValue()[1]),
glm::compMax(p->maxValue()[2])
};
float max = static_cast<float>(glm::compMax(maxValues));
ImGui::SliderFloat3("[0]", glm::value_ptr(value[0]), min, max);
ImGui::SliderFloat3("[1]", glm::value_ptr(value[1]), min, max);
ImGui::SliderFloat3("[2]", glm::value_ptr(value[2]), min, max);
if (showTooltip) {
renderTooltip(prop);
}
if (glm::dmat3(value) != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
std::to_string(value),
isRegular
);
}
ImGui::PopID();
}
void renderDMat4Property(Property* prop, const std::string& ownerName,
IsRegularProperty isRegular, ShowToolTip showTooltip)
{
ghoul_assert(prop, "prop must not be nullptr");
DMat4Property* p = static_cast<DMat4Property*>(prop);
std::string name = p->guiName();
ImGui::PushID((ownerName + "." + name).c_str());
ImGui::Text("%s", name.c_str());
glm::mat4 value = glm::dmat4(*p);
glm::dvec4 minValues = {
glm::compMin(p->minValue()[0]),
glm::compMin(p->minValue()[1]),
glm::compMin(p->minValue()[2]),
glm::compMin(p->minValue()[3])
};
float min = static_cast<float>(glm::compMin(minValues));
glm::dvec4 maxValues = {
glm::compMax(p->maxValue()[0]),
glm::compMax(p->maxValue()[1]),
glm::compMax(p->maxValue()[2]),
glm::compMax(p->maxValue()[3])
};
float max = static_cast<float>(glm::compMax(maxValues));
ImGui::SliderFloat4("[0]", glm::value_ptr(value[0]), min, max);
ImGui::SliderFloat4("[1]", glm::value_ptr(value[1]), min, max);
ImGui::SliderFloat4("[2]", glm::value_ptr(value[2]), min, max);
ImGui::SliderFloat4("[3]", glm::value_ptr(value[3]), min, max);
if (showTooltip) {
renderTooltip(prop);
}
if (glm::dmat4(value) != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
std::to_string(value),
isRegular
);
}