IMaterial
A Material object. It represents a game material, similarly to how a .vmt file does.
It can be created with Material or CreateMaterial.
Methods
Returns the color of the specified pixel of the $basetexture, only works for materials created from PNG files.
Basically identical to ITexture:GetColor used on IMaterial:GetTexture( "$basetexture" ).
Returns the specified material value as a float, or nil if the value is not set.
Returns the specified material value as a int, rounds the value if its a float, or nil if the value is not set.
Please note that certain material flags such as $model are stored in the $flags variable and cannot be directly retrieved with this function. See the full list here: Material Flags
table IMaterial:GetKeyValues()
Gets all the key values defined for the material.
Returns the specified material matrix as a int, or nil if the value is not set or is not a matrix.
Returns the name of the materials shader.
This function does not work serverside on Linux SRCDS. Issue Tracker: 3256
Returns the specified material string, or nil if the value is not set or if the value can not be converted to a string.
Returns an ITexture based on the passed shader parameter.
Returns the specified material vector, or nil if the value is not set.
See also IMaterial:GetVectorLinear
Returns the specified material vector as a 4 component vector.
Returns the specified material linear color vector, or nil if the value is not set.
See https://en. wikipedia. org/wiki/Gamma_correction
See also IMaterial:GetVector
Returns whenever the material is valid, i. e. whether it was not loaded successfully from disk or not.
IMaterial:Recompute()
Recomputes the material's snapshot. This needs to be called if you have changed variables on your material and it isn't changing.
Be careful though - this function is slow - so try to call it only when needed!
IMaterial:SetDynamicImage( string path )
Changes the Material into the give Image.
This is used internally - although you're able to use it you probably shouldn't.
This is used by the Background to change the Image.
Sets the specified material float to the specified float, does nothing on a type mismatch.
Sets the specified material value to the specified int, does nothing on a type mismatch.
Please note that certain material flags such as $model are stored in the $flags variable and cannot be directly set with this function. See the full list here: Material Flags
Sets the specified material value to the specified matrix, does nothing on a type mismatch.
We advise against using this. It may be changed or removed in a future update.
This function does nothing
The functionality of this function was removed due to the amount of crashes it caused.
Sets the specified material value to the specified string, does nothing on a type mismatch.
Sets the specified material texture to the specified texture, does nothing on a type mismatch.
IMaterial:SetUndefined( string materialValueName )
Unsets the value for the specified material value.
Sets the specified material vector to the specified vector, does nothing on a type mismatch.
Sets the specified material vector to the specified 4 component vector, does nothing on a type mismatch.