vgl/materialAttribute.js

  1. var vgl = require('./vgl');
  2. var inherit = require('../inherit');
  3. vgl.materialAttributeType = {
  4. Undefined : 0x0,
  5. ShaderProgram : 0x1,
  6. Texture : 0x2,
  7. Blend : 0x3,
  8. Depth : 0x4
  9. };
  10. /**
  11. * Create a new instance of class materialAttribute.
  12. *
  13. * @class
  14. * @alias vgl.materialAttribute
  15. * @param {number} type
  16. * @returns {vgl.materialAttribute}
  17. */
  18. vgl.materialAttribute = function (type) {
  19. 'use strict';
  20. if (!(this instanceof vgl.materialAttribute)) {
  21. return new vgl.materialAttribute(type);
  22. }
  23. vgl.graphicsObject.call(this);
  24. /** @private */
  25. var m_this = this,
  26. m_type = type,
  27. m_enabled = true;
  28. /**
  29. * Return type of the material attribute.
  30. *
  31. * @returns {number}
  32. */
  33. this.type = function () {
  34. return m_type;
  35. };
  36. /**
  37. * Return if material attribute is enabled or not.
  38. *
  39. * @returns {boolean}
  40. */
  41. this.enabled = function () {
  42. return m_enabled;
  43. };
  44. /**
  45. * Bind and activate vertex specific data.
  46. *
  47. * @param {vgl.renderState} renderState
  48. * @param {string} key
  49. * @returns {boolean}
  50. */
  51. this.bindVertexData = function (renderState, key) {
  52. return false;
  53. };
  54. /**
  55. * Undo bind and deactivate vertex specific data.
  56. *
  57. * @param {vgl.renderState} renderState
  58. * @param {string} key
  59. * @returns {boolean}
  60. */
  61. this.undoBindVertexData = function (renderState, key) {
  62. return false;
  63. };
  64. return m_this;
  65. };
  66. inherit(vgl.materialAttribute, vgl.graphicsObject);