Skip to content

Commit 29ca91b

Browse files
authored
add 2d camera mode controls for rendering and project_2d (#1484)
* add 2d camera mode for rendering and project_2d * update info with 2d cam * changelog
1 parent 22f1362 commit 29ca91b

9 files changed

+263
-61
lines changed

CHANGELOG.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Notable changes to Ascent are documented in this file. This changelog started on
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project aspires to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## Unreleased
7+
## Unreleased
88
### Preferred dependency versions for ascent@develop
99
10-
- [email protected] (requires [patch 1](https://github.com/Alpine-DAV/ascent/blob/0aef6cffd522be7419651e6adf586f9a553297d0/scripts/build_ascent/2024_05_03_vtkm-mr3215-ext-geom-fix.patch)
10+
- [email protected] (requires [patch 1](https://github.com/Alpine-DAV/ascent/blob/0aef6cffd522be7419651e6adf586f9a553297d0/scripts/build_ascent/2024_05_03_vtkm-mr3215-ext-geom-fix.patch)
1111
[patch 2](https://github.com/Alpine-DAV/ascent/blob/develop/scripts/build_ascent/2024_07_02_vtkm-mr3246-raysubset_bugfix.patch) )
1212
1313
@@ -31,11 +31,12 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
3131
- Added `fields` option to the project 2d to support scalar rendering of specific fields.
3232
- Added `dataset_bounds` option to the project 2d, which can be used instead of a full 3D camera specification
3333
- Added support for triggers to execute actions from multiple files via an `actions_files` option that takes a list of actions files.
34-
- Added an `external_surfaces` transform filter, that can be used to reduce memory requirements in pipelines where you plan to only process the external faces of a data set.
34+
- Added an `external_surfaces` transform filter, that can be used to reduce memory requirements in pipelines where you plan to only process the external faces of a data set.
3535
- Added a `declare_fields` action, that allows users to explicitly list the fields to return for field filtering. This option avoids complex field parsing logic.
36+
- Added a 2d camera mode (`camera/2d: [left, right, bottom, top]`) to scene render cameras and the `project_2d` (scalar rendering) filter cameras.
3637

3738
### Changed
38-
- Changed the replay utility's binary names such that `replay_ser` is now `ascent_replay` and `raplay_mpi` is now `ascent_replay_mpi`. This will help prevent potential name collisions with other tools that also have replay utilities.
39+
- Changed the replay utility's binary names such that `replay_ser` is now `ascent_replay` and `raplay_mpi` is now `ascent_replay_mpi`. This will help prevent potential name collisions with other tools that also have replay utilities.
3940

4041
### Fixed
4142
- Resolved a few cases where MPI_COMM_WORLD was used instead instead of the selected MPI communicator.
@@ -75,7 +76,7 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
7576
### Changed
7677
- Changed the Data Binning filter to accept a `reduction_field` parameter (instead of `var`), and similarly the axis parameters to take `field` (instead of `var`). The `var` style parameters are still accepted, but deprecated and will be removed in a future release.
7778
- Changed the Streamline and WarpXStreamline filters to apply the VTK-m Tube filter to their outputs, allowing for the results to be rendered.
78-
- Updated CMake Python build infrastructure to use
79+
- Updated CMake Python build infrastructure to use
7980

8081
### Fixed
8182
- Various small bug fixes
@@ -128,12 +129,12 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
128129
- Added extract `flatten` from Conduit Blueprint
129130
- Added Log base 10 filter. Filter type is `log10`
130131
- Added Log base 2 filter. Filter type is `log2`
131-
- Added Feature Map in the docs. Detailing Devil Ray and VTKh features
132+
- Added Feature Map in the docs. Detailing Devil Ray and VTKh features
132133
- Added `scripts/build_ascent/build_ascent.sh` a script that demonstrates how to manually build Ascent and its main dependencies
133134
- Added ability to override dimensions for the rendered bounding box around a dataset
134135
- Added CMake option `ENABLE_HIDDEN_VISIBILITY` (default=ON), which controls if hidden visibility is used for private symbols
135136
- Added documentation for how to use ROCm's rocprof profiler for GPUs with Ascent
136-
- Added support for Caliper performance annotations
137+
- Added support for Caliper performance annotations
137138
- Added automatic slice filter that evaluates a number of slices and outputs the one with the highest entropy
138139

139140
### Changed
@@ -157,15 +158,15 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
157158
- Added OCCA Derived Field Generation support
158159
- Added more math expressions
159160
- Added a time expression
160-
- Added Cinema rendering support for Devil Ray
161-
- Added `streamline` and `particle_advection` transforms
161+
- Added Cinema rendering support for Devil Ray
162+
- Added `streamline` and `particle_advection` transforms
162163
- Added history gradient expressions
163164
- Added the ability save named sessions
164165
- Added new options to specify Cinema rendering parameters
165166
- Added the ability save subsets of expression results to session files
166167
- Added the ability to add comments to PNG files that Ascent creates
167168
- Added timings out control option to Ascent (and Flow)
168-
- Added support to render Polygonal nd Polyhedral Meshes
169+
- Added support to render Polygonal nd Polyhedral Meshes
169170
- Added option to turn of world annotations
170171
- Added FIDES Support
171172

src/libs/ascent/runtimes/flow_filters/ascent_runtime_conduit_to_vtkm_parsing.cpp

+21-2
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,33 @@ parse_image_dims(const conduit::Node &node, int &width, int &height)
8787

8888
}
8989

90+
9091
//-----------------------------------------------------------------------------
9192
void
9293
parse_camera(const conduit::Node camera_node, vtkm::rendering::Camera &camera)
9394
{
9495
typedef vtkm::Vec<vtkm::Float32,3> vtkmVec3f;
96+
9597
//
9698
// Get the optional camera parameters
9799
//
100+
101+
// check for 2d mode first
102+
if(camera_node.has_child("2d"))
103+
{
104+
// camera:
105+
// 2d: [l,r,b,t]
106+
camera.SetModeTo2D();
107+
conduit::Node n;
108+
camera_node["2d"].to_float64_array(n);
109+
const float64 *view_vals = n.as_float64_ptr();
110+
111+
camera.SetViewRange2D(view_vals[0],
112+
view_vals[1],
113+
view_vals[2],
114+
view_vals[3]);
115+
}
116+
98117
if(camera_node.has_child("look_at"))
99118
{
100119
conduit::Node n;
@@ -248,8 +267,8 @@ parse_color_table(const conduit::Node &color_table_node)
248267
}
249268
else if (control_points_node.dtype().is_object())
250269
{
251-
if (control_points_node.has_child("r") &&
252-
control_points_node.has_child("g") &&
270+
if (control_points_node.has_child("r") &&
271+
control_points_node.has_child("g") &&
253272
control_points_node.has_child("b"))
254273
{
255274
clear = true;

0 commit comments

Comments
 (0)