mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 12:10:52 -06:00
Harmonizing OrientationRenderOption and Billboard settings. Make RenderablePlanes use the new setting (#3630)
This commit is contained in:
@@ -383,8 +383,21 @@ namespace {
|
||||
PositionNormal [[codegen::key("Camera Position Normal")]],
|
||||
FixedRotation [[codegen::key("Fixed Rotation")]]
|
||||
};
|
||||
// [[codegen::verbatim(OrientationRenderOptionInfo.description)]]
|
||||
std::optional<RenderOption> orientationRenderOption;
|
||||
|
||||
// Controls whether the planes for the points will be billboarded, that is
|
||||
// oriented to face the camera. Setting this value to `true` is the same as
|
||||
// setting it to \"Camera View Direction\", setting it to `false` is the same as
|
||||
// setting it to \"Fixed Rotation\". If the value is not specified, the default
|
||||
// value of `true` is used instead.
|
||||
//
|
||||
// \"Camera View Direction\" rotates the points so that the plane is orthogonal to
|
||||
// the viewing direction of the camera (useful for planar displays), and \"Camera
|
||||
// Position Normal\" rotates the points towards the position of the camera (useful
|
||||
// for spherical displays, like dome theaters). In both these cases the points
|
||||
// will be billboarded towards the camera. In contrast, \"Fixed Rotation\" does
|
||||
// not rotate the points at all based on the camera and should be used when the
|
||||
// dataset contains orientation information for the points.
|
||||
std::optional<std::variant<bool, RenderOption>> billboard;
|
||||
|
||||
// [[codegen::verbatim(UseOrientationDataInfo.description)]]
|
||||
std::optional<bool> useOrientationData;
|
||||
@@ -663,8 +676,23 @@ RenderablePointCloud::RenderablePointCloud(const ghoul::Dictionary& dictionary)
|
||||
_renderOption.addOption(RenderOption::PositionNormal, "Camera Position Normal");
|
||||
_renderOption.addOption(RenderOption::FixedRotation, "Fixed Rotation");
|
||||
|
||||
if (p.orientationRenderOption.has_value()) {
|
||||
_renderOption = codegen::map<RenderOption>(*p.orientationRenderOption);
|
||||
if (p.billboard.has_value()) {
|
||||
ghoul_assert(
|
||||
std::holds_alternative<bool>(*p.billboard) ||
|
||||
std::holds_alternative<Parameters::RenderOption>(*p.billboard),
|
||||
"Wrong type"
|
||||
);
|
||||
|
||||
if (std::holds_alternative<bool>(*p.billboard)) {
|
||||
_renderOption = std::get<bool>(*p.billboard) ?
|
||||
RenderOption::ViewDirection :
|
||||
RenderOption::FixedRotation;
|
||||
}
|
||||
else {
|
||||
_renderOption = codegen::map<RenderOption>(
|
||||
std::get<Parameters::RenderOption>(*p.billboard)
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_renderOption = RenderOption::ViewDirection;
|
||||
@@ -1207,6 +1235,7 @@ void RenderablePointCloud::renderPoints(const RenderData& data,
|
||||
_program->setUniform(_uniformCache.fadeInValue, fadeInVariable);
|
||||
|
||||
_program->setUniform(_uniformCache.renderOption, _renderOption.value());
|
||||
|
||||
_program->setUniform(_uniformCache.opacity, opacity());
|
||||
|
||||
_program->setUniform(_uniformCache.scaleExponent, _sizeSettings.scaleExponent);
|
||||
|
||||
Reference in New Issue
Block a user