MDL SDK API nvidia_logo_transpbg.gif Up
imdl_distiller_api.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IMDL_DISTILLER_H
8#define MI_NEURAYLIB_IMDL_DISTILLER_H
9
11
12namespace mi {
13
14class IData;
15class IMap;
16
17namespace neuraylib {
18
19class IBaker;
20class ICanvas;
21class ICompiled_material;
22
31
38 // Undocumented, for alignment only.
39 BAKER_RESOURCE_FORCE_32_BIT = 0xffffffffU
40};
41
42mi_static_assert( sizeof( Baker_resource) == sizeof( Uint32));
43
45class IMdl_distiller_api : public
46 mi::base::Interface_declare<0x074709ef,0x11b0,0x4196,0x82,0x1c,0xab,0x64,0x1a,0xa2,0x50,0xdb>
47{
48public:
50 virtual Size get_target_count() const = 0;
51
54 virtual const char* get_target_name( Size index) const = 0;
55
174 const ICompiled_material* material,
175 const char* target,
176 const IMap* distiller_options = nullptr,
177 Sint32* errors = nullptr) const = 0;
178
198 virtual const IBaker* create_baker(
199 const ICompiled_material* material,
200 const char* path,
201 Baker_resource resource = BAKE_ON_CPU,
202 Uint32 gpu_device_id = 0) const = 0;
203
215 virtual Size get_required_module_count( const char* target) const = 0;
216
225 virtual const char* get_required_module_name( const char* target, Size index) const = 0;
226
236 virtual const char* get_required_module_code( const char* target, Size index) const = 0;
237};
238
275class IBaker : public
276 mi::base::Interface_declare<0x4dba1b1d,0x8fce,0x43d9,0x80,0xa7,0xa2,0x24,0xf3,0x1e,0xdc,0xe7>
277{
278public:
285 virtual const char* get_pixel_type() const = 0;
286
295 virtual bool is_uniform() const = 0;
296
309 virtual Sint32 bake_texture( ICanvas* texture, Uint32 samples = 1) const = 0;
310
329 ICanvas* texture,
330 Float32 min_u,
331 Float32 max_u,
332 Float32 min_v,
333 Float32 max_v,
334 Float32 animation_time,
335 Uint32 samples) const = 0;
336
337#ifdef MI_NEURAYLIB_DEPRECATED_15_1
338 inline Sint32 bake_texture(
339 ICanvas* texture,
340 Float32 min_u,
341 Float32 max_u,
342 Float32 min_v,
343 Float32 max_v,
344 Uint32 samples = 1) const
345 {
346 return bake_texture( texture, min_u, max_u, min_v, max_v, 0.0f, samples);
347 }
348#endif // MI_NEURAYLIB_DEPRECATED_15_1
349
381 ICanvas* texture, IData* constant, bool& is_constant, Uint32 samples) const = 0;
382
421 ICanvas* texture,
422 IData* constant,
423 bool& is_constant,
424 Float32 min_u,
425 Float32 max_u,
426 Float32 min_v,
427 Float32 max_v,
428 Float32 animation_time,
429 Uint32 samples) const = 0;
430
444 virtual Sint32 bake_constant( IData* constant, Uint32 samples = 1) const = 0;
445
452 virtual const char* get_type_name() const = 0;
453
454};
455 // end group mi_neuray_mdl_misc
457
458} // namespace neuraylib
459
460} // namespace mi
461
462#endif // MI_NEURAYLIB_IMDL_DISTILLER_H
This interface is the base interface of all types.
Definition: idata.h:297
This interface represents maps, i.e., a key-value based data structure.
Definition: imap.h:41
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
Allows to bake a varying or uniform expression of a compiled material into a texture or constant.
Definition: imdl_distiller_api.h:277
virtual bool is_uniform() const =0
Indicates whether the expression to be baked is uniform or varying.
virtual const char * get_type_name() const =0
Returns the required type name for constants.
virtual Sint32 bake_texture(ICanvas *texture, Float32 min_u, Float32 max_u, Float32 min_v, Float32 max_v, Float32 animation_time, Uint32 samples) const =0
Bakes the expression as texture (supports UV ranges and animated textures).
virtual const char * get_pixel_type() const =0
Returns the pixel type that matches the expression to be baked best.
virtual Sint32 bake_texture_with_constant_detection(ICanvas *texture, IData *constant, bool &is_constant, Uint32 samples) const =0
Bakes the expression as texture (supports detection of constants).
virtual Sint32 bake_texture(ICanvas *texture, Uint32 samples=1) const =0
Bakes the expression as texture.
virtual Sint32 bake_texture_with_constant_detection(ICanvas *texture, IData *constant, bool &is_constant, Float32 min_u, Float32 max_u, Float32 min_v, Float32 max_v, Float32 animation_time, Uint32 samples) const =0
Bakes the expression as texture (supports detection of constants, and UV ranges and animated textures...
virtual Sint32 bake_constant(IData *constant, Uint32 samples=1) const =0
Bakes the expression as constant.
Abstract interface for a canvas represented by a rectangular array of tiles.
Definition: icanvas.h:89
This interface represents a compiled material.
Definition: icompiled_material.h:97
Provides access to various functionality related to MDL distilling.
Definition: imdl_distiller_api.h:47
virtual const char * get_target_name(Size index) const =0
Returns the index -th target name supported for distilling, or nullptr if index is out of bounds.
virtual const char * get_required_module_code(const char *target, Size index) const =0
Returns the MDL source code of the required MDL module with the given index for the given target.
virtual ICompiled_material * distill_material(const ICompiled_material *material, const char *target, const IMap *distiller_options=nullptr, Sint32 *errors=nullptr) const =0
Distills a material.
virtual Size get_target_count() const =0
Returns the number of targets supported for distilling.
virtual Size get_required_module_count(const char *target) const =0
Returns the number of required MDL modules for the given target.
virtual const IBaker * create_baker(const ICompiled_material *material, const char *path, Baker_resource resource=BAKE_ON_CPU, Uint32 gpu_device_id=0) const =0
Creates a baker for texture baking.
virtual const char * get_required_module_name(const char *target, Size index) const =0
Returns the MDL name of the required MDL module with the given index for the given target.
#define mi_static_assert(expr)
Compile time assertion that raises a compilation error if the constant expression expr evaluates to f...
Definition: assert.h:58
int Sint32
32-bit signed integer.
Definition: types.h:46
float Float32
32-bit float.
Definition: types.h:51
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
Baker_resource
Identifies the resource(s) to be used by a baker.
Definition: imdl_distiller_api.h:30
@ BAKE_ON_CPU
Use only the CPU for texture baking.
Definition: imdl_distiller_api.h:33
@ BAKE_ON_GPU_WITH_CPU_FALLBACK
Prefer using the GPU for texture baking, use the CPU as fallback.
Definition: imdl_distiller_api.h:37
@ BAKE_ON_GPU
Use only the GPU for texture baking.
Definition: imdl_distiller_api.h:35
Mixin class template for deriving new interface declarations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5