MaterialKit
-
class HPS::MaterialKit : public HPS::Kit
The MaterialKit class is a user space object, useful for carrying a group of attribute settings. A MaterialKit can be associated with various geometry or subgeometery types using a material mapping kit or control.
Public Functions
-
virtual bool Empty() const
Indicates whether this object has any values set on it.
- Returns
true if no values are set on this object, false otherwise.
-
bool Equals(MaterialKit const &in_kit) const
Check if the source MaterialKit is equivalent to this object.
- Parameters
in_kit – The source MaterialKit to compare to this object.
- Returns
true if the objects are equivalent, false otherwise.
-
MaterialKit()
The default constructor creates an empty MaterialKit object.
-
MaterialKit(MaterialKit &&in_that)
The move constructor creates a MaterialKit by transferring the underlying impl of the rvalue reference to this MaterialKit thereby avoiding a copy and allocation.
- Parameters
in_that – An rvalue reference to a MaterialKit to take the impl from.
-
MaterialKit(MaterialKit const &in_kit)
The copy constructor creates a new MaterialKit object that contains the same settings as the source.
- Parameters
in_kit – The source MaterialKit to copy.
-
inline virtual HPS::Type ObjectType() const
This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).
- Returns
The declared type of the object in question, which may differ from the true, underlying type.
-
bool operator!=(MaterialKit const &in_kit) const
Check if the source MaterialKit is not equivalent to this object.
- Parameters
in_kit – The source MaterialKit to compare to this object.
- Returns
true if the objects are not equivalent, false otherwise.
-
MaterialKit &operator=(MaterialKit &&in_that)
The move assignment operator transfers the underlying impl of the rvalue reference to this MaterialKit thereby avoiding a copy.
- Parameters
in_that – An rvalue reference to a MaterialKit to take the impl from.
- Returns
A reference to this MaterialKit.
-
MaterialKit &operator=(MaterialKit const &in_kit)
Copies the source MaterialKit into this object.
- Parameters
in_kit – The source MaterialKit to copy.
- Returns
A reference to this object.
-
bool operator==(MaterialKit const &in_kit) const
Check if the source MaterialKit is equivalent to this object.
- Parameters
in_kit – The source MaterialKit to compare to this object.
- Returns
true if the objects are equivalent, false otherwise.
-
void Set(MaterialKit const &in_kit)
Copies all settings from the source MaterialKit into this object.
- Parameters
in_kit – The source MaterialKit to copy.
-
MaterialKit &SetBump(char const *in_texture_name)
Applies a named texture to the bump channel, replacing any other texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuse(RGBAColor const &in_color)
Applies an RGBA color to the whole diffuse channel, replacing any diffuse textures or shaders.
- Parameters
in_color – The color to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuse(RGBColor const &in_color)
Applies an RGB color to the whole diffuse channel, replacing any diffuse textures or shaders.
- Parameters
in_color – The color to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseAlpha(float in_alpha)
Applies an alpha channel the diffuse color channel. Only one diffuse color may be set at a time but it can coexist with diffuse textures if they have transparency. If diffuse color has not been set, white will be set as a default value in the diffuse color channel with a transparent value of in_alpha.
- Parameters
in_alpha – The alpha to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseColor(RGBAColor const &in_color)
Applies an RGBA color to the diffuse color channel. Only one diffuse color may be set at a time but it can coexist with diffuse textures if they have transparency.
- Parameters
in_color – The color to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseColor(RGBColor const &in_color)
Applies an RGB color to the diffuse color channel. Only one diffuse color may be set at a time but it can coexist with diffuse textures if they have transparency.
- Parameters
in_color – The color to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseTexture(char const *in_texture_name, RGBAColor const &in_modulating_color, size_t in_layer = 0)
Applies a modulated named texture to the specified layer of the diffuse texture channel, replacing any other textures on that layer.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible. There are two special values that can be passed in here. A null pointer removes the texture name from that layer, allowing the texture on that layer to be inherited from above in the tree. Passing an empty string, “”, removes the texture from that layer but indicates that no texture should be inherited from above, an explicit blank.
in_modulating_color – A color that will be applied as a filter to the texture.
in_layer – The layer to apply the texture to. Higher numbered layers are applied on top of lower numbered ones.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseTexture(char const *in_texture_name, size_t in_layer = 0)
Applies a named texture to the specified layer of the diffuse texture channel, replacing any other textures on that layer.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible. There are two special values that can be passed in here. A null pointer removes the texture name from that layer, allowing the texture on that layer to be inherited from above in the tree. Passing an empty string, “”, removes the texture from that layer but indicates that no texture should be inherited from above, an explicit blank.
in_layer – The layer to apply the texture to. Higher numbered layers are applied on top of lower numbered ones.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseTexture(size_t in_count, UTF8 const in_texture_names[])
Applies named textures to each of the specified layers of the diffuse texture channel, replacing any other textures on those layers.
- Parameters
in_count – the number of elements in the array of names.
in_texture_names – The names of textures, one per layer. Uninitialized strings are ignored. An empty string, “”, removes the texture from that layer but indicates that no texture should be inherited from above, an explicit blank.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseTexture(size_t in_count, UTF8 const in_texture_names[], RGBAColor const in_modulating_colors[])
Applies named textures, possibly modulated, to each of the specified layers of the diffuse texture channel, replacing any other textures on those layers.
- Parameters
in_count – the number of elements in the both arrays.
in_texture_names – The names of textures, one per layer. Uninitialized strings are ignored. An empty string, “”, removes the texture from that layer but indicates that no texture should be inherited from above, an explicit blank.
in_modulating_colors – An array of modulating colors to be applied to the corresponding layer. If a color in the this array is uninitialized, the texture on that layer will be unmodulated.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseTexture(UTF8Array const &in_texture_names)
Applies named textures to each of the specified layers of the diffuse texture channel, replacing any other textures on those layers.
- Parameters
in_texture_names – The names of textures, one per layer. Uninitialized strings are ignored. An empty string, “”, removes the texture from that layer but indicates that no texture should be inherited from above, an explicit blank.
- Returns
A reference to this object.
-
MaterialKit &SetDiffuseTexture(UTF8Array const &in_texture_names, RGBAColorArray const &in_modulating_colors)
Applies named textures, possibly modulated, to each of the specified layers of the diffuse texture channel, replacing any other textures on those layers.
- Parameters
in_texture_names – The names of textures, one per layer. Uninitialized strings are ignored. An empty string, “”, removes the texture from that layer but indicates that no texture should be inherited from above, an explicit blank.
in_modulating_colors – An array of modulating colors to be applied to the corresponding layer. If a color in the this array is uninitialized, the texture on that layer will be unmodulated.
- Returns
A reference to this object.
-
MaterialKit &SetEmission(char const *in_texture_name)
Applies a named texture to the emission channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetEmission(char const *in_texture_name, RGBAColor const &in_modulating_color)
Applies a modulated named texture to the emission channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
in_modulating_color – A color that will be applied as a filter to the texture.
- Returns
A reference to this object.
-
MaterialKit &SetEmission(RGBAColor const &in_rgba_color)
Applies an RGBA color to the emission channel, replacing any other color or texture on that channel.
- Parameters
in_rgba_color – The color to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetEnvironmentCubeMap(char const *in_cubemap_name)
Applies a named cube map to the environment channel, replacing any other texture or cube map on that channel.
- Parameters
in_cubemap_name – The name of a texture, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetEnvironmentCubeMap(char const *in_cubemap_name, RGBAColor const &in_modulating_color)
Applies a modulated named cube map to the environment channel, replacing any other texture or cube map on that channel.
- Parameters
in_cubemap_name – The name of a texture, defined in a portfolio that is accessible.
in_modulating_color – A color that will be applied as a filter to the cube map.
- Returns
A reference to this object.
-
MaterialKit &SetEnvironmentTexture()
Cancels any other texture or cube map on the environment channel.
- Returns
A reference to this object.
-
MaterialKit &SetEnvironmentTexture(char const *in_texture_name)
Applies a named texture to the environment channel, replacing any other texture or cube map on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetEnvironmentTexture(char const *in_texture_name, RGBAColor const &in_modulating_color)
Applies a modulated named texture to the environment channel, replacing any other texture or cube map on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
in_modulating_color – A color that will be applied as a filter to the texture.
- Returns
A reference to this object.
-
MaterialKit &SetGloss(float in_gloss)
Gloss is a setting that helps to determine the specular response of a material. It is a single floating point value that describes the “focus” of specular reflections off a surface. The gloss value changes the area of the “glare” off a surface. A high gloss value gives a small, focused glare; a low gloss value results in a less polished, more scattered reflection.
- Parameters
in_gloss – Gloss is always positive, and most surfaces have a gloss in the range of 1.0 to 30.0.
- Returns
A reference to this object.
-
MaterialKit &SetLegacyShader(char const *in_legacy_shader_name)
Internal use only - customers should not use. Applies a legacy shader which replaces the diffuse texture at layer 0. It may also replace all diffuse textures depending on the multitexture setting of the legacy shader.
- Parameters
in_legacy_shader_name – The name of a legacy shader, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetMirror(char const *in_texture_name)
Applies a named texture to the mirror channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetMirror(char const *in_texture_name, RGBAColor const &in_modulating_color)
Applies a modulated named texture to the mirror channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
in_modulating_color – A color that will be applied as a filter to the texture.
- Returns
A reference to this object.
-
MaterialKit &SetMirror(RGBAColor const &in_rgba_color)
Applies an RGBA color to the mirror channel, replacing any other color or texture on that channel.
- Parameters
in_rgba_color – The color to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetSpecular(char const *in_texture_name)
Applies a named texture to the specular channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetSpecular(char const *in_texture_name, RGBAColor const &in_modulating_color)
Applies a modulated named texture to the specular channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
in_modulating_color – A color that will be applied as a filter to the texture.
- Returns
A reference to this object.
-
MaterialKit &SetSpecular(RGBAColor const &in_rgba_color)
Applies an RGBA color to the specular channel, replacing any other color or texture on that channel.
- Parameters
in_rgba_color – The color to be applied.
- Returns
A reference to this object.
-
MaterialKit &SetTransmission(char const *in_texture_name)
Applies a named texture to the transmission channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
- Returns
A reference to this object.
-
MaterialKit &SetTransmission(char const *in_texture_name, RGBAColor const &in_modulating_color)
Applies a modulated named texture to the transmission channel, replacing any other color or texture on that channel.
- Parameters
in_texture_name – The name of a texture, defined in a portfolio that is accessible.
in_modulating_color – A color that will be applied as a filter to the texture.
- Returns
A reference to this object.
-
void Show(MaterialKit &out_kit) const
Copies all settings from this MaterialKit into the given MaterialKit.
- Parameters
out_kit – The MaterialKit to populate with the contents of this object.
-
bool ShowBump(UTF8 &out_texture_name) const
Retrieves the texture applied to the bump channel.
- Parameters
out_texture_name – The name of a texture applied to this channel.
- Returns
true if a texture has been set on the bump channel, false otherwise.
-
bool ShowDiffuse() const
If the diffuse color will override textures and shaders.
- Returns
true if the diffuse color will override textures and shaders, false otherwise.
-
bool ShowDiffuseAlpha(float &out_alpha) const
Retrieves alpha set on the diffuse alpha channel.
- Parameters
out_alpha – The color set on the diffuse alpha channel.
- Returns
true if the internal selection limit is valid, false otherwise.
-
bool ShowDiffuseColor(RGBAColor &out_rgba_color) const
Retrieves RGBA color set on the diffuse color channel.
- Parameters
out_rgba_color – The RGBA color set on the diffuse color channel.
- Returns
true if the diffuse RGB color is valid, false otherwise.
-
bool ShowDiffuseColor(RGBColor &out_rgb_color) const
Retrieves RGB color set on the diffuse RGB channel.
- Parameters
out_rgb_color – The RGB color set on the diffuse RGB channel.
- Returns
true if the diffuse RGB color is valid, false otherwise.
-
bool ShowDiffuseTexture(Material::Type &out_type, RGBAColor &out_color, UTF8 &out_texture_name) const
Retrieves the possibly modulated texture applied to layer 0 of the diffuse texture channel.
- Parameters
out_type – Indicates which of the following arguments is valid. If the type is TextureName, only the texture name is valid, the color should be ignored. If the type is ModulatedTexture, both the texture name and the modulating color are valid.
out_color – A modulating color applied as a filter to the named texture, only valid if out_type is ModulatedTexture.
out_texture_name – The name of a texture applied to this channel.
- Returns
true if a texture has been set on layer 0 of the diffuse texture channel, false otherwise.
-
bool ShowDiffuseTexture(MaterialTypeArray &out_types, RGBAColorArray &out_colors, UTF8Array &out_texture_names) const
Retrieves the possibly modulated textures applied to all layers of the diffuse texture channel.
- Parameters
out_types – An array of types indicating which of the following arguments is valid for each layer. If a type is TextureName, only the texture name is valid, the color should be ignored. If a type is ModulatedTexture, both the texture name and the modulating color are valid. If a type is Nothing, there is no texture applied to that layer
out_colors – An array of modulating colors applied as filters to the named textures, each entry is only valid if the corresponding entry in out_types is ModulatedTexture.
out_texture_names – An array of names of a textures applied to this channel, indexed by layer.
- Returns
true if any texture has been set on the diffuse texture channel, false otherwise.
-
bool ShowDiffuseTexture(size_t in_layer, Material::Type &out_type, RGBAColor &out_color, UTF8 &out_texture_name) const
Retrieves the possibly modulated texture applied to the specified layer of the diffuse texture channel.
- Parameters
in_layer – The layer number to query for a texture.
out_type – Indicates which of the following arguments is valid. If the type is TextureName, only the texture name is valid, the color should be ignored. If the type is ModulatedTexture, both the texture name and the modulating color are valid.
out_color – A modulating color applied as a filter to the named texture, only valid if out_type is ModulatedTexture.
out_texture_name – The name of a texture applied to this channel.
- Returns
true if a texture has been set on the specified layer of the diffuse texture channel, false otherwise.
-
bool ShowEmission(Material::Type &out_type, RGBAColor &out_color, UTF8 &out_texture_name) const
Retrieves the color, texture, or modulated texture applied to the emission channel.
- Parameters
out_type – Indicates which of the following arguments is valid. If the type is RGBAColor, only out_color is valid, the texture name should be ignored. If the type is TextureName, only the texture name is valid, the color should be ignored. If the type is ModulatedTexture, both the texture name and the modulating color are valid.
out_color – A color used either for the entire channel or to modulate a texture on this channel. See out_type to determine if this color is valid.
out_texture_name – The name of a possibly modulated texture applied to this channel. See out_type to determine if this texture name is valid.
- Returns
true if any color or texture has been set on the emission channel, false otherwise.
-
bool ShowEnvironment(Material::Type &out_type, RGBAColor &out_color, UTF8 &out_texture_name) const
Retrieves the color, texture, or modulated texture applied to the environment channel.
- Parameters
out_type – Indicates which of the following arguments is valid. If the type is RGBAColor, only out_color is valid, the texture name should be ignored. If the type is TextureName, only the texture name is valid, the color should be ignored. If the type is ModulatedTexture, both the texture name and the modulating color are valid.
out_color – A color used either for the entire channel or to modulate a texture on this channel. See out_type to determine if this color is valid.
out_texture_name – The name of a possibly modulated texture applied to this channel. See out_type to determine if this texture name is valid.
- Returns
true if any color or texture has been set on the environment channel, false otherwise.
-
bool ShowGloss(float &out_gloss) const
Retrieves the gloss of this material. Gloss is a single floating point value that describes the “focus” of specular reflections off a surface.
- See
- Parameters
out_gloss – The gloss value of this material. Gloss is always positive, and most surfaces have a gloss in the range of 1.0 to 30.0.
- Returns
true if gloss has been specified for this material, false otherwise.
-
bool ShowLegacyShader(UTF8 &out_legacy_shader_name) const
Internal use only - customers should not use. Retrieves the legacy shader applied to this material
- Parameters
out_legacy_shader_name – The name of a legacy shader applied to this material.
- Returns
true if a legacy shader has been set on this material, false otherwise.
-
bool ShowMirror(Material::Type &out_type, RGBAColor &out_color, UTF8 &out_texture_name) const
Retrieves the color, texture, or modulated texture applied to the mirror channel.
- Parameters
out_type – Indicates which of the following arguments is valid. If the type is RGBAColor, only out_color is valid, the texture name should be ignored. If the type is TextureName, only the texture name is valid, the color should be ignored. If the type is ModulatedTexture, both the texture name and the modulating color are valid.
out_color – A color used either for the entire channel or to modulate a texture on this channel. See out_type to determine if this color is valid.
out_texture_name – The name of a possibly modulated texture applied to this channel. See out_type to determine if this texture name is valid.
- Returns
true if any color or texture has been set on the mirror channel, false otherwise.
-
bool ShowSpecular(Material::Type &out_type, RGBAColor &out_color, UTF8 &out_texture_name) const
Retrieves the color, texture, or modulated texture applied to the specular channel.
- Parameters
out_type – Indicates which of the following arguments is valid. If the type is RGBAColor, only out_color is valid, the texture name should be ignored. If the type is TextureName, only the texture name is valid, the color should be ignored. If the type is ModulatedTexture, both the texture name and the modulating color are valid.
out_color – A color used either for the entire channel or to modulate a texture on this channel. See out_type to determine if this color is valid.
out_texture_name – The name of a possibly modulated texture applied to this channel. See out_type to determine if this texture name is valid.
- Returns
true if any color or texture has been set on the specular channel, false otherwise.
-
bool ShowTransmission(Material::Type &out_type, RGBAColor &out_color, UTF8 &out_texture_name) const
Retrieves the color, texture, or modulated texture applied to the transmission channel.
- Parameters
out_type – Indicates which of the following arguments is valid. If the type is RGBAColor, only out_color is valid, the texture name should be ignored. If the type is TextureName, only the texture name is valid, the color should be ignored. If the type is ModulatedTexture, both the texture name and the modulating color are valid.
out_color – A color used either for the entire channel or to modulate a texture on this channel. See out_type to determine if this color is valid.
out_texture_name – The name of a possibly modulated texture applied to this channel. See out_type to determine if this texture name is valid.
- Returns
true if any color or texture has been set on the transmission channel, false otherwise.
-
MaterialKit &UnsetBump()
Removes all settings applied to the bump channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetDiffuseAlpha()
Removes all settings applied to the diffuse alpha channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetDiffuseColor()
Removes all settings applied to the diffuse color channel including alpha.
- Returns
A reference to this object.
-
MaterialKit &UnsetDiffuseColorRGB()
Removes all settings applied to the diffuse rgb channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetDiffuseTexture()
Removes all settings applied to all layers of the diffuse texture channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetDiffuseTexture(size_t in_layer)
Removes all settings applied to the specified layer of the diffuse texture channel.
- Parameters
in_layer – The layer to remove the setting from.
- Returns
A reference to this object.
-
MaterialKit &UnsetEmission()
Removes all settings applied to the emission channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetEnvironment()
Removes all settings applied to the environment channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetEverything()
Removes all setting from this material.
- Returns
A reference to this object.
-
MaterialKit &UnsetGloss()
Removes the gloss setting applied to this material.
- Returns
A reference to this object.
-
MaterialKit &UnsetLegacyShader()
Internal use only - customers should not use. Removes any legacy shader applied to this material.
- Returns
A reference to this object.
-
MaterialKit &UnsetMirror()
Removes all settings applied to the mirror channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetSpecular()
Removes all settings applied to the specular channel.
- Returns
A reference to this object.
-
MaterialKit &UnsetTransmission()
Removes all settings applied to the transmission channel.
- Returns
A reference to this object.
-
~MaterialKit()
Destroy this kit.
Public Static Attributes
-
static const HPS::Type staticType = HPS::Type::MaterialKit
-
virtual bool Empty() const