# Class: material

To allow more complex surface detail than just simple textures, materials can be used to have more control over the surface. Every material consists of a shader which defines how textures are blend, and textures or color definitions.
See the mtlscript manual for more details.

## Hierarchy

    o-+ resource
      o-+ material

## Interfaces:

- matobject
- matsurface

## Methods:

### Method overview:

- annotation
- defaultpath
- getalphatex
- getcontrol
- getrestype
- getshader
- getshdcontrol
- gettexcontrol
- load
- name

annotation (material, string name)
  returns: ([string])
  searches and returns annotation string
defaultpath ([string])
  returns: ([string])
  returns or sets the default resource path. Luxinia will search in those when resources are not found.
getalphatex (material,[int sid])
  returns: ([texture,comparemode,float ref,int texchannel])
  returns texture and alphatesting info if the shader supports it (alphaTEX defined).
getcontrol (material,string name)
  returns: ([matcontrolid])
  returns matcontrolid, if found.
getrestype ()
  returns: (int restype)
  returns the resource type as int value, useful for resdata or reschunk functions
getshader (material,[int sid])
  returns: (Shader)
  returns a shader, optional shader id can be given, defaults to 0
getshdcontrol (material,string name)
  returns: ([matshdcontrolid])
  returns matshdcontrolid, if found.
gettexcontrol (material,string name)
  returns: ([mattexcontrolid])
  returns mattexcontrolid, if found.
load (string filename,[compilerargs])
  returns: (Material mtl)
  loads a material. Optionally can pass compilerstrings, eg. "-DSOMETHING;". You can create a simple material with a special filename when it starts with 'MATERIAL_AUTO:'. What follows in the string should be a pipe '|' separated list of .shd or texture filenames that make the shader/texture stages. Their ids are linearly generated. For textures you can put the special texturetype before, as defined in mtl-format.
  For example: "MATERIAL_AUTO:myshader.shd|mytexture.jpg|TEXDOTZ anothertex.tga" generates a simple material using the given shader and the 2 textures from which one is a special texture.
name (material)
  returns: (string)
  returns the name of the loaded material.

## Inherited Methods:

### From resource

condition, getresname, getresshortname, resuserstring