Class MaterialContent
- Assembly
- MonoGame.Framework.Content.Pipeline.dll
Provides methods and properties for maintaining a collection of named texture references.
public class MaterialContent : ContentItem
- Inheritance
-
MaterialContent
- Derived
- Inherited Members
Remarks
In addition to texture references, opaque data values are stored in the OpaqueData property of the base class.
Properties
Textures
Gets the texture collection of the material.
public TextureReferenceDictionary Textures { get; }
Property Value
- TextureReferenceDictionary
Collection of textures used by the material.
Methods
Clone()
Helper method to make a copy of a material.
public MaterialContent Clone()
Returns
- MaterialContent
A clone of the material.
GetReferenceTypeProperty<T>(string)
Gets a reference type from the OpaqueDataDictionary collection.
protected T? GetReferenceTypeProperty<T>(string key) where T : class
Parameters
keystringKey of the property being retrieved.
Returns
- T
The related opaque data.
Type Parameters
TType of the related opaque data.
GetTexture(string)
Gets a value from the Textures collection.
protected ExternalReference<TextureContent>? GetTexture(string key)
Parameters
keystringKey of the texture being retrieved.
Returns
- ExternalReference<TextureContent>
Reference to a texture from the collection.
GetValueTypeProperty<T>(string)
Gets a value type from the OpaqueDataDictionary collection.
protected T? GetValueTypeProperty<T>(string key) where T : struct
Parameters
keystringKey of the value type being retrieved.
Returns
- T?
Index of the value type beng retrieved.
Type Parameters
TType of the value being retrieved.
SetProperty<T>(string, T?)
Sets a value in the contained OpaqueDataDictionary object. If null is passed, the value is removed.
protected void SetProperty<T>(string key, T? value)
Parameters
keystringName of the key being modified.
valueTValue being set.
Type Parameters
TType of the element being set.
SetTexture(string, ExternalReference<TextureContent>?)
Sets a value in the contained TextureReferenceDictionary object. If null is passed, the value is removed.
protected void SetTexture(string key, ExternalReference<TextureContent>? value)
Parameters
keystringName of the key being modified.
valueExternalReference<TextureContent>Value being set.
Remarks
The key value differs depending on the type of attached dictionary. If attached to a BasicMaterialContent dictionary (which becomes a BasicEffect object at run time), the value for the Texture key is used as the texture for the BasicEffect runtime object. Other keys are ignored. If attached to a EffectMaterialContent dictionary, key names are the texture names used by the effect. These names are dependent upon the author of the effect object.