mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Adding documentation and examples (#3541)
- Make the SourceType and DestinationType parameters required in the DashboardItemAngle - Shift the "UTC" string in the DashboardDate from the FormatString to the TimeFormat - Make the SourceType and DestinationType parameters for the DashboardItemDistance required - Add new "Deltatime" option to the DashboardItemFramerate. Add examples for the DashboardItemFramerate - Fix issue where the inputstate would not update if no option was selected - Automatically disable simplification if a unit is requested in the asset for a DashboardItemSimulationIncrement or DashboardItemVelocity
This commit is contained in:
@@ -50,16 +50,16 @@ namespace {
|
||||
"SourceType",
|
||||
"Source Type",
|
||||
"The type of position that is used as the triangle apex used to calculate the "
|
||||
"angle. The default value is 'Camera'.",
|
||||
"angle.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeNameInfo = {
|
||||
"SourceNodeName",
|
||||
"Source Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the apex of the triangle used to calculate the "
|
||||
"angle. The computed angle is the incident angle to Source in the triangle ("
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeIdentifierInfo = {
|
||||
"SourceNodeIdentifier",
|
||||
"Source Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the apex of the triangle used to calculate "
|
||||
"the angle. The computed angle is the incident angle to Source in the triangle ("
|
||||
"Source, Reference, Destination).",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
@@ -73,11 +73,12 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ReferenceNodeNameInfo = {
|
||||
"ReferenceNodeName",
|
||||
"Reference Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the reference direction to compute the angle.",
|
||||
constexpr openspace::properties::Property::PropertyInfo ReferenceNodeIdentifierInfo =
|
||||
{
|
||||
"ReferenceNodeIdentifier",
|
||||
"Reference Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the reference direction to compute the angle.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
@@ -86,21 +87,27 @@ namespace {
|
||||
"Destination Type",
|
||||
"The type of position that is used as the destination to calculate the angle. "
|
||||
"The computed angle is the incident angle to Source in the triangle ("
|
||||
"Source, Reference, Destination). The default value for this is 'Focus'.",
|
||||
"Source, Reference, Destination).",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DestinationNodeNameInfo = {
|
||||
"DestinationNodeName",
|
||||
"Destination Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the destination for computing the angle.",
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
DestinationNodeIdentifierInfo =
|
||||
{
|
||||
"DestinationNodeIdentifier",
|
||||
"Destination Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the destination for computing the angle.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This DashboardItem shows the angle between two scenegraph nodes relative to a
|
||||
// reference node. The angle is calculated in the plane that is defined by the
|
||||
// 'SourceNodeName', 'DestinationNodeName', and the 'ReferenceNodeName'.
|
||||
// This `DashboardItem` shows the angle between the lines `Source`->`Reference` and
|
||||
// `Source`->`Destination`. Each of `Source`, `Reference`, and `Destination` can be
|
||||
// either the identifier of a node, the current focus node, or the position of the
|
||||
// camera. The angle cannot be calculated if two of these three items are located in
|
||||
// the same position, in which case an error message is printed. The `SourceNodeName`,
|
||||
// `ReferenceNodeName`, and `DestinationNodeName` parameters are only used if the
|
||||
// `SourceType`, `ReferenceType`, or `DestinationType` respectively is set to `Node`.
|
||||
struct [[codegen::Dictionary(DashboardItemAngle)]] Parameters {
|
||||
enum class [[codegen::map(Type)]] Type {
|
||||
Node,
|
||||
@@ -109,17 +116,17 @@ namespace {
|
||||
};
|
||||
|
||||
// [[codegen::verbatim(SourceTypeInfo.description)]]
|
||||
std::optional<Type> sourceType;
|
||||
// [[codegen::verbatim(SourceNodeNameInfo.description)]]
|
||||
std::optional<std::string> sourceNodeName;
|
||||
Type sourceType;
|
||||
// [[codegen::verbatim(SourceNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> sourceNodeIdentifier;
|
||||
// [[codegen::verbatim(ReferenceTypeInfo.description)]]
|
||||
Type referenceType;
|
||||
// [[codegen::verbatim(ReferenceNodeNameInfo.description)]]
|
||||
std::optional<std::string> referenceNodeName;
|
||||
// [[codegen::verbatim(ReferenceNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> referenceNodeIdentifier;
|
||||
// [[codegen::verbatim(DestinationTypeInfo.description)]]
|
||||
std::optional<Type> destinationType;
|
||||
// [[codegen::verbatim(DestinationNodeNameInfo.description)]]
|
||||
std::optional<std::string> destinationNodeName;
|
||||
Type destinationType;
|
||||
// [[codegen::verbatim(DestinationNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> destinationNodeIdentifier;
|
||||
};
|
||||
#include "dashboarditemangle_codegen.cpp"
|
||||
} // namespace
|
||||
@@ -140,7 +147,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
SourceTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(SourceNodeNameInfo),
|
||||
properties::StringProperty(SourceNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
, _reference{
|
||||
@@ -148,7 +155,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
ReferenceTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(ReferenceNodeNameInfo),
|
||||
properties::StringProperty(ReferenceNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
, _destination{
|
||||
@@ -156,7 +163,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
DestinationTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(DestinationNodeNameInfo),
|
||||
properties::StringProperty(DestinationNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
{
|
||||
@@ -167,18 +174,13 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
{ Type::Focus, "Focus" },
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
if (p.sourceType.has_value()) {
|
||||
_source.type = codegen::map<Type>(*p.sourceType);
|
||||
}
|
||||
else {
|
||||
_source.type = Type::Camera;
|
||||
}
|
||||
_source.type = codegen::map<Type>(p.sourceType);
|
||||
addProperty(_source.type);
|
||||
|
||||
_source.nodeName.onChange([this]() { _source.node = nullptr; });
|
||||
_source.nodeIdentifier.onChange([this]() { _source.node = nullptr; });
|
||||
if (_source.type == Type::Node) {
|
||||
if (p.sourceNodeName.has_value()) {
|
||||
_source.nodeName = *p.sourceNodeName;
|
||||
if (p.sourceNodeIdentifier.has_value()) {
|
||||
_source.nodeIdentifier = *p.sourceNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -187,7 +189,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_source.nodeName);
|
||||
addProperty(_source.nodeIdentifier);
|
||||
|
||||
|
||||
_reference.type.addOptions({
|
||||
@@ -198,10 +200,10 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
_reference.type = codegen::map<Type>(p.referenceType);
|
||||
addProperty(_reference.type);
|
||||
|
||||
_reference.nodeName.onChange([this]() { _reference.node = nullptr; });
|
||||
_reference.nodeIdentifier.onChange([this]() { _reference.node = nullptr; });
|
||||
if (_reference.type == Type::Node) {
|
||||
if (p.referenceNodeName.has_value()) {
|
||||
_reference.nodeName = *p.referenceNodeName;
|
||||
if (p.referenceNodeIdentifier.has_value()) {
|
||||
_reference.nodeIdentifier = *p.referenceNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -210,24 +212,19 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_reference.nodeName);
|
||||
addProperty(_reference.nodeIdentifier);
|
||||
|
||||
_destination.type.addOptions({
|
||||
{ Type::Node, "Node" },
|
||||
{ Type::Focus, "Focus" },
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
if (p.destinationType.has_value()) {
|
||||
_destination.type = codegen::map<Type>(*p.destinationType);
|
||||
}
|
||||
else {
|
||||
_destination.type = Type::Focus;
|
||||
}
|
||||
_destination.type = codegen::map<Type>(p.destinationType);
|
||||
addProperty(_destination.type);
|
||||
_destination.nodeName.onChange([this]() { _destination.node = nullptr; });
|
||||
_destination.nodeIdentifier.onChange([this]() { _destination.node = nullptr; });
|
||||
if (_destination.type == Type::Node) {
|
||||
if (p.destinationNodeName.has_value()) {
|
||||
_destination.nodeName = *p.destinationNodeName;
|
||||
if (p.destinationNodeIdentifier.has_value()) {
|
||||
_destination.nodeIdentifier = *p.destinationNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -236,7 +233,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_destination.nodeName);
|
||||
addProperty(_destination.nodeIdentifier);
|
||||
|
||||
_localBuffer.resize(128);
|
||||
}
|
||||
@@ -255,7 +252,8 @@ void DashboardItemAngle::update() {
|
||||
if (glm::length(a) == 0.0 || glm::length(b) == 0) {
|
||||
char* end = std::format_to(
|
||||
_localBuffer.data(),
|
||||
"Could not compute angle at {} between {} and {}",
|
||||
"Could not compute angle at {} between {} and {}. At least two of the three "
|
||||
"items are placed in the same location",
|
||||
sourceInfo.second, destinationInfo.second, referenceInfo.second
|
||||
);
|
||||
_buffer = std::string(_localBuffer.data(), end - _localBuffer.data());
|
||||
@@ -284,12 +282,13 @@ glm::vec2 DashboardItemAngle::size() const {
|
||||
std::pair<glm::dvec3, std::string> DashboardItemAngle::positionAndLabel(Component& comp) {
|
||||
if (comp.type == Type::Node) {
|
||||
if (!comp.node) {
|
||||
comp.node = global::renderEngine->scene()->sceneGraphNode(comp.nodeName);
|
||||
comp.node =
|
||||
global::renderEngine->scene()->sceneGraphNode(comp.nodeIdentifier);
|
||||
|
||||
if (!comp.node) {
|
||||
LERRORC(
|
||||
"DashboardItemAngle",
|
||||
"Could not find node '" + comp.nodeName.value() + "'"
|
||||
"Could not find node '" + comp.nodeIdentifier.value() + "'"
|
||||
);
|
||||
return { glm::dvec3(0.0), "Node" };
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
private:
|
||||
struct Component {
|
||||
properties::OptionProperty type;
|
||||
properties::StringProperty nodeName;
|
||||
properties::StringProperty nodeIdentifier;
|
||||
SceneGraphNode* node;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace {
|
||||
"FormatString",
|
||||
"Format String",
|
||||
"The format text describing how this dashboard item renders its text. This text "
|
||||
"must contain exactly one {} which is a placeholder that will contain the date.",
|
||||
"must contain exactly one {} which is a placeholder that will contain the date "
|
||||
"in the format as specified by `TimeFormat`.",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
@@ -54,6 +55,10 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` shows the current in-game simulation time. The `FormatString`
|
||||
// and the `TimeFormat` options provide the ability to customize the output that is
|
||||
// printed. See these two parameters for more information on how to structure the
|
||||
// inputs.
|
||||
struct [[codegen::Dictionary(DashboardItemDate)]] Parameters {
|
||||
// [[codegen::verbatim(FormatStringInfo.description)]]
|
||||
std::optional<std::string> formatString;
|
||||
@@ -75,8 +80,8 @@ documentation::Documentation DashboardItemDate::Documentation() {
|
||||
|
||||
DashboardItemDate::DashboardItemDate(const ghoul::Dictionary& dictionary)
|
||||
: DashboardTextItem(dictionary, 15.f)
|
||||
, _formatString(FormatStringInfo, "Date: {} UTC")
|
||||
, _timeFormat(TimeFormatInfo, "YYYY MON DDTHR:MN:SC.### ::RND")
|
||||
, _formatString(FormatStringInfo, "Date: {}")
|
||||
, _timeFormat(TimeFormatInfo, "YYYY MON DD HR:MN:SC.### UTC ::RND")
|
||||
{
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
|
||||
@@ -51,32 +51,32 @@ namespace {
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceTypeInfo = {
|
||||
"SourceType",
|
||||
"Source Type",
|
||||
"The type of position that is used as the source to calculate the distance. The "
|
||||
"default value is 'Camera'.",
|
||||
"The type of position that is used as the source to calculate the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeNameInfo = {
|
||||
"SourceNodeName",
|
||||
"Source Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the source for computing the distance.",
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeIdentifierInfo = {
|
||||
"SourceNodeIdentifier",
|
||||
"Source Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the source for computing the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DestinationTypeInfo = {
|
||||
"DestinationType",
|
||||
"Destination Type",
|
||||
"The type of position that is used as the destination to calculate the distance. "
|
||||
"The default value for this is 'Focus'.",
|
||||
"The type of position that is used as the destination to calculate the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DestinationNodeNameInfo = {
|
||||
"DestinationNodeName",
|
||||
"Destination Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the destination for computing the distance.",
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
DestinationNodeIdentifierInfo =
|
||||
{
|
||||
"DestinationNodeIdentifier",
|
||||
"Destination Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the destination for computing the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
@@ -106,6 +106,14 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `DashboardItem` displays the distance between two points. The points can be
|
||||
// defined either by the location of a scene graph node, the surface of a scene graph
|
||||
// node's bounding sphere, the location of the current focus node, or the position of
|
||||
// the camera. These definitions can be mixed and matched to calculate any combination
|
||||
// of positions.
|
||||
//
|
||||
// The resulting text can be formatted in the `FormatString` and the measurement unit
|
||||
// is chosed by changing the `Simplification` and `RequestedUnit` parameters.
|
||||
struct [[codegen::Dictionary(DashboardItemDistance)]] Parameters {
|
||||
enum class [[codegen::map(Type)]] TypeInfo {
|
||||
Node,
|
||||
@@ -115,16 +123,16 @@ namespace {
|
||||
};
|
||||
|
||||
// [[codegen::verbatim(SourceTypeInfo.description)]]
|
||||
std::optional<TypeInfo> sourceType;
|
||||
TypeInfo sourceType;
|
||||
|
||||
// [[codegen::verbatim(SourceNodeNameInfo.description)]]
|
||||
std::optional<std::string> sourceNodeName;
|
||||
// [[codegen::verbatim(SourceNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> sourceNodeIdentifier;
|
||||
|
||||
// [[codegen::verbatim(DestinationTypeInfo.description)]]
|
||||
std::optional<TypeInfo> destinationType;
|
||||
TypeInfo destinationType;
|
||||
|
||||
// [[codegen::verbatim(DestinationNodeNameInfo.description)]]
|
||||
std::optional<std::string> destinationNodeName;
|
||||
// [[codegen::verbatim(DestinationNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> destinationNodeIdentifier;
|
||||
|
||||
// [[codegen::verbatim(SimplificationInfo.description)]]
|
||||
std::optional<bool> simplification;
|
||||
@@ -158,7 +166,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
SourceTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(SourceNodeNameInfo),
|
||||
properties::StringProperty(SourceNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
, _destination{
|
||||
@@ -166,7 +174,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
DestinationTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(DestinationNodeNameInfo),
|
||||
properties::StringProperty(DestinationNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
{
|
||||
@@ -179,24 +187,19 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
_source.type.onChange([this]() {
|
||||
_source.nodeName.setVisibility(
|
||||
_source.nodeIdentifier.setVisibility(
|
||||
properties::Property::Visibility(
|
||||
_source.type == Type::Node || _source.type == Type::NodeSurface
|
||||
)
|
||||
);
|
||||
});
|
||||
if (p.sourceType.has_value()) {
|
||||
_source.type = codegen::map<Type>(*p.sourceType);
|
||||
}
|
||||
else {
|
||||
_source.type = Type::Camera;
|
||||
}
|
||||
_source.type = codegen::map<Type>(p.sourceType);
|
||||
addProperty(_source.type);
|
||||
|
||||
_source.nodeName.onChange([this]() { _source.node = nullptr; });
|
||||
_source.nodeIdentifier.onChange([this]() { _source.node = nullptr; });
|
||||
if (_source.type == Type::Node || _source.type == Type::NodeSurface) {
|
||||
if (p.sourceNodeName.has_value()) {
|
||||
_source.nodeName = *p.sourceNodeName;
|
||||
if (p.sourceNodeIdentifier.has_value()) {
|
||||
_source.nodeIdentifier = *p.sourceNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -205,7 +208,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_source.nodeName);
|
||||
addProperty(_source.nodeIdentifier);
|
||||
|
||||
_destination.type.addOptions({
|
||||
{ Type::Node, "Node" },
|
||||
@@ -214,23 +217,18 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
_destination.type.onChange([this]() {
|
||||
_destination.nodeName.setVisibility(
|
||||
_destination.nodeIdentifier.setVisibility(
|
||||
properties::Property::Visibility(
|
||||
_source.type == Type::Node || _source.type == Type::NodeSurface
|
||||
)
|
||||
);
|
||||
});
|
||||
if (p.destinationType.has_value()) {
|
||||
_destination.type = codegen::map<Type>(*p.destinationType);
|
||||
}
|
||||
else {
|
||||
_destination.type = Type::Focus;
|
||||
}
|
||||
_destination.type = codegen::map<Type>(p.destinationType);
|
||||
addProperty(_destination.type);
|
||||
_destination.nodeName.onChange([this]() { _destination.node = nullptr; });
|
||||
_destination.nodeIdentifier.onChange([this]() { _destination.node = nullptr; });
|
||||
if (_destination.type == Type::Node || _destination.type == Type::NodeSurface) {
|
||||
if (p.destinationNodeName.has_value()) {
|
||||
_destination.nodeName = *p.destinationNodeName;
|
||||
if (p.destinationNodeIdentifier.has_value()) {
|
||||
_destination.nodeIdentifier = *p.destinationNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -239,7 +237,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_destination.nodeName);
|
||||
addProperty(_destination.nodeIdentifier);
|
||||
|
||||
_doSimplification = p.simplification.value_or(_doSimplification);
|
||||
addProperty(_doSimplification);
|
||||
@@ -270,13 +268,13 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
|
||||
if ((mainComp.type == Type::Node) || (mainComp.type == Type::NodeSurface)) {
|
||||
if (!mainComp.node) [[unlikely]] {
|
||||
mainComp.node = global::renderEngine->scene()->sceneGraphNode(
|
||||
mainComp.nodeName
|
||||
mainComp.nodeIdentifier
|
||||
);
|
||||
|
||||
if (!mainComp.node) {
|
||||
LERRORC(
|
||||
"DashboardItemDistance",
|
||||
"Could not find node '" + mainComp.nodeName.value() + "'"
|
||||
"Could not find node '" + mainComp.nodeIdentifier.value() + "'"
|
||||
);
|
||||
return { glm::dvec3(0.0), "Node" };
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
private:
|
||||
struct Component {
|
||||
properties::OptionProperty type;
|
||||
properties::StringProperty nodeName;
|
||||
properties::StringProperty nodeIdentifier;
|
||||
SceneGraphNode* node;
|
||||
};
|
||||
|
||||
|
||||
@@ -70,12 +70,15 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` displays the remaining time until a provided `ReferenceTime`
|
||||
// or the elapsed time since the `ReferenceTime`. The output can be configured through
|
||||
// the `FormatString` and the unit that is used to display the configurable as well.
|
||||
struct [[codegen::Dictionary(DashboardItemElapsedTime)]] Parameters {
|
||||
// [[codegen::verbatim(FormatStringInfo.description)]]
|
||||
std::optional<std::string> formatString;
|
||||
|
||||
// [[codegen::verbatim(ReferenceTimeInfo.description)]]
|
||||
std::string referenceTime;
|
||||
std::string referenceTime [[codegen::datetime()]];
|
||||
|
||||
// [[codegen::verbatim(SimplifyTimeInfo.description)]]
|
||||
std::optional<bool> simplifyTime;
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
|
||||
namespace {
|
||||
enum FrametimeType {
|
||||
DtTimeAvg = 0,
|
||||
DtTime = 0,
|
||||
DtTimeAvg,
|
||||
DtTimeExtremes,
|
||||
DtStandardDeviation,
|
||||
DtCoefficientOfVariation,
|
||||
@@ -60,6 +61,14 @@ namespace {
|
||||
};
|
||||
|
||||
[[nodiscard]] char* formatDt(std::vector<char>& buffer) {
|
||||
return std::format_to(
|
||||
buffer.data(),
|
||||
"Frametime: {:.2f} ms\0",
|
||||
openspace::global::windowDelegate->deltaTime()
|
||||
);
|
||||
}
|
||||
|
||||
[[nodiscard]] char* formatDtAvg(std::vector<char>& buffer) {
|
||||
return std::format_to(
|
||||
buffer.data(),
|
||||
"Avg. Frametime: {:.2f} ms\0",
|
||||
@@ -120,8 +129,10 @@ namespace {
|
||||
{
|
||||
using namespace openspace;
|
||||
switch (frametimeType) {
|
||||
case FrametimeType::DtTimeAvg:
|
||||
case FrametimeType::DtTime:
|
||||
return formatDt(buffer);
|
||||
case FrametimeType::DtTimeAvg:
|
||||
return formatDtAvg(buffer);
|
||||
case FrametimeType::DtTimeExtremes:
|
||||
return formatDtExtremes(buffer, minFrametimeCache, maxFrametimeCache);
|
||||
case FrametimeType::DtStandardDeviation:
|
||||
@@ -137,8 +148,29 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
// This `DashboardItem` provides information about the current framerate at which the
|
||||
// rendering updates. The `FrametimeType` can have different values that will show
|
||||
// different statistical aspects of the framerate.
|
||||
//
|
||||
// - `Deltatime`: Shows the time in milliseconds it took to render the previous
|
||||
// frame
|
||||
// - `Average Deltatime`: Shows the time that it took to render in milliseconds
|
||||
// averaged over the last 100 or so frames
|
||||
// - `Deltatime extremes`: Shows the minimum and maximum values of the render time
|
||||
// in milliseconds over the last 100 or so frames
|
||||
// - `Deltatime standard deviation`: Shows the standard deviation of the render time
|
||||
// in milliseconds over the last 100 or so frames
|
||||
// - `Deltatime coefficient of variation`: Shows the normalized root-mean-square
|
||||
// deviation of the render time in
|
||||
// milliseconds over the last 100 or so
|
||||
// frames
|
||||
// - `Frames per second`: Shows the inverse of the delta time it took the render the
|
||||
// last frame.
|
||||
// - `Average frames per second`: Shows average number of frames that have been
|
||||
// presented over the last 100 or so frames
|
||||
struct [[codegen::Dictionary(DashboardItemFramerate)]] Parameters {
|
||||
enum class [[codegen::map(FrametimeType)]] Type {
|
||||
DtTime [[codegen::key("Deltatime")]],
|
||||
DtTimeAvg [[codegen::key("Average Deltatime")]],
|
||||
DtTimeExtremes [[codegen::key("Deltatime extremes")]],
|
||||
DtStandardDeviation [[codegen::key("Deltatime standard deviation")]],
|
||||
@@ -152,7 +184,6 @@ namespace {
|
||||
std::optional<Type> frametimeType;
|
||||
};
|
||||
#include "dashboarditemframerate_codegen.cpp"
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -172,6 +203,7 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
_frametimeType.addOptions({
|
||||
{ static_cast<int>(FrametimeType::DtTime), "Deltatime" },
|
||||
{ static_cast<int>(FrametimeType::DtTimeAvg), "Average Deltatime" },
|
||||
{ static_cast<int>(FrametimeType::DtTimeExtremes), "Deltatime extremes" },
|
||||
{
|
||||
|
||||
@@ -69,7 +69,12 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
struct [[codegen::Dictionary(DashboardItemPropertyValue)]] Parameters {
|
||||
// This `DashboardItem` shows the current state of the different methods to provide
|
||||
// user input: keyboard, mouse, and/or joystick.
|
||||
//
|
||||
// Each input method has the ability to be selectively disabled, meaning that all
|
||||
// inputs from that input method are ignored by the system entirely.
|
||||
struct [[codegen::Dictionary(DashboardItemInputState)]] Parameters {
|
||||
// [[codegen::verbatim(ShowWhenEnabledInfo.description)]]
|
||||
std::optional<bool> showWhenEnabled;
|
||||
|
||||
@@ -166,9 +171,7 @@ void DashboardItemInputState::update() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!text.empty()) {
|
||||
_buffer = ghoul::join(std::move(text), "\n");
|
||||
}
|
||||
_buffer = ghoul::join(std::move(text), "\n");
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemInputState::size() const {
|
||||
|
||||
@@ -51,15 +51,21 @@ namespace {
|
||||
progress.append("|");
|
||||
return progress;
|
||||
}
|
||||
|
||||
// This `DashboardItem` shows information about the currently active mission. This
|
||||
// includes information about the currently active mission phase, the next phase, and
|
||||
// all subphases of the currently active phase.
|
||||
struct [[codegen::Dictionary(DashboardItemMission)]] Parameters {};
|
||||
#include "dashboarditemmission_codegen.cpp"
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation DashboardItemMission::Documentation() {
|
||||
documentation::Documentation doc = DashboardTextItem::Documentation();
|
||||
doc.name = "DashboardItemMission";
|
||||
doc.id = "base_dashboarditem_mission";
|
||||
return doc;
|
||||
return codegen::doc<Parameters>(
|
||||
"base_dashboarditem_mission",
|
||||
DashboardTextItem::Documentation()
|
||||
);
|
||||
}
|
||||
|
||||
DashboardItemMission::DashboardItemMission(const ghoul::Dictionary& dictionary)
|
||||
|
||||
@@ -34,13 +34,26 @@
|
||||
#include <ghoul/font/font.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
|
||||
namespace {
|
||||
// This `DashboardItem` displays information about the status of the parallel
|
||||
// connection, which is whether OpenSpace is directly connected to other OpenSpace
|
||||
// instances and can either control those instances or be controlled by the master of
|
||||
// the session. If OpenSpace is not connected, this `DashboardItem` will not display
|
||||
// anything.
|
||||
//
|
||||
// The information presented contains how many clients are connected to the same
|
||||
// session and whether this machine is currently the host of the session.
|
||||
struct [[codegen::Dictionary(DashboardItemParallelConnection)]] Parameters {};
|
||||
#include "dashboarditemparallelconnection_codegen.cpp"
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation DashboardItemParallelConnection::Documentation() {
|
||||
documentation::Documentation doc = DashboardTextItem::Documentation();
|
||||
doc.name = "DashboardItemParallelConnection";
|
||||
doc.id = "base_dashboarditem_parallelconnection";
|
||||
return doc;
|
||||
return codegen::doc<Parameters>(
|
||||
"base_dashboarditem_parallelconnection",
|
||||
DashboardTextItem::Documentation()
|
||||
);
|
||||
}
|
||||
|
||||
DashboardItemParallelConnection::DashboardItemParallelConnection(
|
||||
|
||||
@@ -67,11 +67,16 @@ namespace {
|
||||
"the value itself will be displayed), or it must contain extact one or more "
|
||||
"instances of {}, which will be replaced with the value(s) of the property "
|
||||
"during rendering. For scalar types, there has to be exactly one instance of {}, "
|
||||
"for vector types, there need to be as many {} as there are compoents in the "
|
||||
"vector, for example two {} for vec2 types, three for vec3 types, etc.",
|
||||
"for vector types, there need to be as many {} as there are components in the "
|
||||
"vector, for example two {} for vec2 types, three for vec3 types, etc. For more "
|
||||
"information on how to structure the formatting string, see the documentation at "
|
||||
"https://en.cppreference.com/w/cpp/utility/format/spec.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` will show the value of the provided property. Depending on the
|
||||
// type of the property, the `DisplayString` will have to be adapted. See the
|
||||
// documentation for the `DisplayString` for more information.
|
||||
struct [[codegen::Dictionary(DashboardItemPropertyValue)]] Parameters {
|
||||
// [[codegen::verbatim(PropertyUriInfo.description)]]
|
||||
std::optional<std::string> uri [[codegen::key("URI")]];
|
||||
|
||||
@@ -61,7 +61,9 @@ namespace {
|
||||
"delta time. This format gets five parameters in this order: The target delta "
|
||||
"time value, the target delta time unit, the string 'Paused' if the delta time "
|
||||
"is paused or the empty string otherwise, the current delta time value, and the "
|
||||
"current delta time unit.",
|
||||
"current delta time unit. More information about how to make use of the format "
|
||||
"string, see the documentation at "
|
||||
"https://en.cppreference.com/w/cpp/utility/format/spec.",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
@@ -71,7 +73,9 @@ namespace {
|
||||
"The format string used to format the text if the target delta time is the same "
|
||||
"as the current delta time. This format gets three parameters in this order: "
|
||||
"The target delta value, the target delta unit, and the string 'Paused' if the "
|
||||
"delta time is paused or the empty string otherwise.",
|
||||
"delta time is paused or the empty string otherwise. More information about how "
|
||||
"to make use of the format string, see the documentation at "
|
||||
"https://en.cppreference.com/w/cpp/utility/format/spec.",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
@@ -88,6 +92,10 @@ namespace {
|
||||
return res;
|
||||
}
|
||||
|
||||
// This `DashboardItem` shows how fast the in-game time progresses. The display string
|
||||
// for the `RegularFormat` is used when the current simulation increment is not
|
||||
// changing, the `TransitionFormat` is used if the simulation increment is currently
|
||||
// interpolating to a new value.
|
||||
struct [[codegen::Dictionary(DashboardItemSimulationIncrement)]] Parameters {
|
||||
// [[codegen::verbatim(SimplificationInfo.description)]]
|
||||
std::optional<bool> simplification;
|
||||
@@ -143,6 +151,7 @@ DashboardItemSimulationIncrement::DashboardItemSimulationIncrement(
|
||||
if (p.requestedUnit.has_value()) {
|
||||
const TimeUnit unit = timeUnitFromString(*p.requestedUnit);
|
||||
_requestedUnit = static_cast<int>(unit);
|
||||
_doSimplification = false;
|
||||
}
|
||||
_requestedUnit.setVisibility(properties::Property::Visibility::Hidden);
|
||||
addProperty(_requestedUnit);
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` adds a variable amount of spacing between two other
|
||||
// `DashboardItem`s.
|
||||
struct [[codegen::Dictionary(DashboardItemSpacing)]] Parameters {
|
||||
// [[codegen::verbatim(SpacingInfo.description)]]
|
||||
std::optional<float> spacing;
|
||||
|
||||
@@ -55,6 +55,12 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` shows the velocity of the camera, that is how fast the camera
|
||||
// has moved since the last frame in the amount of time it took to render that frame.
|
||||
// The `Simplification` and `RequestedUnit` can be used to control which unit is used
|
||||
// to display the speed. By default, `Simplification` is enabled, which means that the
|
||||
// most natural unit, that is, the one that gives the least number of printed digits,
|
||||
// is used.
|
||||
struct [[codegen::Dictionary(DashboardItemVelocity)]] Parameters {
|
||||
// [[codegen::verbatim(SimplificationInfo.description)]]
|
||||
std::optional<bool> simplification;
|
||||
@@ -81,7 +87,6 @@ DashboardItemVelocity::DashboardItemVelocity(const ghoul::Dictionary& dictionary
|
||||
, _requestedUnit(RequestedUnitInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
{
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
_doSimplification = p.simplification.value_or(_doSimplification);
|
||||
_doSimplification.onChange([this]() {
|
||||
_requestedUnit.setVisibility(
|
||||
_doSimplification ?
|
||||
@@ -89,6 +94,7 @@ DashboardItemVelocity::DashboardItemVelocity(const ghoul::Dictionary& dictionary
|
||||
properties::Property::Visibility::User
|
||||
);
|
||||
});
|
||||
_doSimplification = p.simplification.value_or(_doSimplification);
|
||||
addProperty(_doSimplification);
|
||||
|
||||
for (const DistanceUnit u : DistanceUnits) {
|
||||
@@ -101,8 +107,8 @@ DashboardItemVelocity::DashboardItemVelocity(const ghoul::Dictionary& dictionary
|
||||
if (p.requestedUnit.has_value()) {
|
||||
const DistanceUnit unit = distanceUnitFromString(*p.requestedUnit);
|
||||
_requestedUnit = static_cast<int>(unit);
|
||||
_doSimplification = false;
|
||||
}
|
||||
_requestedUnit.setVisibility(properties::Property::Visibility::Hidden);
|
||||
addProperty(_requestedUnit);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,10 +168,18 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Renderable` shows a three-dimensional model. The provided model may contain
|
||||
// textures and animations and is affected by the optionally-provided light sources.
|
||||
// Each model's scale can be adapted by the `ModelScale` and `InvertModelScale`
|
||||
// parameters to account for discrepancies in the units that a model was created in.
|
||||
// See the Documentation page "Scaling of models" for more detailed information.
|
||||
//
|
||||
// Limitation: At the time, only animations of the "Keyframe" type are supported. See
|
||||
// each specific model format to see if it supports that type of animation.
|
||||
struct [[codegen::Dictionary(RenderableModel)]] Parameters {
|
||||
// The file or files that should be loaded in this RenderableModel. The file can
|
||||
// contain filesystem tokens. This specifies the model that is rendered by
|
||||
// the Renderable.
|
||||
// The file or files that should be loaded in this RenderableModel. Most common
|
||||
// model formats, such as .obj, .fbx, or .gltf. For a full list of supported file
|
||||
// formats, see https://github.com/assimp/assimp/blob/master/doc/Fileformats.md
|
||||
std::filesystem::path geometryFile;
|
||||
|
||||
// The scale of the model. For example, if the model is in centimeters then
|
||||
|
||||
@@ -93,6 +93,10 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// A `RenderablePlane` is a renderable that will shows some form of contents projected
|
||||
// on a two-dimensional plane, which in turn is placed in three-dimensional space as
|
||||
// any other `Renderable`. It is possible to specify the `Size` of the plane, whether
|
||||
// it should always face the camera (`Billboard`), and other parameters shown below.
|
||||
struct [[codegen::Dictionary(RenderablePlane)]] Parameters {
|
||||
// [[codegen::verbatim(BillboardInfo.description)]]
|
||||
std::optional<bool> billboard;
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// A RenderablePlaneImageLocal creates a textured 3D plane, where the texture is
|
||||
// provided by a local file on disk.
|
||||
struct [[codegen::Dictionary(RenderablePlaneImageLocal)]] Parameters {
|
||||
// [[codegen::verbatim(TextureInfo.description)]]
|
||||
std::string texture;
|
||||
|
||||
@@ -129,6 +129,10 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Renderable` represents a simple sphere with an image. The image that is shown
|
||||
// should be in an equirectangular projection/spherical panoramic image or else
|
||||
// distortions will be introduced. The `Orientation` parameter determines whether the
|
||||
// provided image is shown on the inside, outside, or both sides of the sphere.
|
||||
struct [[codegen::Dictionary(RenderableSphere)]] Parameters {
|
||||
// [[codegen::verbatim(SizeInfo.description)]]
|
||||
std::optional<float> size [[codegen::greater(0.f)]];
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `Renderable` shows a sphere with an image provided by a local file on disk. To
|
||||
// show a sphere with an image from an online source, see
|
||||
// [RenderableSphereImageOnline](#base_screenspace_image_online).
|
||||
struct [[codegen::Dictionary(RenderableSphereImageLocal)]] Parameters {
|
||||
// [[codegen::verbatim(TextureInfo.description)]]
|
||||
std::filesystem::path texture;
|
||||
|
||||
@@ -64,9 +64,10 @@ namespace {
|
||||
);
|
||||
}
|
||||
|
||||
// A RenderableSphereImageOnline can be used to show an image from an online source
|
||||
// (as a URL) on a sphere in the OpenSpace scene. The image should be provided in an
|
||||
// equirectangular projection, if it is a map that is draped over the sphere.
|
||||
// This `Renderable` shows a sphere with an image provided by an online URL. The image
|
||||
// will be downloaded when the `Renderable` is added to a scene graph node. To show a
|
||||
// sphere with an image from a local file, see
|
||||
// [RenderableSphereImageLocal](#base_screenspace_image_local).
|
||||
struct [[codegen::Dictionary(RenderableSphereImageOnline)]] Parameters {
|
||||
// [[codegen::verbatim(TextureInfo.description)]]
|
||||
std::string url [[codegen::key("URL")]];
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This rotation type will cause a scene graph node to rotate about the provided axis
|
||||
// at a fixed and constant rotation speed.
|
||||
struct [[codegen::Dictionary(ConstantRotation)]] Parameters {
|
||||
// [[codegen::verbatim(RotationInfo.description)]]
|
||||
std::optional<glm::dvec3> rotationAxis
|
||||
|
||||
@@ -192,7 +192,46 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Rotation` calculates the rotation in such a way that the attached scene graph
|
||||
// node will always be relative to some other direction or pointing at another scene
|
||||
// graph node.
|
||||
//
|
||||
// The first use-case of the `FixedRotation` needs exactly two of its three axes
|
||||
// (`XAxis`, `YAxis`, `ZAxis`) specified with the last axis being unspecified. The
|
||||
// axis that is missing will be calculated using a right-handed coordinate completion
|
||||
// using the two provided axes. Each axis can be specified either by providing the
|
||||
// `Identifier` of another scene graph node, or by providing a direction vector. For
|
||||
// the general use-case of this `Rotation`, one of the provided axes usually is an
|
||||
// `Identifier` and the other is a direction vector (see the examples below).
|
||||
// If any of the axes is using the `Identifier` of another scene graph node, the
|
||||
// `Attached` value must be specified and should almost always be the identifier of
|
||||
// the scene graph node to which this `Rotation` belongs.
|
||||
//
|
||||
// A second use-case for this `Rotation` is to directly specify mappings for the
|
||||
// coordinate axes. In this use-case, two or all three axes are specified using
|
||||
// direction vectors. The orientation of the rotated coordinate system will then be
|
||||
// determined by the specified axes, such that the new x-axis points in the direction
|
||||
// provided to the `XAxis`, for example. Note that all direction vectors are assumed
|
||||
// to be normalized. If only two direction vectors are specified, the third direction
|
||||
// is computed using a right-handed coordinate system completion.
|
||||
//
|
||||
// Each axis has an `invert` option that will cause the provided axes to be considered
|
||||
// inverted. For the direction-type of axis, this just inverts the provided values,
|
||||
// but it is more useful for the `Identifier` version to construct a direction that
|
||||
// either points towards or away from the provided scene graph node.
|
||||
//
|
||||
// Lastly, each axis has an `orthogonal` option. If that value is specified, the
|
||||
// provided axis is instead cross-producted with the other axis first with the
|
||||
// resulting orthogonal vector used as the mapped axis. This is primarily useful when
|
||||
// specifying a direction vector and wanting to ensure that the total rotation remains
|
||||
// a valid non-skewed rotation (meaning that all three coordinate axes are orthogonal
|
||||
// to each other) when the second axis can assume arbitrary values. Unless there is a
|
||||
// very good reason not to, whenever an axis is specified as a direction vector, that
|
||||
// axis' `orthogonal` setting should also probably be enabled.
|
||||
struct [[codegen::Dictionary(FixedRotation)]] Parameters {
|
||||
// [[codegen::verbatim(AttachedInfo.description)]]
|
||||
std::optional<std::string> attached;
|
||||
|
||||
// This value specifies the direction of the new X axis. If this value is not
|
||||
// specified, it will be computed by completing a right handed coordinate system
|
||||
// from the Y and Z axis, which must be specified instead. If this value is a
|
||||
@@ -231,9 +270,6 @@ namespace {
|
||||
|
||||
// [[codegen::verbatim(ZAxisInvertObjectInfo.description)]]
|
||||
std::optional<bool> zAxisInvert;
|
||||
|
||||
// [[codegen::verbatim(AttachedInfo.description)]]
|
||||
std::optional<std::string> attached;
|
||||
};
|
||||
#include "fixedrotation_codegen.cpp"
|
||||
} // namespace
|
||||
|
||||
@@ -51,6 +51,11 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Rotation` type generates the rotation for the attached scene graph node by
|
||||
// calling the provided Lua script to create the full matrix used to orient the scene
|
||||
// graph node. The returned matrix must be a valid rotation matrix. The script
|
||||
// parameter describes in greater detail how the Lua script file should be
|
||||
// constructed.
|
||||
struct [[codegen::Dictionary(LuaRotation)]] Parameters {
|
||||
// [[codegen::verbatim(ScriptInfo.description)]]
|
||||
std::filesystem::path script;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <optional>
|
||||
@@ -39,6 +40,10 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Rotation` uses a timeline of other `Rotation` classes to calculate the
|
||||
// final rotation for the attached scene graph node. The current in-game time is
|
||||
// used to determine which specific keyframe to currently use. It is also possible to
|
||||
// interpolate between two adjacent keyframes.
|
||||
struct [[codegen::Dictionary(TimelineRotation)]] Parameters {
|
||||
// A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values
|
||||
// that are valid Rotation objects
|
||||
@@ -69,6 +74,8 @@ TimelineRotation::TimelineRotation(const ghoul::Dictionary& dictionary)
|
||||
ghoul::mm_unique_ptr<Rotation> rotation = Rotation::createFromDictionary(
|
||||
kf.second
|
||||
);
|
||||
rotation->setIdentifier(makeIdentifier(kf.first));
|
||||
addPropertySubOwner(rotation.get());
|
||||
_timeline.addKeyframe(t, std::move(rotation));
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Scale` type generates the scale values for the attached scene graph node by
|
||||
// calling the provided Lua script. The script must return three scaling factors, one
|
||||
// for each principal axis. The script parameter describes in greater detail how the
|
||||
// Lua script file should be constructed.
|
||||
struct [[codegen::Dictionary(LuaScale)]] Parameters {
|
||||
// [[codegen::verbatim(ScriptInfo.description)]]
|
||||
std::filesystem::path script;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace {
|
||||
// interpolate between two adjacent keyframes.
|
||||
struct [[codegen::Dictionary(TimelineScale)]] Parameters {
|
||||
// A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values
|
||||
// that are valid Scale objects
|
||||
// that are valid Scale objects.
|
||||
std::map<std::string, ghoul::Dictionary> keyframes
|
||||
[[codegen::reference("core_transform_scale")]];
|
||||
|
||||
@@ -108,10 +108,14 @@ glm::dvec3 TimelineScale::scaleValue(const UpdateData& data) const {
|
||||
return glm::mix(prev->data->scaleValue(data), next->data->scaleValue(data), t);
|
||||
}
|
||||
else {
|
||||
return now < nextTime ?
|
||||
prev->data->scaleValue(data) :
|
||||
next->data->scaleValue(data);
|
||||
if (prevTime <= now && now < nextTime) {
|
||||
return prev->data->scaleValue(data);
|
||||
}
|
||||
else if (nextTime <= now) {
|
||||
return next->data->scaleValue(data);
|
||||
}
|
||||
}
|
||||
return glm::dvec3(0.0);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -59,6 +59,11 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `TimeFrame`'s validity is determined by a single start and end time in between
|
||||
// which the scene graph node is valid. The start time is inclusive, while the end
|
||||
// time is exclusive. If the start time or end time is not specified, the value
|
||||
// corresponds to $-\infty$ and $\infty$ respectively. If both the start and end time
|
||||
// are not specified, the `TimeFrameInterval` will always be valid.
|
||||
struct [[codegen::Dictionary(TimeFrameInterval)]] Parameters {
|
||||
// [[codegen::verbatim(StartInfo.description)]]
|
||||
std::optional<std::variant<double, std::string>> start;
|
||||
|
||||
@@ -51,6 +51,11 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Translation` type generates the translation values used to offset the
|
||||
// attached scene graph node's position by calling the provided Lua script. The script
|
||||
// must return three translation factors, one for each principal axis, each providing
|
||||
// in meters. The script parameter describes in greater detail how the Lua script file
|
||||
// should be constructed.
|
||||
struct [[codegen::Dictionary(LuaTranslation)]] Parameters {
|
||||
// [[codegen::verbatim(ScriptInfo.description)]]
|
||||
std::filesystem::path script;
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `Translation` provides a fixed translation to the attached scene graph node
|
||||
// that does not change unless the `Position` property is changed.
|
||||
struct [[codegen::Dictionary(StaticTranslation)]] Parameters {
|
||||
// [[codegen::verbatim(PositionInfo.description)]]
|
||||
glm::dvec3 position;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <optional>
|
||||
@@ -39,6 +40,11 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Translation` uses a timeline of other `Translation` classes to calculate the
|
||||
// final translation for the attached scene graph node. The current in-game time is
|
||||
// used to determine which specific keyframe to currently use. It is also possible to
|
||||
// disable the interpolation between two adjacent keyframes by setting the
|
||||
// `ShouldInterpolate` parameter to `false`.
|
||||
struct [[codegen::Dictionary(TimelineTranslation)]] Parameters {
|
||||
// A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values
|
||||
// that are valid Translation objects
|
||||
@@ -68,6 +74,8 @@ TimelineTranslation::TimelineTranslation(const ghoul::Dictionary& dictionary)
|
||||
|
||||
ghoul::mm_unique_ptr<Translation> translation =
|
||||
Translation::createFromDictionary(kf.second);
|
||||
translation->setIdentifier(makeIdentifier(kf.first));
|
||||
addPropertySubOwner(translation.get());
|
||||
_timeline.addKeyframe(t, std::move(translation));
|
||||
}
|
||||
|
||||
@@ -99,7 +107,7 @@ glm::dvec3 TimelineTranslation::position(const UpdateData& data) const {
|
||||
if (nextTime - prevTime > 0.0) {
|
||||
t = (now - prevTime) / (nextTime - prevTime);
|
||||
}
|
||||
return t * next->data->position(data) + (1.0 - t) * prev->data->position(data);
|
||||
return glm::mix(prev->data->position(data), next->data->position(data), t);
|
||||
}
|
||||
else {
|
||||
if (prevTime <= now && now < nextTime) {
|
||||
|
||||
@@ -57,6 +57,12 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `DashboardItem` shows the longitude/latitude location of the camera and its
|
||||
// distance to the current focus node. If the current focus node is Earth, these are
|
||||
// provided in the WGS84 reference frame; if the focus is on another planetary body,
|
||||
// it is in the native coordinate frame for that planetary body. If the current focus
|
||||
// node is not a planetary body, a position of (0,0) with a distance of 0 will be
|
||||
// displayed.
|
||||
struct [[codegen::Dictionary(DashboardItemGlobeLocation)]] Parameters {
|
||||
enum class DisplayFormat {
|
||||
DecimalDegrees,
|
||||
|
||||
@@ -87,6 +87,11 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `Rotation` orients the scene graph node in such a way that the y-axis points
|
||||
// away from the provided globe, the x-axis points towards the globe's southern pole
|
||||
// and the z-axis points in a western direction. Using this rotation generally means
|
||||
// using the [GlobeTranslation](#globebrowsing_translation_globetranslation) to place
|
||||
// the scene graph node at the same position for which the rotation is calculated.
|
||||
struct [[codegen::Dictionary(GlobeRotation)]] Parameters {
|
||||
// [[codegen::verbatim(GlobeInfo.description)]]
|
||||
std::string globe
|
||||
|
||||
@@ -87,13 +87,13 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This renderable can be used to visualize a certain travel speed using a line that
|
||||
// This `Renderable` can be used to visualize a certain travel speed using a line that
|
||||
// moves at the provided speed from a start object to a target. The start position
|
||||
// will be set from the `Parent` of this scene graph node, and the end position is
|
||||
// set from the provided `Target` scene graph node. Per default, the speed is set to
|
||||
// the speed of light.
|
||||
//
|
||||
// The length of the traveling line is set based on the travel speed and can be used
|
||||
// The length of the travelling line is set based on the travel speed and can be used
|
||||
// to show more information related to the distance traveled. For example, a length
|
||||
// of 1 shows how far an object would move over a duration of one second based on the
|
||||
// selected speed.
|
||||
|
||||
@@ -56,14 +56,15 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TimeOffsetInfo = {
|
||||
"TimeOffset",
|
||||
"Time Offset",
|
||||
"A time offset, in seconds, added to the simulation time (or Fixed Date if any), "
|
||||
"at which to compute the rotation.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `Rotation` type uses [SPICE](https://naif.jpl.nasa.gov/naif/) kernels to
|
||||
// provide rotation information for the attached scene graph node. SPICE is a library
|
||||
// used by scientists and engineers to, among other tasks, plan space missions. If you
|
||||
// are unfamiliar with SPICE, their webpage has both extensive
|
||||
// [Tutorials](https://naif.jpl.nasa.gov/naif/tutorials.html) as well as
|
||||
// [Lessions](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Lessons/) that explain
|
||||
// the system deeper. This class provides access to the
|
||||
// [pxform_c](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pxform_c.html)
|
||||
// function of the Spice library.
|
||||
struct [[codegen::Dictionary(SpiceRotation)]] Parameters {
|
||||
// [[codegen::verbatim(SourceInfo.description)]]
|
||||
std::string sourceFrame
|
||||
@@ -75,11 +76,7 @@ namespace {
|
||||
std::optional<std::string> destinationFrame;
|
||||
|
||||
// [[codegen::verbatim(FixedDateInfo.description)]]
|
||||
std::optional<std::string> fixedDate
|
||||
[[codegen::annotation("A time to lock the rotation to")]];
|
||||
|
||||
// [[codegen::verbatim(TimeOffsetInfo.description)]]
|
||||
std::optional<float> timeOffset;
|
||||
std::optional<std::string> fixedDate [[codegen::datetime()]];
|
||||
};
|
||||
#include "spicerotation_codegen.cpp"
|
||||
} // namespace
|
||||
|
||||
@@ -77,14 +77,15 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TimeOffsetInfo = {
|
||||
"TimeOffset",
|
||||
"Time Offset",
|
||||
"A time offset, in seconds, added to the simulation time (or Fixed Date if any), "
|
||||
"at which to compute the translation.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `Translation` type uses [SPICE](https://naif.jpl.nasa.gov/naif/) kernels to
|
||||
// provide translational information for the attached scene graph node. SPICE is a
|
||||
// library used by scientists and engineers to, among other tasks, plan space
|
||||
// missions. If you are unfamiliar with SPICE, their webpage has both extensive
|
||||
// [Tutorials](https://naif.jpl.nasa.gov/naif/tutorials.html) as well as
|
||||
// [Lessions](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Lessons/) that explain
|
||||
// the system deeper. This class provides access to the
|
||||
// [spkpos_c](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkpos_c.html)
|
||||
// function of the Spice library.
|
||||
struct [[codegen::Dictionary(SpiceTranslation)]] Parameters {
|
||||
// [[codegen::verbatim(TargetInfo.description)]]
|
||||
std::variant<std::string, int> target;
|
||||
|
||||
@@ -47,12 +47,14 @@ namespace {
|
||||
openspace::properties::Property::Visibility::NoviceUser
|
||||
};
|
||||
|
||||
// Similarly to the [RenderablePlaneProjection](spacecraftinstruments_renderableplaneprojection) and
|
||||
// [RenderablePlanetProjection](spacecraftinstruments_renderableplanetprojection), this Renderable type
|
||||
// servers as a potential target for image projections from a spacecraft's instrument.
|
||||
// This renderable will determine whenever an image in a currently loaded image
|
||||
// sequence is projected whether that instrument's field of view intersects this model
|
||||
// and will correctly project the captured image onto the model.
|
||||
// Similarly to the
|
||||
// [RenderablePlaneProjection](spacecraftinstruments_renderableplaneprojection) and
|
||||
// [RenderablePlanetProjection](spacecraftinstruments_renderableplanetprojection),
|
||||
// this Renderable type servers as a potential target for image projections from a
|
||||
// spacecraft's instrument. This renderable will determine whenever an image in a
|
||||
// currently loaded image sequence is projected whether that instrument's field of
|
||||
// view intersects this model and will correctly project the captured image onto the
|
||||
// model.
|
||||
struct [[codegen::Dictionary(RenderableModelProjection)]] Parameters {
|
||||
// The file or files that should be loaded, that specifies the model to load. The
|
||||
// file can contain filesystem tokens or can be specified relative to the
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
#include <openspace/util/sphere.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
// The RenderableSphereSpout can be used to render a sphere with a texture that is
|
||||
// provided by another application on the same computer using the SPOUT library. Note that
|
||||
// this library is only available on Windows.
|
||||
namespace {
|
||||
// The RenderableSphereSpout can be used to render a sphere with a texture that is
|
||||
// provided by another application on the same computer using the SPOUT library.
|
||||
// Note: The Spout library is only available on Windows
|
||||
struct [[codegen::Dictionary(RenderableSphereSpout)]] Parameters {
|
||||
// Specifies the GUI name of the RenderableSphereSpout
|
||||
std::optional<std::string> name;
|
||||
|
||||
Reference in New Issue
Block a user