ModelInstance.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import defineProperties from '../Core/defineProperties.js';
  2. import Matrix4 from '../Core/Matrix4.js';
  3. /**
  4. * @private
  5. */
  6. function ModelInstance(collection, modelMatrix, instanceId) {
  7. this.primitive = collection;
  8. this._modelMatrix = Matrix4.clone(modelMatrix);
  9. this._instanceId = instanceId;
  10. }
  11. defineProperties(ModelInstance.prototype, {
  12. instanceId : {
  13. get : function() {
  14. return this._instanceId;
  15. }
  16. },
  17. model : {
  18. get : function() {
  19. return this.primitive._model;
  20. }
  21. },
  22. modelMatrix : {
  23. get : function() {
  24. return Matrix4.clone(this._modelMatrix);
  25. },
  26. set : function(value) {
  27. Matrix4.clone(value, this._modelMatrix);
  28. this.primitive.expandBoundingSphere(this._modelMatrix);
  29. this.primitive._dirty = true;
  30. }
  31. }
  32. });
  33. export default ModelInstance;