babylon.modelRenderCache.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. var BABYLON;
  7. (function (BABYLON) {
  8. var GroupInstanceInfo = (function () {
  9. function GroupInstanceInfo(owner, classTreeInfo, cache) {
  10. this._owner = owner;
  11. this._classTreeInfo = classTreeInfo;
  12. this._modelCache = cache;
  13. }
  14. return GroupInstanceInfo;
  15. }());
  16. BABYLON.GroupInstanceInfo = GroupInstanceInfo;
  17. var ModelRenderCacheBase = (function () {
  18. function ModelRenderCacheBase() {
  19. }
  20. /**
  21. * Render the model instances
  22. * @param instanceInfo
  23. * @param context
  24. * @return must return true is the rendering succeed, false if the rendering couldn't be done (asset's not yet ready, like Effect)
  25. */
  26. ModelRenderCacheBase.prototype.render = function (instanceInfo, context) {
  27. return true;
  28. };
  29. return ModelRenderCacheBase;
  30. }());
  31. BABYLON.ModelRenderCacheBase = ModelRenderCacheBase;
  32. var ModelRenderCache = (function (_super) {
  33. __extends(ModelRenderCache, _super);
  34. function ModelRenderCache() {
  35. _super.call(this);
  36. this._nextKey = 1;
  37. this._instancesData = new BABYLON.StringDictionary();
  38. }
  39. ModelRenderCache.prototype.addInstanceData = function (data) {
  40. var key = this._nextKey.toString();
  41. if (!this._instancesData.add(key, data)) {
  42. throw Error("Key: " + key + " is already allocated");
  43. }
  44. ++this._nextKey;
  45. return key;
  46. };
  47. ModelRenderCache.prototype.removeInstanceData = function (key) {
  48. this._instancesData.remove(key);
  49. };
  50. return ModelRenderCache;
  51. }(ModelRenderCacheBase));
  52. BABYLON.ModelRenderCache = ModelRenderCache;
  53. })(BABYLON || (BABYLON = {}));
  54. //# sourceMappingURL=babylon.modelRenderCache.js.map