Distributed data storage class for regular heightfield scene elements.
More...
#include <iregular_heightfield_patch.h>
Inherits mi::base::Interface_declare< 0xbf4f2ce, ... >.
|
virtual bool | initialize (const mi::math::Bbox_struct< mi::Sint32, 2 > &patch_rectangle)=0 |
| Initialize the patch data with the patch rectangle bounding box. More...
|
|
virtual bool | initialize (const mi::math::Bbox_struct< mi::Sint32, 2 > &patch_rectangle, const mi::Float32 *elevation_values, const mi::math::Vector_struct< mi::Float32, 3 > *normal_values=0)=0 |
| Initialize the patch data storage with the patch data. More...
|
|
virtual mi::Float32 * | generate_elevation_storage ()=0 |
| Allocate the elevation value data memory storage according to the bounding box. More...
|
|
virtual mi::math::Vector_struct< mi::Float32, 3 > * | generate_normal_storage ()=0 |
| Allocate the normal memory storage according to the bounding box. More...
|
|
virtual const mi::Float32 * | get_elevation_values () const =0 |
| Returns the continuous memory block that represents the elevation values of the heightfield's patch. More...
|
|
virtual mi::Size | get_nb_grid_points () const =0 |
| Returns the number of grid points. More...
|
|
virtual const mi::math::Vector_struct< mi::Float32, 3 > * | get_normal_values () const =0 |
| Returns the normal array associated with the elevation values in this heightfield patch. More...
|
|
virtual const mi::math::Bbox_struct< mi::Sint32, 3 > & | get_bounding_box () const =0 |
| The patch's extent in its local x, y, z. More...
|
|
virtual const mi::math::Bbox_struct< mi::Sint32, 2 > & | get_bounding_rectangle () const =0 |
| The patch's extent in its local x, and y. More...
|
|
virtual const mi::math::Vector_struct< mi::Float32, 2 > & | get_height_range () const =0 |
| Returns the height extent of this heightfield patch. More...
|
|
|
static mi::Float32 | get_hole_value () |
| Returns the height value that encodes a hole in the heightfield data. More...
|
|
static bool | is_hole (mi::Float32 height) |
| Returns whether the given height value represent a hole in the heightfield. More...
|
|
Distributed data storage class for regular heightfield scene elements.
◆ generate_elevation_storage()
virtual mi::Float32 * nv::index::IRegular_heightfield_patch::generate_elevation_storage |
( |
| ) |
|
|
pure virtual |
Allocate the elevation value data memory storage according to the bounding box.
Prerequisite: call initialize(patch_rectangle)
.
- Returns
- Allocated elevation memory storage pointer, 0 on failure.
◆ generate_normal_storage()
virtual mi::math::Vector_struct< mi::Float32, 3 > * nv::index::IRegular_heightfield_patch::generate_normal_storage |
( |
| ) |
|
|
pure virtual |
Allocate the normal memory storage according to the bounding box.
Prerequisite: call initialize(patch_rectangle)
.
- Returns
- Allocated normal memory storage pointer, 0 on failure.
◆ get_bounding_box()
virtual const mi::math::Bbox_struct< mi::Sint32, 3 > & nv::index::IRegular_heightfield_patch::get_bounding_box |
( |
| ) |
const |
|
pure virtual |
The patch's extent in its local x, y, z.
- Returns
- Bounding box of the patch.
◆ get_bounding_rectangle()
virtual const mi::math::Bbox_struct< mi::Sint32, 2 > & nv::index::IRegular_heightfield_patch::get_bounding_rectangle |
( |
| ) |
const |
|
pure virtual |
The patch's extent in its local x, and y.
- Returns
- Bounding box of the patch.
◆ get_elevation_values()
virtual const mi::Float32 * nv::index::IRegular_heightfield_patch::get_elevation_values |
( |
| ) |
const |
|
pure virtual |
Returns the continuous memory block that represents the elevation values of the heightfield's patch.
- Returns
- Two-dimensional array of elevation values.
◆ get_height_range()
virtual const mi::math::Vector_struct< mi::Float32, 2 > & nv::index::IRegular_heightfield_patch::get_height_range |
( |
| ) |
const |
|
pure virtual |
Returns the height extent of this heightfield patch.
This contains the minimum and the maximum elevation values. Note: the elevation range is not the global, but only local for this patch.
- Returns
- Minimum and maximum elevation value (K-value) in this heightfield patch.
◆ get_hole_value()
static mi::Float32 nv::index::IRegular_heightfield_patch::get_hole_value |
( |
| ) |
|
|
inlinestatic |
Returns the height value that encodes a hole in the heightfield data.
- Note
- Always use
is_hole()
to check for holes, do not compare height values with the return value of this function. Such a comparison would always fail if NaN is used, as comparing anything to NaN will always return false.
- Returns
- Height value that represents holes.
◆ get_nb_grid_points()
virtual mi::Size nv::index::IRegular_heightfield_patch::get_nb_grid_points |
( |
| ) |
const |
|
pure virtual |
Returns the number of grid points.
This is the same as the number of elements in the the elevation value array size and the normal value array.
- Returns
- Size of the elevation value array.
◆ get_normal_values()
virtual const mi::math::Vector_struct< mi::Float32, 3 > * nv::index::IRegular_heightfield_patch::get_normal_values |
( |
| ) |
const |
|
pure virtual |
Returns the normal array associated with the elevation values in this heightfield patch.
Use the information from get_nb_grid_points()
to get the number of elements in this array.
- Returns
- Two-dimensional array of normal vectors.
◆ initialize() [1/2]
virtual bool nv::index::IRegular_heightfield_patch::initialize |
( |
const mi::math::Bbox_struct< mi::Sint32, 2 > & |
patch_rectangle | ) |
|
|
pure virtual |
Initialize the patch data with the patch rectangle bounding box.
This doesn't allocate any data storage, therefore, the call of a generate_*_storage
() method is needed for storage allocation. This method must be called only once and called before the generate_*_storage
().
- Parameters
-
[in] | patch_rectangle | The patch's rectangle bounding box |
- Returns
- true when initialization was successful
◆ initialize() [2/2]
virtual bool nv::index::IRegular_heightfield_patch::initialize |
( |
const mi::math::Bbox_struct< mi::Sint32, 2 > & |
patch_rectangle, |
|
|
const mi::Float32 * |
elevation_values, |
|
|
const mi::math::Vector_struct< mi::Float32, 3 > * |
normal_values = 0 |
|
) |
| |
|
pure virtual |
Initialize the patch data storage with the patch data.
This allocates the heightfield patch memory and initialize the height and normal value at once. The memory layout represents a 2D grid structure and is aligned in x-first and y-last order, were x refers to the patch's width in its local coordinate system and y to the patch's length.
The method can be called only once to initialize the memory.
- Deprecated:
- Shall only be used to be compatible with existing applications. To initialize the patch data, use the
generate_*_storage
() methods to get the data storage. Then, directly initialize the storage. In this way, the application can skip to operate on an application-side memory buffer, which can possibly improve the performance.
- Parameters
-
patch_rectangle | The patch's rectangle bounding box |
elevation_values | An array for elevation values. Not initialized when 0. The array size must match with the patch_rectangle size suggesting. |
normal_values | An array for normal values. Not initialized when 0. The array size must match with the patch_rectangle size suggesting. |
- Returns
- true when initialization succeeded
◆ is_hole()
static bool nv::index::IRegular_heightfield_patch::is_hole |
( |
mi::Float32 |
height | ) |
|
|
inlinestatic |
Returns whether the given height value represent a hole in the heightfield.
- Parameters
-
[in] | height | Heightfield height value. |
- Returns
- True if the given height value represents a hole.
The documentation for this class was generated from the following file: