GeometryAttributes.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import defaultValue from "./defaultValue.js";
  2. /**
  3. * Attributes, which make up a geometry's vertices. Each property in this object corresponds to a
  4. * {@link GeometryAttribute} containing the attribute's data.
  5. * <p>
  6. * Attributes are always stored non-interleaved in a Geometry.
  7. * </p>
  8. *
  9. * @alias GeometryAttributes
  10. * @constructor
  11. */
  12. function GeometryAttributes(options) {
  13. options = defaultValue(options, defaultValue.EMPTY_OBJECT);
  14. /**
  15. * The 3D position attribute.
  16. * <p>
  17. * 64-bit floating-point (for precision). 3 components per attribute.
  18. * </p>
  19. *
  20. * @type GeometryAttribute
  21. *
  22. * @default undefined
  23. */
  24. this.position = options.position;
  25. /**
  26. * The normal attribute (normalized), which is commonly used for lighting.
  27. * <p>
  28. * 32-bit floating-point. 3 components per attribute.
  29. * </p>
  30. *
  31. * @type GeometryAttribute
  32. *
  33. * @default undefined
  34. */
  35. this.normal = options.normal;
  36. /**
  37. * The 2D texture coordinate attribute.
  38. * <p>
  39. * 32-bit floating-point. 2 components per attribute
  40. * </p>
  41. *
  42. * @type GeometryAttribute
  43. *
  44. * @default undefined
  45. */
  46. this.st = options.st;
  47. /**
  48. * The bitangent attribute (normalized), which is used for tangent-space effects like bump mapping.
  49. * <p>
  50. * 32-bit floating-point. 3 components per attribute.
  51. * </p>
  52. *
  53. * @type GeometryAttribute
  54. *
  55. * @default undefined
  56. */
  57. this.bitangent = options.bitangent;
  58. /**
  59. * The tangent attribute (normalized), which is used for tangent-space effects like bump mapping.
  60. * <p>
  61. * 32-bit floating-point. 3 components per attribute.
  62. * </p>
  63. *
  64. * @type GeometryAttribute
  65. *
  66. * @default undefined
  67. */
  68. this.tangent = options.tangent;
  69. /**
  70. * The color attribute.
  71. * <p>
  72. * 8-bit unsigned integer. 4 components per attribute.
  73. * </p>
  74. *
  75. * @type GeometryAttribute
  76. *
  77. * @default undefined
  78. */
  79. this.color = options.color;
  80. }
  81. export default GeometryAttributes;