/src/away3d/materials/utils/ShaderRegisterElement.as

http://github.com/away3d/away3d-core-fp11 · ActionScript · 60 lines · 34 code · 5 blank · 21 comment · 1 complexity · df2d7264374b21e5e4ab80b90efd47f7 MD5 · raw file

  1. package away3d.materials.utils
  2. {
  3. /**
  4. * A single register element (an entire register or a single register's component) used by the RegisterPool.
  5. */
  6. public class ShaderRegisterElement
  7. {
  8. private var _regName : String;
  9. private var _index : int;
  10. private var _component : String;
  11. /**
  12. * Creates a new ShaderRegisterElement object.
  13. * @param regName The name of the register.
  14. * @param index The index of the register.
  15. * @param component The register's component, if not the entire register is represented.
  16. */
  17. public function ShaderRegisterElement(regName : String, index : int, component : String = null)
  18. {
  19. _regName = regName;
  20. _index = index;
  21. _component = component;
  22. }
  23. /**
  24. * Converts the register or the components AGAL string representation.
  25. */
  26. public function toString() : String
  27. {
  28. if (_index >= 0)
  29. return _regName + _index + (_component? "."+_component : "");
  30. else
  31. return _regName + (_component? "."+_component : "");
  32. }
  33. /**
  34. * The register's name.
  35. */
  36. public function get regName() : String
  37. {
  38. return _regName;
  39. }
  40. /**
  41. * The register's index.
  42. */
  43. public function get index() : int
  44. {
  45. return _index;
  46. }
  47. /**
  48. * The register's component, if not the entire register is represented.
  49. */
  50. public function get component() : String
  51. {
  52. return _component;
  53. }
  54. }
  55. }