# 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:

- hashid
- matobject
- matsurface

## Methods:

### Method overview:

- defaultpath
- getalphatex
- getcontrol
- getrestype
- getshader
- load
- name

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
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
load (string filename)
  returns: (Material mtl)
  loads a material. 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