mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Cleanup and add some more examples (#3506)
* Remove duplicated node line example * Update `ScreenSpaceBrowser` example to new format * Add screenspace image examples * Add docs and examples for `RenderableGrid` * Add docs and examples for `RenderableRadialGrid` + create 10 grid segments per default * Add docs and examples for `RenderableSphericalGrid` * Remove the old, combined, grid example * Apply suggestions from code review Co-authored-by: Alexander Bock <alexander.bock@liu.se> --------- Co-authored-by: Alexander Bock <alexander.bock@liu.se>
This commit is contained in:
@@ -94,6 +94,12 @@ namespace {
|
||||
"The labels for the grid."
|
||||
};
|
||||
|
||||
// This `Renderable` can be used to create a planar grid, to for example illustrate
|
||||
// distances in 3D space.
|
||||
//
|
||||
// The grid is created by specifying a size and how many segments to split each
|
||||
// dimension into. A secondary color can be used to highlight grid lines with a
|
||||
// given interval.
|
||||
struct [[codegen::Dictionary(RenderableGrid)]] Parameters {
|
||||
// [[codegen::verbatim(ColorInfo.description)]]
|
||||
std::optional<glm::vec3> color [[codegen::color()]];
|
||||
|
||||
@@ -81,6 +81,12 @@ namespace {
|
||||
"The labels for the grid."
|
||||
};
|
||||
|
||||
// This `Renderable` creates a planar circular grid with a given size. Optionally, it
|
||||
// may have a hole in the center.
|
||||
//
|
||||
// The size is determined by two radii values: The first (inner) radius defines the
|
||||
// hole in the center. The second (outer) radius defines the full grid size. To create
|
||||
// a solid circle that connects at the center, set the inner radius to zero (default).
|
||||
struct [[codegen::Dictionary(RenderableRadialGrid)]] Parameters {
|
||||
// [[codegen::verbatim(ColorInfo.description)]]
|
||||
std::optional<glm::vec3> color [[codegen::color()]];
|
||||
@@ -113,7 +119,7 @@ documentation::Documentation RenderableRadialGrid::Documentation() {
|
||||
RenderableRadialGrid::RenderableRadialGrid(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _gridSegments(GridSegmentsInfo, glm::ivec2(1), glm::ivec2(1), glm::ivec2(200))
|
||||
, _gridSegments(GridSegmentsInfo, glm::ivec2(10), glm::ivec2(1), glm::ivec2(200))
|
||||
, _circleSegments(CircleSegmentsInfo, 36, 4, 200)
|
||||
, _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f)
|
||||
, _radii(RadiiInfo, glm::vec2(0.f, 1.f), glm::vec2(0.f), glm::vec2(20.f))
|
||||
|
||||
@@ -65,18 +65,6 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SegmentsInfo = {
|
||||
"Segments",
|
||||
"Number of Segments",
|
||||
"The number of segments the sphere is split into. Determines the resolution "
|
||||
"of the rendered sphere. Should be an even value (if an odd value is provided, "
|
||||
"the value will be set to the new value minus one). Setting this value is equal "
|
||||
"to setting `LongSegments` and `LatSegments` to the same value. If this value is "
|
||||
"specified, it will overwrite the values provided in `LongSegments` and "
|
||||
"`LatSegments`.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo LineWidthInfo = {
|
||||
"LineWidth",
|
||||
"Line Width",
|
||||
@@ -90,6 +78,13 @@ namespace {
|
||||
"The labels for the grid."
|
||||
};
|
||||
|
||||
// This `Renderable` creates a grid in the shape of a sphere. Note that the sphere
|
||||
// will always be given a radius of one meter. To change its size, use a `Scale`
|
||||
// transform, such as the [StaticScale](#base_scale_static).
|
||||
//
|
||||
// The grid may be split up into equal segments in both directions using the `Segments`
|
||||
// parameter, or different number of segments in the latitudal and longtudal direction
|
||||
// using the `LatSegments` and `LongSegments` parameters.
|
||||
struct [[codegen::Dictionary(RenderableSphericalGrid)]] Parameters {
|
||||
// [[codegen::verbatim(ColorInfo.description)]]
|
||||
std::optional<glm::vec3> color [[codegen::color()]];
|
||||
@@ -100,7 +95,12 @@ namespace {
|
||||
// [[codegen::verbatim(LatSegmentsInfo.description)]]
|
||||
std::optional<int> latSegments;
|
||||
|
||||
// [[codegen::verbatim(SegmentsInfo.description)]]
|
||||
// The number of segments the sphere is split into. Determines the resolution
|
||||
// of the rendered sphere. Should be an even value (if an odd value is provided,
|
||||
// the value will be set to the new value minus one). Setting this value is equal
|
||||
// to setting `LongSegments` and `LatSegments` to the same value. If this value is
|
||||
// specified, it will overwrite the values provided in `LongSegments` and
|
||||
//`LatSegments`.
|
||||
std::optional<int> segments;
|
||||
|
||||
// [[codegen::verbatim(LineWidthInfo.description)]]
|
||||
|
||||
Reference in New Issue
Block a user