material.enable_render

If this flag is set, the material's event function is executed at the beginning of every entity rendering, if the material contains an effect and was assigned to the entity. This can be used to perform effect calculations based on entity skills or the entity's world matrix.

Range:

on - material event function will executed at the beginning of every entity rendering
off - material event function will executed once per entity.

Type:

Flag

Edition

 C   P 

Remarks:

Example:

// generate a matrix that transforms camera space back to world space
function mtl_env_view()
{
  mat_set(mtl.matrix,matViewInv);
  // reset the translation part of the matrix
  mtl.matrix41 = 0; // 0 == float(0)
  mtl.matrix42 = 0;
  mtl.matrix43 = 0;
  return(0); // render the entity
}

function mtl_env_init()
{
  bmap_to_cubemap(mtl.skin1);
  mtl.event = mtl_env_view;
  mtl.enable_render = on; // run the event at the beginning of every entity rendering
}

material mtl_envcube // environment cube
{
  skin1 = bmp_envcube;
  event = mtl_env_init;
  ...
}

See also:

material.event, material.matrix