neuray API Programmer's Manual

imdl_distiller_api.h File Reference

Description

API component that gives access to the MDL distiller.

Code Example

imdl_distiller_api.h

‎/***************************************************************************************************
 * Copyright 2024 NVIDIA Corporation. All rights reserved.
 **************************************************************************************************/

#ifndef MI_NEURAYLIB_IMDL_DISTILLER_H
#define MI_NEURAYLIB_IMDL_DISTILLER_H

#include <mi/base/interface_declare.h>

namespace mi {

class IData;
class IMap;

namespace neuraylib {

class IBaker;
class ICanvas;
class ICompiled_material;




enum Baker_resource {

    BAKE_ON_CPU,
    BAKE_ON_GPU,
    BAKE_ON_GPU_WITH_CPU_FALLBACK,
    //  Undocumented, for alignment only.
    BAKER_RESOURCE_FORCE_32_BIT = 0xffffffffU
};

mi_static_assert( sizeof( Baker_resource) == sizeof( Uint32));

class IMdl_distiller_api : public
    mi::base::Interface_declare<0x074709ef,0x11b0,0x4196,0x82,0x1c,0xab,0x64,0x1a,0xa2,0x50,0xdb>
{
public:
    virtual Size 
               get_target_count() const = 0;

    virtual const char* get_target_name( Size index) const = 0;

    virtual ICompiled_material* distill_material(
        const ICompiled_material* material,
        const char* target,
        const IMap* distiller_options = 0,
        Sint32* errors = 0) const = 0;

    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;

    virtual Size 
               get_required_module_count( const char* target) const = 0;

    virtual const char* get_required_module_name( const char* target, Size index) const = 0;

    virtual const char* get_required_module_code( const char* target, Size index) const = 0;
};

class IBaker : public
    mi::base::Interface_declare<0x4dba1b1d,0x8fce,0x43d9,0x80,0xa7,0xa2,0x24,0xf3,0x1e,0xdc,0xe7>
{
public:
    virtual const char* get_pixel_type() const = 0;

    virtual bool is_uniform() const = 0;

    virtual Sint32 
               bake_texture( ICanvas* texture, Uint32 samples = 1) const = 0;

    virtual Sint32 
               bake_texture(
        ICanvas* texture,
        Float32 min_u, Float32 max_u, Float32 min_v, Float32 max_v,
        Uint32 samples = 1) const = 0;

    virtual Sint32 
               bake_constant( IData* constant, Uint32 samples = 1) const = 0;
};
 // end group mi_neuray_mdl_misc

} // namespace neuraylib

} // namespace mi

#endif // MI_NEURAYLIB_IMDL_DISTILLER_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
namespace 
Namespace for the neuray API. More...

Classes

class 
Allows to bake a varying or uniform expression of a compiled material into a texture or constant. More...
class 
Provides access to various functionality related to MDL distilling. More...

Enumerations

enum  {BAKE_ON_CPU, BAKE_ON_GPU, BAKE_ON_GPU_WITH_CPU_FALLBACK, BAKER_RESOURCE_FORCE_32_BIT = 0xffffffffU }
Identifies the resource(s) to be used by a baker. More...