neuray API Programmer's Manual

mi::neuraylib::ITexture Class Reference

[Miscellaneous]

Description

Textures add image processing options to images. A texture appears in the scene as an argument of an MDL function call (see mi::neuraylib::IFunction_call) or default argument of an MDL function definition (see mi::neuraylib::IFunction_definition). The type of such an argument is mi::neuraylib::IType_texture or an alias of it.

See also:

mi::neuraylib::IImage

Methods related to the referenced image

virtual const char* get_image() const =0
Returns the referenced image. More...
virtual Sint32 set_image( const char* name) =0
Sets the referenced image. More...

Methods related to the gamma value

virtual Float32 get_effective_gamma( Size frame_id, Size uvtile_id) const =0
Returns the effective gamma value. More...
virtual Float32 get_gamma() const =0
Returns the gamma value of this texture. More...
virtual void set_gamma( Float32 gamma) =0
Sets the gamma value of this texture. More...

Miscellaneous methods

virtual Texture_compression get_compression() const =0
Returns the texture compression method. More...
virtual const char* get_selector() const =0
Returns the selector (or NULL).
virtual void set_compression( Texture_compression compression) =0
Sets the texture compression method. More...

Member Functions

virtual Texture_compression mi::​neuraylib::​ITexture::get_compression() const [pure virtual]

Returns the texture compression method.

Note:

This setting does not affect the referenced image itself, it only affects image data that has been processed by the render modes. For example, in order to save GPU memory processed image data can be compressed before being uploaded to the GPU.

See also:

mi::neuraylib::Texture_compression

virtual Float32 mi::​neuraylib::​ITexture::get_effective_gamma( Size frame_id, Size uvtile_id) const [pure virtual]

Returns the effective gamma value. Returns the gamma value of this texture, unless no override is set. In this case the gamma value of the underlying image at the given frame and uvtile index is returned. If no such image exists, 0.0 is returned.

See also:

set_gamma(), get_gamma()

Parameters

frame_id
The frame ID of the mipmap the gamma value is requested for when no override is set.
uvtile_id
The uv-tile id of the mipmap the gamma value is requested for when no override is set.
virtual Float32 mi::​neuraylib::​ITexture::get_gamma() const [pure virtual]

Returns the gamma value of this texture.

See also:

set_gamma(), get_effective_gamma()

virtual const char* mi::​neuraylib::​ITexture::get_image() const [pure virtual]

Returns the referenced image.

Returns

The referenced image, or NULL if no image is referenced.

virtual const char* mi::​neuraylib::​ITexture::get_selector() const [pure virtual]

Returns the selector (or NULL).

virtual void mi::​neuraylib::​ITexture::set_compression( Texture_compression compression) [pure virtual]

Sets the texture compression method.

Note:

This setting does not affect the referenced image itself, it only affects image data that has been processed by the render modes. For example, in order to save GPU memory processed image data can be compressed before being uploaded to the GPU.

See also:

mi::neuraylib::Texture_compression

virtual void mi::​neuraylib::​ITexture::set_gamma( Float32 gamma) [pure virtual]

Sets the gamma value of this texture. The gamma value of the texture is an override for the gamma value of the underlying image. The special value 0.0 means that the override is not set.

This override value is also used when MDL source code is to be generated:

  • a value of 1.0 is converted to "::tex::gamma_linear",

  • a value of 2.2 is converted to "::tex::gamma_srgb", and

  • all other values are converted to "::tex::gamma_default". Therefore, if you want to avoid "::tex::gamma_default" in generated MDL source code, it makes sense to replicate the gamma value of the underlying image here (instead of not using the override).

See also:

get_gamma(), get_effective_gamma()

virtual Sint32 mi::​neuraylib::​ITexture::set_image( const char* name) [pure virtual]

Sets the referenced image.

Returns

  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: There is no element with that name.
  • -3: The element can not be referenced because it is in a more private scope than the texture.
  • -4: The element is not an image.