neuray API Programmer's Manual

imdl_material_instance.h File Reference

Description

Scene element Mdl_material_instance.

Code Example

imdl_material_instance.h

‎//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************

#ifndef MI_NEURAYLIB_IMDL_MATERIAL_INSTANCE_H
#define MI_NEURAYLIB_IMDL_MATERIAL_INSTANCE_H

#include <mi/neuraylib/iattachable.h>
#include <mi/neuraylib/iscene_element.h>
#include <mi/neuraylib/version.h>

namespace mi {

namespace neuraylib {

class IAttribute_container;
class IMdl_compiled_material;

class IMdl_material_instance : public
    mi::base::Interface_declare<0xf265a300,0x01d9,0x4b65,0xb9,0x64,0xd4,0x78,0xde,0x7c,0xeb,0xf2,
                                neuraylib::IScene_element>
{
public:
    virtual const char* get_material_definition() const = 0;

    virtual const char* get_name() const = 0;

    virtual Uint32 
               get_parameter_count() const = 0;

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

    virtual Sint32 
               get_parameter_index( const char* name) const = 0;

    virtual const char* get_parameter_type( Uint32 index) const = 0;

    virtual const char* get_parameter_type( const char* name) const = 0;

    virtual bool is_parameter_type_uniform( Uint32 index) const = 0;

    virtual bool is_parameter_type_uniform( const char* name) const = 0;

    virtual const char* get_argument_type( Uint32 index) const = 0;

    virtual const char* get_argument_type( const char* name) const = 0;

    virtual const IAttachable* get_argument( Uint32 index) const = 0;

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

    virtual const IAttachable* get_argument( const char* name) const = 0;

    template<class T>
    const T* get_argument( const char* name) const
    {
        const IAttachable* ptr_idata = get_argument( name);
        if ( !ptr_idata)
            return 0;
        const T* ptr_T = static_cast<const T*>( ptr_idata->get_interface( typename T::IID()));
        ptr_idata->release();
        return ptr_T;
    }

    virtual Sint32 
               set_argument( Uint32 index, const IAttachable* value) = 0;

    virtual Sint32 
               set_argument( const char* name, const IAttachable* value) = 0;

    virtual const IAttribute_container* access_arguments() const = 0;

    virtual Sint32 
               set_arguments( const IAttribute_container* arguments) = 0;

    enum Compilation_options {
        DEFAULT_OPTIONS   = 0, 
        CLASS_COMPILATION = 1, 
        COMPILATION_OPTIONS_FORCE_32_BIT = 0xffffffffU // Undocumented, for alignment only
    };

    mi_static_assert( sizeof( Compilation_options) == sizeof( Uint32));

    virtual IMdl_compiled_material* create_compiled_material(
        Uint32 flags = 0, Float32 mdl_meters_per_scene_unit = 1.0f, Sint32* errors = 0) const = 0;
};
 // end group mi_neuray_materials

} // namespace neuraylib

#ifdef MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
using neuraylib::IAttribute_container;
using neuraylib::IMdl_compiled_material;
using neuraylib::IMdl_material_instance;
using neuraylib::IScene_element;
#endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION

} // namespace mi

#endif // MI_NEURAYLIB_IMDL_MATERIAL_INSTANCE_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 material instance. More...