neuray API Programmer's Manual

icompiled_material.h File Reference

Description

Scene element Compiled_material.

Code Example

icompiled_material.h

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

#ifndef MI_NEURAYLIB_ICOMPILED_MATERIAL_H
#define MI_NEURAYLIB_ICOMPILED_MATERIAL_H

#include <mi/neuraylib/iexpression.h>
#include <mi/neuraylib/iscene_element.h>

namespace mi {

namespace neuraylib {

class IMdl_execution_context;




enum Material_slot {
    SLOT_THIN_WALLED,                     
    SLOT_SURFACE_SCATTERING,              
    SLOT_SURFACE_EMISSION_EDF_EMISSION,   
    SLOT_SURFACE_EMISSION_INTENSITY,      
    SLOT_SURFACE_EMISSION_MODE,           
    SLOT_BACKFACE_SCATTERING,             
    SLOT_BACKFACE_EMISSION_EDF_EMISSION,  
    SLOT_BACKFACE_EMISSION_INTENSITY,     
    SLOT_BACKFACE_EMISSION_MODE,          
    SLOT_IOR,                             
    SLOT_VOLUME_SCATTERING,               
    SLOT_VOLUME_ABSORPTION_COEFFICIENT,   
    SLOT_VOLUME_SCATTERING_COEFFICIENT,   
    SLOT_VOLUME_EMISSION_INTENSITY,       
    SLOT_GEOMETRY_DISPLACEMENT,           
    SLOT_GEOMETRY_CUTOUT_OPACITY,         
    SLOT_GEOMETRY_NORMAL,                 
    SLOT_HAIR,                            
    SLOT_FIRST = SLOT_THIN_WALLED,        
    SLOT_LAST  = SLOT_HAIR,               
    SLOT_FORCE_32_BIT = 0xffffffffU
};

mi_static_assert( sizeof( Material_slot) == sizeof( mi::Uint32));

enum Material_opacity {
    OPACITY_OPAQUE,
    OPACITY_TRANSPARENT,
    OPACITY_UNKNOWN,
    OPACITY_FORCE_32_BIT = 0xffffffffU
};

mi_static_assert( sizeof( Material_opacity) == sizeof( mi::Uint32));

class ICompiled_material : public
    mi::base::Interface_declare<0x3115ab0f,0x7a91,0x4651,0xa5,0x9a,0xfd,0xb0,0x23,0x16,0xb4,0xb7,
                                neuraylib::IScene_element>
{
public:


    virtual const IExpression_direct_call* get_body() const = 0;

    virtual Size 
               get_temporary_count() const = 0;

    virtual const IExpression* get_temporary( Size index) const = 0;

    template<class T>
    const T* get_temporary( Size index) const
    {
        const IExpression* ptr_iexpression = get_temporary( index);
        if ( !ptr_iexpression)
            return 0;
        const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
        ptr_iexpression->release();
        return ptr_T;
    }

    virtual const IExpression* lookup_sub_expression( const char* path) const = 0;

    virtual bool is_valid( IMdl_execution_context* context) const = 0;




    virtual Size 
               get_parameter_count() const = 0;

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

    virtual const IValue* get_argument( Size index) const = 0;

    template<class T>
    const T* get_argument( Size index) const
    {
        const IValue* ptr_ivalue = get_argument( index);
        if ( !ptr_ivalue)
            return 0;
        const T* ptr_T = static_cast<const T*>( ptr_ivalue->get_interface( typename T::IID()));
        ptr_ivalue->release();
        return ptr_T;
    }

    virtual const IString* get_connected_function_db_name(
        const char* material_instance_name,
        Size parameter_index,
        Sint32* errors = 0) const = 0;




    virtual Float32 
               get_mdl_meters_per_scene_unit() const = 0;

    virtual Float32 
               get_mdl_wavelength_min() const = 0;

    virtual Float32 
               get_mdl_wavelength_max() const = 0;

    virtual Material_opacity 
               get_opacity() const = 0;

    virtual Material_opacity 
               get_surface_opacity() const = 0;


    virtual bool get_cutout_opacity( Float32* cutout_opacity) const = 0;

    virtual Size 
               get_referenced_scene_data_count() const = 0;

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

    virtual bool depends_on_state_transform() const = 0;

    virtual bool depends_on_state_object_id() const = 0;

    virtual bool depends_on_global_distribution() const = 0;

    virtual bool depends_on_uniform_scene_data() const = 0;




    virtual base::Uuid 
               get_hash() const = 0;

    virtual base::Uuid 
               get_slot_hash( Material_slot slot) const = 0;

    virtual base::Uuid 
               get_sub_expression_hash( const char* path) const = 0;

};
 // end group mi_neuray_mdl_elements

} // namespace neuraylib

} // namespace mi

#endif // MI_NEURAYLIB_ICOMPILED_MATERIAL_H

Namespaces

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

Classes

class 
This interface represents a compiled material. More...

Enumerations

enum  {OPACITY_OPAQUE, OPACITY_TRANSPARENT, OPACITY_UNKNOWN, OPACITY_FORCE_32_BIT = 0xffffffffU }
The opacity of a compiled material. More...
enum  {SLOT_THIN_WALLED, SLOT_SURFACE_SCATTERING, SLOT_SURFACE_EMISSION_EDF_EMISSION, SLOT_SURFACE_EMISSION_INTENSITY, SLOT_SURFACE_EMISSION_MODE, SLOT_BACKFACE_SCATTERING, SLOT_BACKFACE_EMISSION_EDF_EMISSION, SLOT_BACKFACE_EMISSION_INTENSITY, SLOT_BACKFACE_EMISSION_MODE, SLOT_IOR, SLOT_VOLUME_SCATTERING, SLOT_VOLUME_ABSORPTION_COEFFICIENT, SLOT_VOLUME_SCATTERING_COEFFICIENT, SLOT_VOLUME_EMISSION_INTENSITY, SLOT_GEOMETRY_DISPLACEMENT, SLOT_GEOMETRY_CUTOUT_OPACITY, SLOT_GEOMETRY_NORMAL, SLOT_HAIR, SLOT_FIRST = SLOT_THIN_WALLED, SLOT_LAST = SLOT_HAIR, SLOT_FORCE_32_BIT = 0xffffffffU }
Material slots identify parts of a compiled material. More...