neuray API Programmer's Manual

imdl_factory.h File Reference

Description

API component that gives access to some MDL functionality.

Code Example

imdl_factory.h

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

#ifndef MI_NEURAYLIB_IMDL_FACTORY_H
#define MI_NEURAYLIB_IMDL_FACTORY_H

#include <mi/base/interface_declare.h>
#include <mi/neuraylib/iexpression.h>
#include <mi/neuraylib/version.h>

#if defined (MI_NEURAYLIB_DEPRECATED_12_1) || defined(MI_NEURAYLIB_DEPRECATED_14_0)
#include <mi/neuraylib/imdl_execution_context.h>
#endif

namespace mi {

class IArray;
class IString;

namespace neuraylib {

class IExpression_factory;
class IMdl_execution_context;
class IMdl_module_builder;
class IMdl_module_transformer;
class ITransaction;
class IType_factory;
class IValue_bsdf_measurement;
class IValue_factory;
class IValue_light_profile;
class IValue_texture;





class IMdl_factory : public
    mi::base::Interface_declare<0xba936279,0x4b71,0x42a4,0x95,0x37,0x98,0x69,0x97,0xb3,0x47,0x72>
{
public:
    virtual IType_factory* create_type_factory( ITransaction* transaction) = 0;

    virtual IValue_factory* create_value_factory( ITransaction* transaction) = 0;

    virtual IExpression_factory* create_expression_factory( ITransaction* transaction) = 0;

    virtual IMdl_execution_context* create_execution_context() = 0;

    virtual IMdl_execution_context* clone( const IMdl_execution_context* context) = 0;

    virtual IValue_texture* create_texture(
        ITransaction* transaction,
        const char* file_path,
        IType_texture::Shape shape,
        Float32 gamma,
        const char* selector,
        bool shared,
        IMdl_execution_context* context) = 0;

#ifdef MI_NEURAYLIB_DEPRECATED_12_1
    inline IValue_texture* create_texture(
        ITransaction* transaction,
        const char* file_path,
        IType_texture::Shape shape,
        Float32 gamma,
        bool shared,
        Sint32* errors = 0)
    {
        mi::base::Handle< IMdl_execution_context> context( create_execution_context());
        IValue_texture* result = create_texture(
            transaction, file_path, shape, gamma, 0, shared, context.get());
        if( errors) {
            mi::base::Handle< const IMessage> msg( context->get_error_message( 0));
            *errors = msg ? msg->get_code() : 0;
        }
        return result;
    }
#endif // MI_NEURAYLIB_DEPRECATED_12_1

#ifdef MI_NEURAYLIB_DEPRECATED_14_0
    inline IValue_texture* create_texture(
        ITransaction* transaction,
        const char* file_path,
        IType_texture::Shape shape,
        Float32 gamma,
        const char* selector,
        bool shared,
        Sint32* errors = 0)
    {
        mi::base::Handle< IMdl_execution_context> context( create_execution_context());
        IValue_texture* result = create_texture(
            transaction, file_path, shape, gamma, selector, shared, context.get());
        if( errors) {
            mi::base::Handle< const IMessage> msg( context->get_error_message( 0));
            *errors = msg ? msg->get_code() : 0;
        }
        return result;
    }
#endif // MI_NEURAYLIB_DEPRECATED_14_0

    virtual IValue_light_profile* create_light_profile(
        ITransaction* transaction,
        const char* file_path,
        bool shared,
        IMdl_execution_context* context) = 0;

#ifdef MI_NEURAYLIB_DEPRECATED_14_0
    inline IValue_light_profile* create_light_profile(
        ITransaction* transaction,
        const char* file_path,
        bool shared,
        Sint32* errors = 0)
    {
        mi::base::Handle< IMdl_execution_context> context( create_execution_context());
        IValue_light_profile* result = create_light_profile(
            transaction, file_path, shared, context.get());
        if( errors) {
            mi::base::Handle< const IMessage> msg( context->get_error_message( 0));
            *errors = msg ? msg->get_code() : 0;
        }
        return result;
    }
#endif // MI_NEURAYLIB_DEPRECATED_14_0

    virtual IValue_bsdf_measurement* create_bsdf_measurement(
        ITransaction* transaction,
        const char* file_path,
        bool shared,
        IMdl_execution_context* context) = 0;

#ifdef MI_NEURAYLIB_DEPRECATED_14_0
    inline IValue_bsdf_measurement* create_bsdf_measurement(
        ITransaction* transaction,
        const char* file_path,
        bool shared,
        Sint32* errors = 0)
    {
        mi::base::Handle< IMdl_execution_context> context( create_execution_context());
        IValue_bsdf_measurement* result = create_bsdf_measurement(
            transaction, file_path, shared, context.get());
        if( errors) {
            mi::base::Handle< const IMessage> msg( context->get_error_message( 0));
            *errors = msg ? msg->get_code() : 0;
        }
        return result;
    }
#endif // MI_NEURAYLIB_DEPRECATED_14_0

    virtual IMdl_module_builder* create_module_builder(
        ITransaction* transaction,
        const char* module_name,
        Mdl_version min_module_version,
        Mdl_version max_module_version,
        IMdl_execution_context* context) = 0;

    virtual IMdl_module_transformer* create_module_transformer(
        ITransaction* transaction, const char* module_name, IMdl_execution_context* context) = 0;

    virtual const IString* get_db_module_name( const char* mdl_name) = 0;

    virtual const IString* get_db_definition_name( const char* mdl_name) = 0;

    virtual void analyze_uniform(
        ITransaction* transaction,
        const char* root_name,
        bool root_uniform,
        const IExpression* query_expr,
        bool& query_result,
        IString* error_path,
        IMdl_execution_context* context) const = 0;

    virtual const IString* decode_name( const char* name) = 0;

    virtual const IString* encode_module_name( const char* name) = 0;

    virtual const IString* encode_function_definition_name(
        const char* name, const IArray* parameter_types) const = 0;

    virtual const IString* encode_type_name( const char* name) const = 0;

    virtual bool is_valid_mdl_identifier( const char* name) const = 0;
};
 // end group mi_neuray_mdl_misc

} // namespace neuraylib

} // namespace mi

#endif // MI_NEURAYLIB_IMDL_FACTORY_H

Namespaces

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

Classes

class 
Factory for various MDL interfaces and functions. More...