utils
get_rgb_selected_worlds_and_cameras(rc, worldids, camids, rgb_out)
¶
Get the RGB data output from the render context buffers for a given camera index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rc
|
RenderContext
|
The render context on device. |
required |
worldids
|
array(dtype=int)
|
TODO |
required |
camids
|
array(dtype=int)
|
TODO |
required |
rgb_out
|
array4d(dtype=vec3)
|
The output array to store the RGB data in, with shape (len(worldids), len(camids), height, width). |
required |
Source code in src/flygym/warp/utils.py
unpack_rgb_kernel_selected_worlds_and_cameras(packed, rgb_adr, worldids_to_render, camids_to_render, rgb_out)
¶
Unpack ABGR uint32 packed pixel data into separate R, G, and B channels.
Source code in src/flygym/warp/utils.py
wp_gather_indexed_cols_2d(src, dst, cols)
¶
Gather specific columns from a 2D Warp array into a narrower destination array.
This kernel is to be launched with a 2D launch configuration of
(n_rows, n_cols_narrow), where n_cols_narrow is the number of columns to gather.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
wp.array of shape (n_rows, n_cols_wide), type float32
|
Source array. |
required |
dst
|
wp.array of shape (n_rows, n_cols_narrow), type float32
|
Destination array, where n_cols_narrow <= n_cols_wide. |
required |
cols
|
wp.array of shape (n_cols_narrow,), type int32
|
Array of column indices of |
required |
Source code in src/flygym/warp/utils.py
wp_gather_indexed_rows_3d(src, dst, rows)
¶
Gather specific rows (dim 1) from a 3D Warp array into a narrower destination.
This kernel is to be launched with a 3D launch configuration of
(n_worlds, n_rows_narrow, n_cols).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
wp.array of shape (n_worlds, n_rows_wide, n_cols), type float32
|
Source array. |
required |
dst
|
wp.array of shape (n_worlds, n_rows_narrow, n_cols), type float32
|
Destination array, where n_rows_narrow <= n_rows_wide. |
required |
rows
|
wp.array of shape (n_rows_narrow,), type int32
|
Array of row indices (dim 1) of |
required |
Source code in src/flygym/warp/utils.py
wp_gather_indexed_rows_quatf(src, dst, rows)
¶
Gather specific rows from a 2D quatf array into a (n_worlds, n_rows_narrow, 4)
float32 destination.
This kernel is to be launched with a 2D launch configuration of
(n_worlds, n_rows_narrow).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
wp.array of shape (n_worlds, n_rows_wide), type quatf
|
Source array, e.g. |
required |
dst
|
wp.array of shape (n_worlds, n_rows_narrow, 4), type float32
|
Destination array. |
required |
rows
|
wp.array of shape (n_rows_narrow,), type int32
|
Body indices to gather. |
required |
Source code in src/flygym/warp/utils.py
wp_gather_indexed_rows_vec3f(src, dst, rows)
¶
Gather specific rows from a 2D vec3f array into a (n_worlds, n_rows_narrow, 3)
float32 destination.
This kernel is to be launched with a 2D launch configuration of
(n_worlds, n_rows_narrow).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
wp.array of shape (n_worlds, n_rows_wide), type vec3f
|
Source array, e.g. |
required |
dst
|
wp.array of shape (n_worlds, n_rows_narrow, 3), type float32
|
Destination array. |
required |
rows
|
wp.array of shape (n_rows_narrow,), type int32
|
Body indices to gather. |
required |
Source code in src/flygym/warp/utils.py
wp_scatter_indexed_cols_2d(src, dst, cols)
¶
Scatter a 2D Warp array into specific columns of a wider destination array.
This kernel is to be launched with a 2D launch configuration of
(n_rows, n_cols_narrow), where n_cols_narrow is the number of columns to copy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
wp.array of shape (n_rows, n_cols_narrow), type float32
|
Source array. |
required |
dst
|
wp.array of shape (n_rows, n_cols_wide), type float32
|
Destination array, where n_cols_wide >= n_cols_narrow. |
required |
cols
|
wp.array of shape (n_cols_narrow,), type int32
|
Array of column indices of |
required |