Iray SDK API nvidia_logo_transpbg.gif Up
irender_context.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 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
16namespace mi {
17
18namespace neuraylib {
19
20class IProgress_callback;
21class IReady_callback;
22class IRender_counters;
23class IRender_target_base;
24class ITransaction;
25
38class IRender_context : public
39 mi::base::Interface_declare<0xad5ccd43,0x75a1,0x427a,0x83,0x7d,0x95,0xc8,0x70,0x91,0xd4,0xc8>
40{
41public:
97 virtual Sint32 render(
98 ITransaction* transaction,
99 IRender_target_base* render_target_base,
100 IProgress_callback* progress_callback) = 0;
101
139 ITransaction* transaction,
140 IRender_target_base* render_target_base,
141 IReady_callback* ready_callback,
142 IProgress_callback* progress_callback) = 0;
143
157 {
162
167
168 // Undocumented, for alignment only
169 CANCEL_FORCE_32_BIT = 0xffffffffU
170 };
171
178
192 ITransaction* transaction,
193 const Float32_2_struct& point,
194 Uint32 max_pick_levels = 1) = 0;
195
220 ITransaction* transaction,
221 const Float32_2_struct& center,
222 const Float32_2_struct& size,
223 Uint32 max_pick_levels = 1) = 0;
224
230
256 virtual Sint32 set_option( const char* name, const IData* value) = 0;
257
265 virtual const IData* get_option( const char* name) const = 0;
266
281 template<class T>
282 const T* get_option( const char* name) const
283 {
284 const IData* ptr_idata = get_option( name);
285 if ( !ptr_idata)
286 return 0;
287 const T* ptr_T = static_cast<const T*>( ptr_idata->get_interface( typename T::IID()));
288 ptr_idata->release();
289 return ptr_T;
290 }
291
295 virtual Size get_options_length() const = 0;
296
304 virtual const char* get_option_name( Size index) const = 0;
305
313 virtual const char* get_option_type( Size index) const = 0;
314};
315
317
318
333 IRender_context& render_context,
334 ITransaction* trans,
335 const math::Bbox<Uint32,2>& rectangle,
336 const Float32_2& pixel_offset = Float32_2(.5f),
337 const bool recursive = false)
338{
339 const Float32_2 size = Float32_2(rectangle.extent() + Uint32_2(1));
340 const Float32_2 center = floor(Float32_2(rectangle.center())) + pixel_offset;
341 return base::make_handle(render_context.pick(trans, center, size, recursive));
342}
343
344 // end group mi_neuray_rendering
346
347} // namespace neuraylib
348
349} // namespace mi
350
351#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:113
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:40
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.
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.
Cancel_mode
Different modes of canceling a rendering operation.
Definition: irender_context.h:157
@ 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:166
@ CANCEL_AND_CONTINUE
Cancel the rendering in such a way that it is possible to continue.
Definition: irender_context.h:161
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:282
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:152
A transaction provides a consistent view on the database.
Definition: itransaction.h:81
#define mi_static_assert(expr)
Compile time assertion that raises a compilation error if the constant expression expr evaluates to f...
Definition: assert.h:65
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:428
virtual Uint32 release() const =0
Decrements the reference count.
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Vector extent() const
Returns the size of the bounding box.
Definition: bbox.h:459
Vector center() const
Returns the center point of the bounding box.
Definition: bbox.h:456
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:606
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:332
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
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.