NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::IShader_class Class Referenceabstract

This interfaces represents a shader class, a description of a set of shaders with common characteristics and behaviors. More...

Inheritance diagram for mi::IShader_class:
Inheritance graph
[legend]

Public Member Functions

virtual Sint32  create_function (const char *name, Uint8 privacy=0) const =0
  Creates a new shader instance. More...
 
virtual Sint32  create_shader (const char *name, Uint8 privacy=0) const =0
  Creates a new shader instance. More...
 
virtual const
IAttribute_container
access_input_parameters () const =0
  Returns an attribute container containing all allowed shader input parameters. More...
 
virtual const
IAttribute_container
access_output_parameters () const =0
  Returns an attribute container containing all allowed shader output parameters. More...
 
virtual const char *  get_filename () const =0
  Returns the filename containing the shader class. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xaeff272d, 0xf6f8, 0x4e13, 0x81, 0xcf, 0xee, 0xe0, 0x93, 0x4c, 0x5a, 0x6f, IScene_element >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IScene_element
Self
  Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
  Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xaeff272d, 0xf6f8, 0x4e13, 0x81, 0xcf, 0xee, 0xe0, 0x93, 0x4c, 0x5a, 0x6f, IScene_element >
static bool  compare_iid (const Uuid &iid)
  Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

This interfaces represents a shader class, a description of a set of shaders with common characteristics and behaviors.

Note
MetaSL is deprecated. Support for MetaSL might be removed in future releases. Use MDL instead.

Introduction

An mi::IShader_class stands in relation to an mi::IShader as a C++ class stands in relation to its instance. An mi::IShader that is an instance of an mi::IShader_class has its various characteristics and behaviors defined by the corresponding mi::IShader_class. In particular, an mi::IShader has a set of allowed input parameters. The names, types, and default values of these input parameters are defined by the corresponding mi::IShader_class. Similarly, an mi::IShader has a set of allowed output parameters. The names and types of these output parameters are defined by the corresponding mi::IShader_class. In addition, as mentioned in the mi::IShader documentation, an mi::IShader is a user supplied program. This program is specified by the corresponding mi::IShader_class.

Shader Creation

An mi::IShader corresponding to this mi::IShader_class can be created in one of two ways. You can use the method create_function() or you can use the method create_shader(). Both of these methods create a new mi::IShader corresponding to this mi::IShader_class and store it in the database at the specified privacy level. However, these methods differ slightly in how they initialize this new mi::IShader.

The method create_function() creates a new mi::IShader corresponding to this mi::IShader_class and stores it in the database at the specified privacy level. This new mi::IShader has all allowed input parameters present and the value of each input parameter is the default value specified by this mi::IShader_class. (If there is no default value specified, the input parameter has value 0.)

The method create_shader() creates a new mi::IShader corresponding to this mi::IShader_class and stores it in the database at the specified privacy level. This new mi::IShader has no input parameters present, a stark contrast to the behavior of the method create_function(). If you wish to add allowed input parameters to the created mi::IShader, you can do so using the mi::IAttribute_set interface of the created mi::IShader. (Note, using the mi::IAttribute_set interface of mi::IShader to create attributes that do not appear as input parameters on this mi::IShader_class is not supported.)

The preferred means of creating an mi::IShader is by way of the method create_shader(). As the input parameters' names, types, and default values are defined on this mi::IShader_class, the needless copying of all allowed input parameters to the created mi::IShader, as is done by create_function(), is a waste of memory. When a scene contains many mi::IShader's, this overhead can become significant.

Member Function Documentation

virtual const IAttribute_container* mi::IShader_class::access_input_parameters ( ) const
pure virtual

Returns an attribute container containing all allowed shader input parameters.

The attribute container can be used to inquire about the names, types, and values of all allowed shader input parameters.

virtual const IAttribute_container* mi::IShader_class::access_output_parameters ( ) const
pure virtual

Returns an attribute container containing all allowed shader output parameters.

The attribute container can be used to inquire about the names and types of all allowed shader output parameters.

virtual Sint32 mi::IShader_class::create_function ( const char *  name,
Uint8  privacy = 0 
) const
pure virtual

Creates a new shader instance.

The new instance of type mi::IShader will be stored under the name name in the database. The new shader instance has all allowed input parameters added as attributes. The value of an input parameter is either the default, specified by this shader class, or it is 0.

Note that if this interface actually represents a compound shader class (see mi::ICompound_shader_class) this method requires that the compound shader class has been retrieved from the database. The method fails if it is called on a newly created compound shader class that has not yet been stored in the database.

Parameters
name The name of the new shader instance.
privacy The privacy level of the new shader instance. The constant mi::neuraylib::ITransaction::LOCAL_SCOPE can be used to indicate the privacy level of the scope of the transaction that was used to obtain this shader class object.
Returns
See mi::neuraylib::ITransaction::store() for possible return values. In addition, the value -10 indicates that the instance was not retrieved from the DB. You need to store it in the DB and access it again before using this method.
virtual Sint32 mi::IShader_class::create_shader ( const char *  name,
Uint8  privacy = 0 
) const
pure virtual

Creates a new shader instance.

The new instance of type mi::IShader will be stored under the name name in the database. The new shader instance has no input parameters added as attributes.

Note that if this interface actually represents a compound shader class (see mi::ICompound_shader_class) this method requires that the compound shader class has been retrieved from the database. The method fails if it is called on a newly created compound shader class that has not yet been stored in the database.

Parameters
name The name of the new shader instance.
privacy The privacy level of the new shader instance. The constant mi::neuraylib::ITransaction::LOCAL_SCOPE can be used to indicate the privacy level of the scope of the transaction that was used to obtain this shader class object.
Returns
See mi::neuraylib::ITransaction::store() for possible return values. In addition, the value -10 indicates that the instance was not retrieved from the DB. You need to store it in the DB and access it again before using this method.
virtual const char* mi::IShader_class::get_filename ( ) const
pure virtual

Returns the filename containing the shader class.

Returns
The absolute filename of the shader class, or NULL if it was not loaded from a file.