## MQMaterial class

MQMaterial has a coloring information such as shading or a texture mapping.

### Property

get | set | Type | Name | Description
--- | --- | --- | --- | ---
x | x | string | name | material's name
x |  | long | id | unique ID of material
x | x | MQColor | color | base color
x | x | float | alpha | alpha value
x | x | float | diffuse | diffuse
x | x | float | ambient | ambient (monochrome)
x | x | MQColor | ambientColor | ambient
x | x | float | emissive | emissive
x | x | float | specular | specular (monochrome)
x | x | MQColor | specularColor | specular
x | x | float | power | power of specular
x | x | float | reflection | reflection
x | x | float | refraction | refraction
x | x | int | shader | shader type
[0] | Classic
[1] | Constant
[2] | Lambert
[3] | Phong
[4] | Blinn
[5] | HLSL
x |  | string | shaderName | shader's name
x | x | string | shaderFilename | shader's filename
x |  | MQShaderNode | shaderNode | shader node
[None] | Not HLSL or invalid shaderFilename
[MQShaderNode] | HLSL and valid shaderFilename
x |  | dictionary | subshaderNodes | sub shader nodes
[None] | Not HLSL or invalid shaderFilename
[dictionary{string : MQShaderNode}] | Dictionary for 'sub shader node ID' and 'shader node'
x | x | int | vertexColor | vertex color
[0] | None
[1] | Enable
x | x | int | doubleSided | Show as double sided faces
[0] | Single
[1] | Double
x | x | int | mapType | mapping type
[0] | UV mapping
[1] | Flat mapping
[2] | Cylinder mapping
[3] | Sphere mapping
x | x | MQPoint | mapScaling | mapping scaling
x | x | MQAngle | mapAngle | mapping angle
x | x | MQPoint | mapPosition | mapping position
x | x | string | textureMap | filename of texture mapping
x | x | string | alphaMap | filename of alpha mapping
x | x | string | bumpMap | filename of bump mapping
x | x | int | textureUVChannel | UV channel ID of texture mapping
[0] | Default UV channel
[!= 0] | An ID that is generated and got by MQDocument.getUVChannelID()
x | x | int | alphaUVChannel | UV channel ID of alpha mapping
x | x | int | bumpUVChannel | UV channel ID of bump mapping
x | x | int | wrapU | Border wrapping method for U coordinates of mappings
[0] | Repeat
[1] | Mirror
[2] | Clamp
x | x | int | wrapV | Border wrapping method for V coordinates of mappings
[0] | Repeat
[1] | Mirror
[2] | Clamp
x | x | int | filter | Filtering for mapping images
[0] | Nearest interpolation
[1] | Bilinear interpolation

### Method

Member | Description
--- | ---
clone | Duplicate a material.
getTextureMapPath | Get a path of the texture mapping file.
getAlphaMapPath | Get a path of the alpha mapping file.
getBumpMapPath | Get a path of the bump mapping file.
allocUserData | Allocate a memory area for an user data in the material.
freeUserData | Free an allocated memory area for an user data.
getUserDataInt | Get an integer value (4 bytes) from the material user data.
getUserDataFloat | Get a float value (4 bytes) from the material user data.
getUserDataString | Get a string from the material user data.
setUserDataInt | Set an integer value (4 bytes) from the material user data.
setUserDataFloat | Set a float value (4 bytes) from the material user data.
setUserDataString | Set a string from the material user data.

clone
Duplicate a material.
  Return value:
  MQMaterial | - | clone material

getTextureMapPath
Get a path of the texture mapping file.
  Return value:
  string | - | path of texture mapping file [None] Invalid path
Notes: The material that isn't added to a document returns 'None' always.

getAlphaMapPath
Get a path of the alpha mapping file.
  Return value:
  string | - | path of alpha mapping file [None] Invalid path
Notes: The material that isn't added to a document returns 'None' always.

getBumpMapPath
Get a path of the bump mapping file.
  Return value:
  string | - | path of bump mapping file [None] Invalid path
Notes: The material that isn't added to a document returns 'None' always.

allocUserData(userdata_id)
Allocate a memory area for an user data in the material.
  Parameters:
  int | userdata_id | - | A material user data
  Return value:
  int | - | Result [0] failed [1] succeeded

freeUserData(userdata_id)
Free an allocated memory area for an user data.
  Parameters:
  int | userdata_id | - | A material user data

getUserDataInt(userdata_id, offset)
Get an integer value (4 bytes) from the material user data.
  Parameters:
  int | userdata_id | - | A material user data
  int | offset | - | An offset from a head of an user data
  Return value:
  int | - | value [None] Failed

getUserDataFloat(userdata_id, offset)
Get a float value (4 bytes) from the material user data.
  Parameters:
  int | userdata_id | - | A material user data
  int | offset | - | An offset from a head of an user data
  Return value:
  float | - | value [None] Failed

getUserDataString(userdata_id, offset, length)
Get a string from the material user data.
  Parameters:
  int | userdata_id | - | A material user data
  int | offset | - | An offset from a head of an user data
  int | length | - | data length (maximum length of string in bytes)
  Return value:
  string | - | value [None] Failed

setUserDataInt(userdata_id, offset, value)
Set an integer value (4 bytes) from the material user data.
  Parameters:
  int | userdata_id | - | A material user data
  int | offset | - | An offset from a head of an user data
  int | value | - | value

setUserDataFloat(userdata_id, offset, value)
Set a float value (4 bytes) from the material user data.
  Parameters:
  int | userdata_id | - | A material user data
  int | offset | - | An offset from a head of an user data
  float | value | - | value

setUserDataString(userdata_id, offset, length, value)
Set a string from the material user data.
  Parameters:
  int | userdata_id | - | A material user data
  int | offset | - | An offset from a head of an user data
  int | length | - | data length (maximum length of string in bytes)
  string | value | - | value