NVIDIA IndeX API nvidia_logo_transpbg.gif Up
iregular_heightfield_patch.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright 2023 NVIDIA Corporation. All rights reserved.
3 *****************************************************************************/
6
7#ifndef NVIDIA_INDEX_IREGULAR_HEIGHTFIELD_PATCH_H
8#define NVIDIA_INDEX_IREGULAR_HEIGHTFIELD_PATCH_H
9
10#include <mi/dice.h>
11#include <mi/math/vector.h>
12
14
15namespace nv
16{
17namespace index
18{
19
25 public mi::base::Interface_declare<0xbf4f2ce,0xc58d,0x42d6,0x89,0x59,0xb7,0x82,0x35,0x70,0xe8,0x0d,
26 IDistributed_data_subset>
27{
28public:
39 virtual bool initialize(
40 const mi::math::Bbox_struct<mi::Sint32, 2>& patch_rectangle) = 0;
41
67 virtual bool initialize(
68 const mi::math::Bbox_struct<mi::Sint32, 2>& patch_rectangle,
69 const mi::Float32* elevation_values,
70 const mi::math::Vector_struct<mi::Float32, 3>* normal_values = 0) = 0;
71
79 virtual mi::Float32* generate_elevation_storage() = 0;
80
88 virtual mi::math::Vector_struct<mi::Float32, 3>* generate_normal_storage() = 0;
89
95 virtual const mi::Float32* get_elevation_values() const = 0;
96
102 virtual mi::Size get_nb_grid_points() const = 0;
103
110 virtual const mi::math::Vector_struct<mi::Float32, 3>* get_normal_values() const = 0;
111
116 virtual const mi::math::Bbox_struct<mi::Sint32, 3>& get_bounding_box() const = 0;
117
122 virtual const mi::math::Bbox_struct<mi::Sint32, 2>& get_bounding_rectangle() const = 0;
123
131 virtual const mi::math::Vector_struct<mi::Float32, 2>& get_height_range() const = 0;
132
141 static inline mi::Float32 get_hole_value()
142 {
143 return mi::base::numeric_traits<mi::Float32>::quiet_NaN();
144 }
145
152 static inline bool is_hole(mi::Float32 height)
153 {
154 // Use binary comparison so that it will work when holes are marked with NaN, as comparing
155 // anything to NaN will always be false. This is also potentially faster than isnan().
156 const mi::Uint32 height_bin = mi::base::binary_cast<mi::Uint32>(height);
157 const mi::Uint32 hole_bin = mi::base::binary_cast<mi::Uint32>(get_hole_value());
158
159 return height_bin == hole_bin;
160 }
161};
162
163} // namespace index
164} // namespace nv
165
166#endif // NVIDIA_INDEX_IREGULAR_HEIGHTFIELD_PATCH_H
Distributed data storage class for regular heightfield scene elements.
Definition: iregular_heightfield_patch.h:27
virtual mi::math::Vector_struct< mi::Float32, 3 > * generate_normal_storage()=0
Allocate the normal memory storage according to the bounding box.
static mi::Float32 get_hole_value()
Returns the height value that encodes a hole in the heightfield data.
Definition: iregular_heightfield_patch.h:141
virtual const mi::math::Bbox_struct< mi::Sint32, 3 > & get_bounding_box() const =0
The patch's extent in its local x, y, z.
virtual bool initialize(const mi::math::Bbox_struct< mi::Sint32, 2 > &patch_rectangle)=0
Initialize the patch data with the patch rectangle bounding box.
virtual mi::Float32 * generate_elevation_storage()=0
Allocate the elevation value data memory storage according to the bounding box.
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.
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.
virtual mi::Size get_nb_grid_points() const =0
Returns the number of grid points.
virtual const mi::math::Bbox_struct< mi::Sint32, 2 > & get_bounding_rectangle() const =0
The patch's extent in its local x, and y.
virtual const mi::math::Vector_struct< mi::Float32, 2 > & get_height_range() const =0
Returns the height extent of this heightfield patch.
static bool is_hole(mi::Float32 height)
Returns whether the given height value represent a hole in the heightfield.
Definition: iregular_heightfield_patch.h:152
virtual const mi::Float32 * get_elevation_values() const =0
Returns the continuous memory block that represents the elevation values of the heightfield's patch.
Distributed subset interaces for a large-scale distributed datasets.
Common namespace for all NVIDIA APIs.
Definition: iindex.h:349