Iray SDK API nvidia_logo_transpbg.gif Up
irender_context.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IRENDER_CONTEXT_H
8#define MI_NEURAYLIB_IRENDER_CONTEXT_H
9
11#include <mi/base/handle.h>
12#include <mi/neuraylib/idata.h>
15#include <mi/neuraylib/version.h> // for MI_NEURAYLIB_DEPRECATED_ENUM_VALUE
16
17namespace mi {
18
19namespace neuraylib {
20
21class IProgress_callback;
22class IReady_callback;
23class IRender_counters;
24class IRender_target_base;
25class ITransaction;
26
39class IRender_context : public
40 mi::base::Interface_declare<0xad5ccd43,0x75a1,0x427a,0x83,0x7d,0x95,0xc8,0x70,0x91,0xd4,0xc8>
41{
42public:
98 virtual Sint32 render(
99 ITransaction* transaction,
100 IRender_target_base* render_target_base,
101 IProgress_callback* progress_callback) = 0;
102
140 ITransaction* transaction,
141 IRender_target_base* render_target_base,
142 IReady_callback* ready_callback,
143 IProgress_callback* progress_callback) = 0;
144
158 {
163
168 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(CANCEL_FORCE_32_BIT, 0xffffffffU)
169 };
170
177
191 ITransaction* transaction,
192 const Float32_2_struct& point,
193 Uint32 max_pick_levels = 1) = 0;
194
219 ITransaction* transaction,
220 const Float32_2_struct& center,
221 const Float32_2_struct& size,
222 Uint32 max_pick_levels = 1) = 0;
223
229
255 virtual Sint32 set_option( const char* name, const IData* value) = 0;
256
264 virtual const IData* get_option( const char* name) const = 0;
265
280 template<class T>
281 const T* get_option( const char* name) const
282 {
283 const IData* ptr_idata = get_option( name);
284 if ( !ptr_idata)
285 return 0;
286 const T* ptr_T = static_cast<const T*>( ptr_idata->get_interface( typename T::IID()));
287 ptr_idata->release();
288 return ptr_T;
289 }
290
294 virtual Size get_options_length() const = 0;
295
303 virtual const char* get_option_name( Size index) const = 0;
304
312 virtual const char* get_option_type( Size index) const = 0;
313};
314
329 IRender_context& render_context,
330 ITransaction* trans,
331 const math::Bbox<Uint32,2>& rectangle,
332 const Float32_2& pixel_offset = Float32_2(.5f),
333 const bool recursive = false)
334{
335 const Float32_2 size = Float32_2(rectangle.extent() + Uint32_2(1));
336 const Float32_2 center = floor(Float32_2(rectangle.center())) + pixel_offset;
337 return base::make_handle(render_context.pick(trans, center, size, recursive));
338}
339
340 // end group mi_neuray_rendering
342
343} // namespace neuraylib
344
345} // namespace mi
346
347#endif // MI_NEURAYLIB_IRENDER_CONTEXT_H
This interface is the base interface of all types.
Definition: idata.h:297
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:112
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
Axis-aligned N-dimensional bounding box class template of fixed dimension.
Definition: bbox.h:74
Fixed-size math vector class template with generic operations.
Definition: vector.h:286
This interface represents the return value of a pick operation.
Definition: ipick_array.h:30
Abstract interface to report progress of a long-running operation back to the caller.
Definition: iprogress_callback.h:35
Abstract interface to report completion of an asynchronous operation back to the caller.
Definition: iready_callback.h:34
This interface is used for doing actual rendering and picking.
Definition: irender_context.h:41
virtual Sint32 render_async(ITransaction *transaction, IRender_target_base *render_target_base, IReady_callback *ready_callback, IProgress_callback *progress_callback)=0
Renders the associated scene with the associated render mode.
virtual Size get_options_length() const =0
Returns the number of render context options.
Cancel_mode
Different modes of canceling a rendering operation.
Definition: irender_context.h:158
@ CANCEL_AND_RESTART
Cancel the rendering as fast as possible, even at the cost of not being able to continue rendering fr...
Definition: irender_context.h:167
@ CANCEL_AND_CONTINUE
Cancel the rendering in such a way that it is possible to continue.
Definition: irender_context.h:162
virtual Sint32 render(ITransaction *transaction, IRender_target_base *render_target_base, IProgress_callback *progress_callback)=0
Renders the associated scene with the associated render mode.
virtual const IData * get_option(const char *name) const =0
Returns the value of a render context option.
virtual IPick_array * pick(ITransaction *transaction, const Float32_2_struct &point, Uint32 max_pick_levels=1)=0
Picks what is behind a point in the scene.
virtual const char * get_option_type(Size index) const =0
Returns the type of a render context option.
virtual Sint32 set_option(const char *name, const IData *value)=0
Sets the value of a render context option.
virtual void cancel_render(Cancel_mode mode=CANCEL_AND_CONTINUE)=0
Allows to cancel rendering currently done using this render context.
virtual IRender_counters * get_render_counters()=0
Returns the render counters for this render context.
const T * get_option(const char *name) const
Returns the value of a render context option.
Definition: irender_context.h:281
virtual IPick_array * pick(ITransaction *transaction, const Float32_2_struct &center, const Float32_2_struct &size, Uint32 max_pick_levels=1)=0
Picks what is behind a rectangle in the scene.
virtual const char * get_option_name(Size index) const =0
Returns the name of a render context option.
Performance counters for render modes.
Definition: irender_counters.h:34
Abstract interface for a render target (base class).
Definition: irender_target.h:153
A transaction provides a consistent view on the database.
Definition: itransaction.h:82
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
Handle<Interface> make_handle(Interface *iptr)
Returns a handle that holds the interface pointer passed in as argument.
Definition: handle.h:423
virtual Uint32 release() const =0
Decrements the reference count.
int Sint32
32-bit signed integer.
Definition: types.h:46
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Vector extent() const
Returns the size of the bounding box.
Definition: bbox.h:457
Vector center() const
Returns the center point of the bounding box.
Definition: bbox.h:454
Color floor(const Color &c)
Returns a color with the elementwise largest integral value that is not greater than the element in c...
Definition: color.h:591
math::Vector<Float32, 2> Float32_2
Vector of two Float32.
Definition: vector_typedefs.h:83
base::Handle<IPick_array> pick(IRender_context &render_context, ITransaction *trans, const math::Bbox<Uint32, 2> &rectangle, const Float32_2 &pixel_offset=Float32_2(.5f), const bool recursive=false)
Picks what is behind a rectangle in the scene.
Definition: irender_context.h:328
Smart-pointer handle class for interfaces, const and non-const version.
Types.
Mixin class template for deriving new interface declarations.
Result of a pick operation (array of hits).
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: neuraylib.h:179
Major and minor version number and an optional qualifier.
Generic storage class template for math vector representations storing DIM elements of type T.
Definition: vector.h:135
Typedefs for types from the math API.