/home/lindsay/xeolabs/xeogl-next/xeogl/src/materials/material.js
API Docs for:

File: /home/lindsay/xeolabs/xeogl-next/xeogl/src/materials/material.js

  1. /**
  2. A **Material** defines the surface appearance of attached {{#crossLink "Mesh"}}Meshes{{/crossLink}}.
  3.  
  4. Material is the base class for:
  5.  
  6. * {{#crossLink "MetallicMaterial"}}{{/crossLink}} - physically-based material for metallic surfaces. Use this one for things made of metal.
  7. * {{#crossLink "SpecularMaterial"}}{{/crossLink}} - physically-based material for non-metallic (dielectric)
  8. surfaces. Use this one for insulators, such as ceramics, plastics, wood etc.
  9. * {{#crossLink "PhongMaterial"}}{{/crossLink}} - material for classic Blinn-Phong shading. This is less demanding of graphics hardware than the physically-based materials.
  10. * {{#crossLink "LambertMaterial"}}{{/crossLink}} - material for fast, flat-shaded CAD rendering without textures. Use
  11. this for navigating huge CAD or BIM models interactively. This material gives the best rendering performance and uses the least memory.
  12. * {{#crossLink "EmphasisMaterial"}}{{/crossLink}} - defines the appearance of Meshes when "ghosted" or "highlighted".
  13. * {{#crossLink "EdgeMaterial"}}{{/crossLink}} - defines the appearance of Meshes when edges are emphasized.
  14. * {{#crossLink "OutlineMaterial"}}{{/crossLink}} - defines the appearance of outlines drawn around Meshes.
  15.  
  16. A {{#crossLink "Scene"}}Scene{{/crossLink}} is allowed to contain a mixture of these material types.
  17.  
  18. @class Material
  19. @module xeogl
  20. @submodule materials
  21. @constructor
  22. @extends Component
  23. */
  24. import {Component} from '../component.js';
  25. import {stats} from './../stats.js';
  26. import {componentClasses} from "./../componentClasses.js";
  27.  
  28. const type = "xeogl.Material";
  29.  
  30. class Material extends Component{
  31.  
  32. /**
  33. JavaScript class name for this Component.
  34.  
  35. For example: "xeogl.AmbientLight", "xeogl.MetallicMaterial" etc.
  36.  
  37. @property type
  38. @type String
  39. @final
  40. */
  41. get type() {
  42. return type;
  43. }
  44.  
  45. init(cfg) {
  46. super.init(cfg);
  47. stats.memory.materials++;
  48. }
  49.  
  50. destroy() {
  51. super.destroy();
  52. stats.memory.materials--;
  53. }
  54. }
  55.  
  56. componentClasses[type] = Material;
  57.  
  58. export{Material};
  59.