Class MaterialProperty
A key-value pairing that represents some material property.
Implements
Inherited Members
Namespace: SharpAssimp
Assembly: SharpAssimp.dll
Syntax
public sealed class MaterialProperty : IMarshalable<MaterialProperty, AiMaterialProperty>
Constructors
| Edit this page View SourceMaterialProperty()
Constructs a new instance of the MaterialProperty class.
Declaration
public MaterialProperty()
MaterialProperty(string, bool)
Constructs a new instance of the MaterialProperty class. Constructs a boolean property.
Declaration
public MaterialProperty(string baseName, bool value)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Name of the property |
bool | value | Property value |
MaterialProperty(string, byte[])
Constructs a new instance of the MaterialProperty class. Constructs a buffer property.
Declaration
public MaterialProperty(string baseName, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
byte[] | buffer | Property value |
MaterialProperty(string, int)
Constructs a new instance of the MaterialProperty class. Constructs an integer property.
Declaration
public MaterialProperty(string baseName, int value)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
int | value | Property value |
MaterialProperty(string, int[])
Constructs a new instance of the MaterialProperty class. Creates a int array property.
Declaration
public MaterialProperty(string baseName, int[] values)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
int[] | values | Property values |
MaterialProperty(string, Vector3)
Constructs a new instance of the MaterialProperty class. Creates a Vector3 property.
Declaration
public MaterialProperty(string baseName, Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
Vector3 | value | Property value |
MaterialProperty(string, Vector4)
Constructs a new instance of the MaterialProperty class. Creates a Vector4 property.
Declaration
public MaterialProperty(string baseName, Vector4 value)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
Vector4 | value | Property value |
MaterialProperty(string, float)
Constructs a new instance of the MaterialProperty class. Constructs a float property.
Declaration
public MaterialProperty(string baseName, float value)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
float | value | Property value |
MaterialProperty(string, float[])
Constructs a new instance of the MaterialProperty class. Creates a float array property.
Declaration
public MaterialProperty(string baseName, float[] values)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
float[] | values | Property values |
MaterialProperty(string, string)
Constructs a new instance of the MaterialProperty class. Creates a string property.
Declaration
public MaterialProperty(string baseName, string value)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
string | value | Property value |
MaterialProperty(string, string, TextureType, int)
Constructs a new instance of the MaterialProperty class. Creates a texture property.
Declaration
public MaterialProperty(string baseName, string value, TextureType texType, int textureIndex)
Parameters
Type | Name | Description |
---|---|---|
string | baseName | Base name of the property |
string | value | Property value |
TextureType | texType | Texture type |
int | textureIndex | Texture index |
Properties
| Edit this page View SourceByteCount
Gets the raw byte data count.
Declaration
public int ByteCount { get; }
Property Value
Type | Description |
---|---|
int |
FullyQualifiedName
Gets the property's fully qualified name. Format: "{base name},{texture type semantic},{texture index}". E.g. "$clr.diffuse,0,0". This is the key that is used to index the property in the material property map.
Declaration
public string FullyQualifiedName { get; }
Property Value
Type | Description |
---|---|
string |
HasRawData
Checks if the property has data.
Declaration
public bool HasRawData { get; }
Property Value
Type | Description |
---|---|
bool |
Name
Gets or sets the property key name. E.g. $tex.file. This corresponds to the "AiMatKeys" base name constants.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
PropertyType
Gets or sets the type of property.
Declaration
public PropertyType PropertyType { get; set; }
Property Value
Type | Description |
---|---|
PropertyType |
RawData
Gets the raw byte data. To modify/read this data, see the Get/SetXXXValue methods.
Declaration
public byte[]? RawData { get; }
Property Value
Type | Description |
---|---|
byte[] |
TextureIndex
Gets or sets the texture index, for non-texture properties this is always zero.
Declaration
public int TextureIndex { get; set; }
Property Value
Type | Description |
---|---|
int |
TextureType
Gets or sets the texture type semantic, for non-texture properties this is always None.
Declaration
public TextureType TextureType { get; set; }
Property Value
Type | Description |
---|---|
TextureType |
Methods
| Edit this page View SourceFreeNative(nint, bool)
Frees unmanaged memory created by ToNative(nint, out Native).
Declaration
public static void FreeNative(nint nativeValue, bool freeNative)
Parameters
Type | Name | Description |
---|---|---|
nint | nativeValue | Native value to free |
bool | freeNative | True if the unmanaged memory should be freed, false otherwise. |
GetBooleanValue()
Gets the property raw data as a boolean.
Declaration
public bool GetBooleanValue()
Returns
Type | Description |
---|---|
bool | Boolean |
GetDoubleArrayValue()
Gets the property raw data as a double array.
Declaration
public double[]? GetDoubleArrayValue()
Returns
Type | Description |
---|---|
double[] | Double array |
GetDoubleValue()
Gets the property raw data as a double.
Declaration
public double GetDoubleValue()
Returns
Type | Description |
---|---|
double | Double |
GetFloatArrayValue()
Gets the property raw data as a float array.
Declaration
public float[]? GetFloatArrayValue()
Returns
Type | Description |
---|---|
float[] | Float array |
GetFloatArrayValue(int)
Gets the property raw data as a float array.
Declaration
public float[]? GetFloatArrayValue(int count)
Parameters
Type | Name | Description |
---|---|---|
int | count | Number of elements to get |
Returns
Type | Description |
---|---|
float[] | Float array |
GetFloatValue()
Gets the property raw data as a float.
Declaration
public float GetFloatValue()
Returns
Type | Description |
---|---|
float | Float |
GetIntegerArrayValue()
Gets the property raw data as an integer array.
Declaration
public int[]? GetIntegerArrayValue()
Returns
Type | Description |
---|---|
int[] | Integer array |
GetIntegerArrayValue(int)
Gets the property raw data as an integer array.
Declaration
public int[]? GetIntegerArrayValue(int count)
Parameters
Type | Name | Description |
---|---|---|
int | count | Number of elements to get |
Returns
Type | Description |
---|---|
int[] | Integer array |
GetIntegerValue()
Gets the property raw data as an integer.
Declaration
public int GetIntegerValue()
Returns
Type | Description |
---|---|
int | Integer |
GetStringValue()
Gets the property raw data as a string.
Declaration
public string? GetStringValue()
Returns
Type | Description |
---|---|
string | String |
GetVector3Value()
Gets the property raw data as a Vector3.
Declaration
public Vector3 GetVector3Value()
Returns
Type | Description |
---|---|
Vector3 | Vector3 |
GetVector4Value()
Gets the property raw data as a Vector4.
Declaration
public Vector4 GetVector4Value()
Returns
Type | Description |
---|---|
Vector4 | Vector4 |
SetBooleanValue(bool)
Sets the property raw data as a boolean.
Declaration
public bool SetBooleanValue(bool value)
Parameters
Type | Name | Description |
---|---|---|
bool | value | Boolean value |
Returns
Type | Description |
---|---|
bool | True if successful, false otherwise |
SetDoubleArrayValue(double[])
Sets the property raw data as a double array.
Declaration
public bool SetDoubleArrayValue(double[] values)
Parameters
Type | Name | Description |
---|---|---|
double[] | values | Values to set |
Returns
Type | Description |
---|---|
bool | True if successful, otherwise false |
SetDoubleValue(double)
Sets the property raw data with a double.
Declaration
public bool SetDoubleValue(double value)
Parameters
Type | Name | Description |
---|---|---|
double | value | Double. |
Returns
Type | Description |
---|---|
bool | True if successful, false otherwise. |
SetFloatArrayValue(float[])
Sets the property raw data as a float array.
Declaration
public bool SetFloatArrayValue(float[] values)
Parameters
Type | Name | Description |
---|---|---|
float[] | values | Values to set |
Returns
Type | Description |
---|---|
bool | True if successful, otherwise false |
SetFloatValue(float)
Sets the property raw data with a float.
Declaration
public bool SetFloatValue(float value)
Parameters
Type | Name | Description |
---|---|---|
float | value | Float. |
Returns
Type | Description |
---|---|
bool | True if successful, false otherwise |
SetIntegerArrayValue(int[])
Sets the property raw data as an integer array.
Declaration
public bool SetIntegerArrayValue(int[] values)
Parameters
Type | Name | Description |
---|---|---|
int[] | values | Values to set |
Returns
Type | Description |
---|---|
bool | True if successful, otherwise false |
SetIntegerValue(int)
Sets the property raw data as an integer.
Declaration
public bool SetIntegerValue(int value)
Parameters
Type | Name | Description |
---|---|---|
int | value | Integer |
Returns
Type | Description |
---|---|
bool | True if successful, false otherwise |
SetStringValue(string)
Sets the property raw data as string.
Declaration
public bool SetStringValue(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | String |
Returns
Type | Description |
---|---|
bool | True if successful, false otherwise |
SetVector3Value(Vector3)
Sets the property raw data as a Vector3.
Declaration
public bool SetVector3Value(Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | Vector3 |
Returns
Type | Description |
---|---|
bool | True if successful, false otherwise |
SetVector4Value(Vector4)
Sets the property raw data as a Vector4.
Declaration
public bool SetVector4Value(Vector4 value)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | value | Vector4 |
Returns
Type | Description |
---|---|
bool | True if successful, false otherwise |