neuray API Programmer's Manual

mi::neuraylib::IOn_demand_mesh Class Reference

[Leaf nodes]

Description

Interface representing an on-demand mesh. On-demand meshes are scene elements representing geometry. Basically they also describe triangle meshes (see mi::neuraylib::ITriangle_mesh), just in a much simpler format. In contrast to all other scene elements representing geometry, on-demand meshes do not store the geometry.

Instead, on-demand meshes use a user-specified callback to provide the geometry when needed. The geometry data might already exist in the application in a format that can be used directly (see mi::neuraylib::ISimple_mesh). In this case a simple adaptor exposing that data in the expected format is sufficient, and another copy of the geometry can be avoided.

Even if the geometry data does not yet exist in the application in a format that can be used directly there is no need to hold permanently a copy of that data in the desired format. Often this data is only needed temporarily while it is converted into another format or for upload to the GPU. In this case the memory used by a temporary instance of mi::neuraylib::ISimple_mesh holding a copy of the geometry data can be reclaimed after the conversion process.

Note:

Displacement is currently not supported for on-demand meshes.

See also:

mi::neuraylib::IOn_demand_mesh_callback, mi::neuraylib::ISimple_mesh

Public Member Functions

virtual const IOn_demand_mesh_callbackget_callback() const =0
Returns the stored callback.
virtual void set_callback( IOn_demand_mesh_callback* callback) =0
Sets the callback that returns the actual mesh. More...

Methods related to the bounding box

virtual Bbox3_struct get_bbox() const =0
Returns the bounding box of the on-demand mesh. More...
virtual Bbox3_struct get_tight_bbox( const Float64_4_4_struct& transformation_matrix) const =0
Returns the bounding box of the on-demand mesh after transformation. More...
virtual void set_bbox( const Bbox3_struct& bbox) =0
Sets the bounding box of the on-demand mesh.

Methods related to displacement

virtual Float32 get_maximum_displacement() const =0
Returns the maximum displacement of the on-demand mesh. More...
virtual void set_maximum_displacement( Float32 displacement) =0
Sets the maximum displacement of the on-demand mesh. More...

Member Functions

virtual Bbox3_struct mi::​neuraylib::​IOn_demand_mesh::get_bbox() const [pure virtual]

Returns the bounding box of the on-demand mesh. In contrast to get_tight_bbox(), this method does not invoke the callback to compute the bounding box, but just returns the bounding box that was stored with set_bbox().

virtual const IOn_demand_mesh_callback* mi::​neuraylib::​IOn_demand_mesh::get_callback() const [pure virtual]

Returns the stored callback.

virtual Float32 mi::​neuraylib::​IOn_demand_mesh::get_maximum_displacement() const [pure virtual]

Returns the maximum displacement of the on-demand mesh.

See also:

set_maximum_displacement()

virtual Bbox3_struct mi::​neuraylib::​IOn_demand_mesh::get_tight_bbox( const Float64_4_4_struct& transformation_matrix) const [pure virtual]

Returns the bounding box of the on-demand mesh after transformation. In contrast to get_bbox(), this method does invoke the callback to compute the bounding box on the fly.

Parameters

transformation_matrix
The world-to-object space transformation matrix that is applied to the object before the bounding box is computed.
virtual void mi::​neuraylib::​IOn_demand_mesh::set_bbox( const Bbox3_struct& bbox) [pure virtual]

Sets the bounding box of the on-demand mesh.

virtual void mi::​neuraylib::​IOn_demand_mesh::set_callback( IOn_demand_mesh_callback* callback) [pure virtual]

Sets the callback that returns the actual mesh. Is is feasible to pass NULL as callback. An on-demand mesh without callback is treated like an empty mesh.

virtual void mi::​neuraylib::​IOn_demand_mesh::set_maximum_displacement( Float32 displacement) [pure virtual]

Sets the maximum displacement of the on-demand mesh. This value is the maximum absolute value of any displacement applied to the object (defaults to 0.0). The bounding box of the object will be expanded all around by this value.