BufferGeometry.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * @author alteredq / http://alteredqualia.com/
  3. */
  4. THREE.BufferGeometry = function () {
  5. this.id = THREE.GeometryCount ++;
  6. // GL buffers
  7. this.vertexIndexBuffer = null;
  8. this.vertexPositionBuffer = null;
  9. this.vertexNormalBuffer = null;
  10. this.vertexUvBuffer = null;
  11. this.vertexColorBuffer = null;
  12. // typed arrays (kept only if dynamic flag is set)
  13. this.vertexIndexArray = null;
  14. this.vertexPositionArray = null;
  15. this.vertexNormalArray = null;
  16. this.vertexUvArray = null;
  17. this.vertexColorArray = null;
  18. this.dynamic = false;
  19. // boundings
  20. this.boundingBox = null;
  21. this.boundingSphere = null;
  22. // for compatibility
  23. this.morphTargets = [];
  24. };
  25. THREE.BufferGeometry.prototype = {
  26. constructor : THREE.BufferGeometry,
  27. applyMatrix: function ( matrix ) {
  28. if ( this.vertexPositionArray !== undefined ) {
  29. matrix.multiplyVector3Array( this.vertexPositionArray );
  30. this.verticesNeedUpdate = true;
  31. }
  32. if ( this.vertexNormalArray !== undefined ) {
  33. var matrixRotation = new THREE.Matrix4();
  34. matrixRotation.extractRotation( matrix );
  35. matrixRotation.multiplyVector3Array( this.vertexNormalArray );
  36. this.normalsNeedUpdate = true;
  37. }
  38. },
  39. // for compatibility
  40. computeBoundingBox: function () {
  41. },
  42. // for compatibility
  43. computeBoundingSphere: function () {
  44. }
  45. };