babylon.smartPropertyPrim.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6. };
  7. var BABYLON;
  8. (function (BABYLON) {
  9. var Prim2DClassInfo = (function () {
  10. function Prim2DClassInfo() {
  11. }
  12. return Prim2DClassInfo;
  13. }());
  14. BABYLON.Prim2DClassInfo = Prim2DClassInfo;
  15. var Prim2DPropInfo = (function () {
  16. function Prim2DPropInfo() {
  17. }
  18. Prim2DPropInfo.PROPKIND_MODEL = 1;
  19. Prim2DPropInfo.PROPKIND_INSTANCE = 2;
  20. Prim2DPropInfo.PROPKIND_DYNAMIC = 3;
  21. return Prim2DPropInfo;
  22. }());
  23. BABYLON.Prim2DPropInfo = Prim2DPropInfo;
  24. /**
  25. * Custom type of the propertyChanged observable
  26. */
  27. var PropertyChangedInfo = (function () {
  28. function PropertyChangedInfo() {
  29. }
  30. return PropertyChangedInfo;
  31. }());
  32. BABYLON.PropertyChangedInfo = PropertyChangedInfo;
  33. var ClassTreeInfo = (function () {
  34. function ClassTreeInfo(baseClass, type, classContentFactory) {
  35. this._baseClass = baseClass;
  36. this._type = type;
  37. this._subClasses = new Array();
  38. this._levelContent = new BABYLON.StringDictionary();
  39. this._classContentFactory = classContentFactory;
  40. }
  41. Object.defineProperty(ClassTreeInfo.prototype, "classContent", {
  42. get: function () {
  43. if (!this._classContent) {
  44. this._classContent = this._classContentFactory(this._baseClass ? this._baseClass.classContent : null);
  45. }
  46. return this._classContent;
  47. },
  48. enumerable: true,
  49. configurable: true
  50. });
  51. Object.defineProperty(ClassTreeInfo.prototype, "type", {
  52. get: function () {
  53. return this._type;
  54. },
  55. enumerable: true,
  56. configurable: true
  57. });
  58. Object.defineProperty(ClassTreeInfo.prototype, "levelContent", {
  59. get: function () {
  60. return this._levelContent;
  61. },
  62. enumerable: true,
  63. configurable: true
  64. });
  65. Object.defineProperty(ClassTreeInfo.prototype, "fullContent", {
  66. get: function () {
  67. if (!this._fullContent) {
  68. var dic_1 = new BABYLON.StringDictionary();
  69. var curLevel = this;
  70. while (curLevel) {
  71. curLevel.levelContent.forEach(function (k, v) { return dic_1.add(k, v); });
  72. curLevel = curLevel._baseClass;
  73. }
  74. this._fullContent = dic_1;
  75. }
  76. return this._fullContent;
  77. },
  78. enumerable: true,
  79. configurable: true
  80. });
  81. ClassTreeInfo.prototype.getLevelOf = function (type) {
  82. // Are we already there?
  83. if (type === this._type) {
  84. return this;
  85. }
  86. var baseProto = Object.getPrototypeOf(type);
  87. var curProtoContent = this.getOrAddType(Object.getPrototypeOf(baseProto), baseProto);
  88. if (!curProtoContent) {
  89. this.getLevelOf(baseProto);
  90. }
  91. return this.getOrAddType(baseProto, type);
  92. };
  93. ClassTreeInfo.prototype.getOrAddType = function (baseType, type) {
  94. // Are we at the level corresponding to the baseType?
  95. // If so, get or add the level we're looking for
  96. if (baseType === this._type) {
  97. for (var _i = 0, _a = this._subClasses; _i < _a.length; _i++) {
  98. var subType = _a[_i];
  99. if (subType.type === type) {
  100. return subType.node;
  101. }
  102. }
  103. var node = new ClassTreeInfo(this, type, this._classContentFactory);
  104. var info = { type: type, node: node };
  105. this._subClasses.push(info);
  106. return info.node;
  107. }
  108. // Recurse down to keep looking for the node corresponding to the baseTypeName
  109. for (var _b = 0, _c = this._subClasses; _b < _c.length; _b++) {
  110. var subType = _c[_b];
  111. var info = subType.node.getOrAddType(baseType, type);
  112. if (info) {
  113. return info;
  114. }
  115. }
  116. return null;
  117. };
  118. ClassTreeInfo.get = function (type) {
  119. var dic = type["__classTreeInfo"];
  120. if (!dic) {
  121. return null;
  122. }
  123. return dic.getLevelOf(type);
  124. };
  125. ClassTreeInfo.getOrRegister = function (type, classContentFactory) {
  126. var dic = type["__classTreeInfo"];
  127. if (!dic) {
  128. dic = new ClassTreeInfo(null, type, classContentFactory);
  129. type["__classTreeInfo"] = dic;
  130. }
  131. return dic;
  132. };
  133. return ClassTreeInfo;
  134. }());
  135. BABYLON.ClassTreeInfo = ClassTreeInfo;
  136. var SmartPropertyPrim = (function () {
  137. function SmartPropertyPrim() {
  138. this._flags = 0;
  139. this._modelKey = null;
  140. this._instanceDirtyFlags = 0;
  141. this._levelBoundingInfo = new BABYLON.BoundingInfo2D();
  142. this.animations = new Array();
  143. }
  144. Object.defineProperty(SmartPropertyPrim.prototype, "isDisposed", {
  145. /**
  146. * Check if the object is disposed or not.
  147. * @returns true if the object is dispose, false otherwise.
  148. */
  149. get: function () {
  150. return this._isFlagSet(SmartPropertyPrim.flagIsDisposed);
  151. },
  152. enumerable: true,
  153. configurable: true
  154. });
  155. /**
  156. * Disposable pattern, this method must be overloaded by derived types in order to clean up hardware related resources.
  157. * @returns false if the object is already dispose, true otherwise. Your implementation must call super.dispose() and check for a false return and return immediately if it's the case.
  158. */
  159. SmartPropertyPrim.prototype.dispose = function () {
  160. if (this.isDisposed) {
  161. return false;
  162. }
  163. // Don't set to null, it may upset somebody...
  164. this.animations.splice(0);
  165. this._setFlags(SmartPropertyPrim.flagIsDisposed);
  166. return true;
  167. };
  168. /**
  169. * Returns as a new array populated with the Animatable used by the primitive. Must be overloaded by derived primitives.
  170. * Look at Sprite2D for more information
  171. */
  172. SmartPropertyPrim.prototype.getAnimatables = function () {
  173. return new Array();
  174. };
  175. Object.defineProperty(SmartPropertyPrim.prototype, "modelKey", {
  176. /**
  177. * Property giving the Model Key associated to the property.
  178. * This value is constructed from the type of the primitive and all the name/value of its properties declared with the modelLevelProperty decorator
  179. * @returns the model key string.
  180. */
  181. get: function () {
  182. var _this = this;
  183. // No need to compute it?
  184. if (!this._isFlagSet(SmartPropertyPrim.flagModelDirty) && this._modelKey) {
  185. return this._modelKey;
  186. }
  187. var modelKey = "Class:" + BABYLON.Tools.getClassName(this) + ";";
  188. var propDic = this.propDic;
  189. propDic.forEach(function (k, v) {
  190. if (v.kind === Prim2DPropInfo.PROPKIND_MODEL) {
  191. var propVal = _this[v.name];
  192. // Special case, array, this WON'T WORK IN ALL CASES, all entries have to be of the same type and it must be a BJS well known one
  193. if (propVal && propVal.constructor === Array) {
  194. var firstVal = propVal[0];
  195. if (!firstVal) {
  196. propVal = 0;
  197. }
  198. else {
  199. propVal = BABYLON.Tools.hashCodeFromStream(BABYLON.Tools.arrayOrStringFeeder(propVal));
  200. }
  201. }
  202. modelKey += v.name + ":" + ((propVal != null) ? ((v.typeLevelCompare) ? BABYLON.Tools.getClassName(propVal) : propVal.toString()) : "[null]") + ";";
  203. }
  204. });
  205. this._clearFlags(SmartPropertyPrim.flagModelDirty);
  206. this._modelKey = modelKey;
  207. return modelKey;
  208. },
  209. enumerable: true,
  210. configurable: true
  211. });
  212. Object.defineProperty(SmartPropertyPrim.prototype, "isDirty", {
  213. /**
  214. * States if the Primitive is dirty and should be rendered again next time.
  215. * @returns true is dirty, false otherwise
  216. */
  217. get: function () {
  218. return (this._instanceDirtyFlags !== 0) || this._areSomeFlagsSet(SmartPropertyPrim.flagModelDirty | SmartPropertyPrim.flagPositioningDirty | SmartPropertyPrim.flagLayoutDirty);
  219. },
  220. enumerable: true,
  221. configurable: true
  222. });
  223. Object.defineProperty(SmartPropertyPrim.prototype, "propDic", {
  224. /**
  225. * Access the dictionary of properties metadata. Only properties decorated with XXXXLevelProperty are concerned
  226. * @returns the dictionary, the key is the property name as declared in Javascript, the value is the metadata object
  227. */
  228. get: function () {
  229. if (!this._propInfo) {
  230. var cti = ClassTreeInfo.get(Object.getPrototypeOf(this));
  231. if (!cti) {
  232. throw new Error("Can't access the propDic member in class definition, is this class SmartPropertyPrim based?");
  233. }
  234. this._propInfo = cti.fullContent;
  235. }
  236. return this._propInfo;
  237. },
  238. enumerable: true,
  239. configurable: true
  240. });
  241. SmartPropertyPrim._createPropInfo = function (target, propName, propId, dirtyBoundingInfo, dirtyParentBoundingBox, typeLevelCompare, kind) {
  242. var dic = ClassTreeInfo.getOrRegister(target, function () { return new Prim2DClassInfo(); });
  243. var node = dic.getLevelOf(target);
  244. var propInfo = node.levelContent.get(propId.toString());
  245. if (propInfo) {
  246. throw new Error("The ID " + propId + " is already taken by another property declaration named: " + propInfo.name);
  247. }
  248. // Create, setup and add the PropInfo object to our prop dictionary
  249. propInfo = new Prim2DPropInfo();
  250. propInfo.id = propId;
  251. propInfo.flagId = Math.pow(2, propId);
  252. propInfo.kind = kind;
  253. propInfo.name = propName;
  254. propInfo.dirtyBoundingInfo = dirtyBoundingInfo;
  255. propInfo.dirtyParentBoundingInfo = dirtyParentBoundingBox;
  256. propInfo.typeLevelCompare = typeLevelCompare;
  257. node.levelContent.add(propName, propInfo);
  258. return propInfo;
  259. };
  260. SmartPropertyPrim._checkUnchanged = function (curValue, newValue) {
  261. // Nothing to nothing: nothing to do!
  262. if ((curValue === null && newValue === null) || (curValue === undefined && newValue === undefined)) {
  263. return true;
  264. }
  265. // Check value unchanged
  266. if ((curValue != null) && (newValue != null)) {
  267. if (typeof (curValue.equals) == "function") {
  268. if (curValue.equals(newValue)) {
  269. return true;
  270. }
  271. }
  272. else {
  273. if (curValue === newValue) {
  274. return true;
  275. }
  276. }
  277. }
  278. return false;
  279. };
  280. SmartPropertyPrim.prototype._triggerPropertyChanged = function (propInfo, newValue) {
  281. if (this.isDisposed) {
  282. return;
  283. }
  284. if (!propInfo) {
  285. return;
  286. }
  287. this._handlePropChanged(undefined, newValue, propInfo.name, propInfo, propInfo.typeLevelCompare);
  288. };
  289. SmartPropertyPrim.prototype._boundingBoxDirty = function () {
  290. this._setFlags(SmartPropertyPrim.flagLevelBoundingInfoDirty);
  291. // Escalate the dirty flag in the instance hierarchy, stop when a renderable group is found or at the end
  292. if (this instanceof BABYLON.Prim2DBase) {
  293. var curprim = this;
  294. while (curprim) {
  295. curprim._setFlags(SmartPropertyPrim.flagBoundingInfoDirty);
  296. if (curprim.isSizeAuto) {
  297. curprim.onPrimitivePropertyDirty(BABYLON.Prim2DBase.sizeProperty.flagId);
  298. curprim._setFlags(SmartPropertyPrim.flagPositioningDirty);
  299. }
  300. if (curprim instanceof BABYLON.Group2D) {
  301. if (curprim.isRenderableGroup) {
  302. break;
  303. }
  304. }
  305. curprim = curprim.parent;
  306. }
  307. }
  308. };
  309. SmartPropertyPrim.prototype._handlePropChanged = function (curValue, newValue, propName, propInfo, typeLevelCompare) {
  310. // If the property change also dirty the boundingInfo, update the boundingInfo dirty flags
  311. if (propInfo.dirtyBoundingInfo) {
  312. this._boundingBoxDirty();
  313. }
  314. else if (propInfo.dirtyParentBoundingInfo) {
  315. var p = this._parent;
  316. if (p != null) {
  317. p._boundingBoxDirty();
  318. }
  319. }
  320. // Trigger property changed
  321. var info = SmartPropertyPrim.propChangedInfo;
  322. info.oldValue = curValue;
  323. info.newValue = newValue;
  324. info.propertyName = propName;
  325. var propMask = propInfo.flagId;
  326. this.propertyChanged.notifyObservers(info, propMask);
  327. // If the property belong to a group, check if it's a cached one, and dirty its render sprite accordingly
  328. if (this instanceof BABYLON.Group2D) {
  329. this.handleGroupChanged(propInfo);
  330. }
  331. // Check for parent layout dirty
  332. if (this instanceof BABYLON.Prim2DBase) {
  333. var p = this._parent;
  334. if (p != null && p.layoutEngine && (p.layoutEngine.layoutDirtyOnPropertyChangedMask & propInfo.flagId) !== 0) {
  335. p._setLayoutDirty();
  336. }
  337. }
  338. // For type level compare, if there's a change of type it's a change of model, otherwise we issue an instance change
  339. var instanceDirty = false;
  340. if (typeLevelCompare && curValue != null && newValue != null) {
  341. var cvProto = curValue.__proto__;
  342. var nvProto = newValue.__proto__;
  343. instanceDirty = (cvProto === nvProto);
  344. }
  345. // Set the dirty flags
  346. if (!instanceDirty && (propInfo.kind === Prim2DPropInfo.PROPKIND_MODEL)) {
  347. if (!this.isDirty) {
  348. this._setFlags(SmartPropertyPrim.flagModelDirty);
  349. }
  350. }
  351. else if (instanceDirty || (propInfo.kind === Prim2DPropInfo.PROPKIND_INSTANCE) || (propInfo.kind === Prim2DPropInfo.PROPKIND_DYNAMIC)) {
  352. this.onPrimitivePropertyDirty(propMask);
  353. }
  354. };
  355. SmartPropertyPrim.prototype.onPrimitivePropertyDirty = function (propFlagId) {
  356. this.onPrimBecomesDirty();
  357. this._instanceDirtyFlags |= propFlagId;
  358. };
  359. SmartPropertyPrim.prototype.handleGroupChanged = function (prop) {
  360. };
  361. /**
  362. * Check if a given set of properties are dirty or not.
  363. * @param flags a ORed combination of Prim2DPropInfo.flagId values
  364. * @return true if at least one property is dirty, false if none of them are.
  365. */
  366. SmartPropertyPrim.prototype.checkPropertiesDirty = function (flags) {
  367. return (this._instanceDirtyFlags & flags) !== 0;
  368. };
  369. /**
  370. * Clear a given set of properties.
  371. * @param flags a ORed combination of Prim2DPropInfo.flagId values
  372. * @return the new set of property still marked as dirty
  373. */
  374. SmartPropertyPrim.prototype.clearPropertiesDirty = function (flags) {
  375. this._instanceDirtyFlags &= ~flags;
  376. return this._instanceDirtyFlags;
  377. };
  378. SmartPropertyPrim.prototype._resetPropertiesDirty = function () {
  379. this._instanceDirtyFlags = 0;
  380. this._clearFlags(SmartPropertyPrim.flagPrimInDirtyList | SmartPropertyPrim.flagNeedRefresh);
  381. };
  382. Object.defineProperty(SmartPropertyPrim.prototype, "levelBoundingInfo", {
  383. /**
  384. * Retrieve the boundingInfo for this Primitive, computed based on the primitive itself and NOT its children
  385. */
  386. get: function () {
  387. if (this._isFlagSet(SmartPropertyPrim.flagLevelBoundingInfoDirty)) {
  388. this.updateLevelBoundingInfo();
  389. this._clearFlags(SmartPropertyPrim.flagLevelBoundingInfoDirty);
  390. }
  391. return this._levelBoundingInfo;
  392. },
  393. enumerable: true,
  394. configurable: true
  395. });
  396. /**
  397. * This method must be overridden by a given Primitive implementation to compute its boundingInfo
  398. */
  399. SmartPropertyPrim.prototype.updateLevelBoundingInfo = function () {
  400. };
  401. /**
  402. * Property method called when the Primitive becomes dirty
  403. */
  404. SmartPropertyPrim.prototype.onPrimBecomesDirty = function () {
  405. };
  406. SmartPropertyPrim._hookProperty = function (propId, piStore, typeLevelCompare, dirtyBoundingInfo, dirtyParentBoundingBox, kind) {
  407. return function (target, propName, descriptor) {
  408. var propInfo = SmartPropertyPrim._createPropInfo(target, propName, propId, dirtyBoundingInfo, dirtyParentBoundingBox, typeLevelCompare, kind);
  409. if (piStore) {
  410. piStore(propInfo);
  411. }
  412. var getter = descriptor.get, setter = descriptor.set;
  413. // Overload the property setter implementation to add our own logic
  414. descriptor.set = function (val) {
  415. // check for disposed first, do nothing
  416. if (this.isDisposed) {
  417. return;
  418. }
  419. var curVal = getter.call(this);
  420. if (SmartPropertyPrim._checkUnchanged(curVal, val)) {
  421. return;
  422. }
  423. // Cast the object we're working one
  424. var prim = this;
  425. // Change the value
  426. setter.call(this, val);
  427. // Notify change, dirty flags update
  428. prim._handlePropChanged(curVal, val, propName, propInfo, typeLevelCompare);
  429. };
  430. };
  431. };
  432. /**
  433. * Add an externally attached data from its key.
  434. * This method call will fail and return false, if such key already exists.
  435. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  436. * @param key the unique key that identifies the data
  437. * @param data the data object to associate to the key for this Engine instance
  438. * @return true if no such key were already present and the data was added successfully, false otherwise
  439. */
  440. SmartPropertyPrim.prototype.addExternalData = function (key, data) {
  441. if (!this._externalData) {
  442. this._externalData = new BABYLON.StringDictionary();
  443. }
  444. return this._externalData.add(key, data);
  445. };
  446. /**
  447. * Get an externally attached data from its key
  448. * @param key the unique key that identifies the data
  449. * @return the associated data, if present (can be null), or undefined if not present
  450. */
  451. SmartPropertyPrim.prototype.getExternalData = function (key) {
  452. if (!this._externalData) {
  453. return null;
  454. }
  455. return this._externalData.get(key);
  456. };
  457. /**
  458. * Get an externally attached data from its key, create it using a factory if it's not already present
  459. * @param key the unique key that identifies the data
  460. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  461. * @return the associated data, can be null if the factory returned null.
  462. */
  463. SmartPropertyPrim.prototype.getOrAddExternalDataWithFactory = function (key, factory) {
  464. if (!this._externalData) {
  465. this._externalData = new BABYLON.StringDictionary();
  466. }
  467. return this._externalData.getOrAddWithFactory(key, factory);
  468. };
  469. /**
  470. * Remove an externally attached data from the Engine instance
  471. * @param key the unique key that identifies the data
  472. * @return true if the data was successfully removed, false if it doesn't exist
  473. */
  474. SmartPropertyPrim.prototype.removeExternalData = function (key) {
  475. if (!this._externalData) {
  476. return false;
  477. }
  478. return this._externalData.remove(key);
  479. };
  480. /**
  481. * Check if a given flag is set
  482. * @param flag the flag value
  483. * @return true if set, false otherwise
  484. */
  485. SmartPropertyPrim.prototype._isFlagSet = function (flag) {
  486. return (this._flags & flag) !== 0;
  487. };
  488. /**
  489. * Check if all given flags are set
  490. * @param flags the flags ORed
  491. * @return true if all the flags are set, false otherwise
  492. */
  493. SmartPropertyPrim.prototype._areAllFlagsSet = function (flags) {
  494. return (this._flags & flags) === flags;
  495. };
  496. /**
  497. * Check if at least one flag of the given flags is set
  498. * @param flags the flags ORed
  499. * @return true if at least one flag is set, false otherwise
  500. */
  501. SmartPropertyPrim.prototype._areSomeFlagsSet = function (flags) {
  502. return (this._flags & flags) !== 0;
  503. };
  504. /**
  505. * Clear the given flags
  506. * @param flags the flags to clear
  507. */
  508. SmartPropertyPrim.prototype._clearFlags = function (flags) {
  509. this._flags &= ~flags;
  510. };
  511. /**
  512. * Set the given flags to true state
  513. * @param flags the flags ORed to set
  514. * @return the flags state before this call
  515. */
  516. SmartPropertyPrim.prototype._setFlags = function (flags) {
  517. var cur = this._flags;
  518. this._flags |= flags;
  519. return cur;
  520. };
  521. /**
  522. * Change the state of the given flags
  523. * @param flags the flags ORed to change
  524. * @param state true to set them, false to clear them
  525. */
  526. SmartPropertyPrim.prototype._changeFlags = function (flags, state) {
  527. if (state) {
  528. this._flags |= flags;
  529. }
  530. else {
  531. this._flags &= ~flags;
  532. }
  533. };
  534. SmartPropertyPrim.propChangedInfo = new PropertyChangedInfo();
  535. SmartPropertyPrim.flagIsDisposed = 0x0000001; // set if the object is already disposed
  536. SmartPropertyPrim.flagLevelBoundingInfoDirty = 0x0000002; // set if the primitive's level bounding box (not including children) is dirty
  537. SmartPropertyPrim.flagModelDirty = 0x0000004; // set if the model must be changed
  538. SmartPropertyPrim.flagLayoutDirty = 0x0000008; // set if the layout must be computed
  539. SmartPropertyPrim.flagLevelVisible = 0x0000010; // set if the primitive is set as visible for its level only
  540. SmartPropertyPrim.flagBoundingInfoDirty = 0x0000020; // set if the primitive's overall bounding box (including children) is dirty
  541. SmartPropertyPrim.flagIsPickable = 0x0000040; // set if the primitive can be picked during interaction
  542. SmartPropertyPrim.flagIsVisible = 0x0000080; // set if the primitive is concretely visible (use the levelVisible of parents)
  543. SmartPropertyPrim.flagVisibilityChanged = 0x0000100; // set if there was a transition between visible/hidden status
  544. SmartPropertyPrim.flagPositioningDirty = 0x0000200; // set if the primitive positioning must be computed
  545. SmartPropertyPrim.flagTrackedGroup = 0x0000400; // set if the group2D is tracking a scene node
  546. SmartPropertyPrim.flagWorldCacheChanged = 0x0000800; // set if the cached bitmap of a world space canvas changed
  547. SmartPropertyPrim.flagChildrenFlatZOrder = 0x0001000; // set if all the children (direct and indirect) will share the same Z-Order
  548. SmartPropertyPrim.flagZOrderDirty = 0x0002000; // set if the Z-Order for this prim and its children must be recomputed
  549. SmartPropertyPrim.flagActualOpacityDirty = 0x0004000; // set if the actualOpactity should be recomputed
  550. SmartPropertyPrim.flagPrimInDirtyList = 0x0008000; // set if the primitive is in the primDirtyList
  551. SmartPropertyPrim.flagIsContainer = 0x0010000; // set if the primitive is a container
  552. SmartPropertyPrim.flagNeedRefresh = 0x0020000; // set if the primitive wasn't successful at refresh
  553. SmartPropertyPrim.flagActualScaleDirty = 0x0040000; // set if the actualScale property needs to be recomputed
  554. SmartPropertyPrim.flagDontInheritParentScale = 0x0080000; // set if the actualScale must not use its parent's scale to be computed
  555. SmartPropertyPrim.flagGlobalTransformDirty = 0x0100000; // set if the global transform must be recomputed due to a local transform change
  556. SmartPropertyPrim.flagLayoutBoundingInfoDirty = 0x0100000; // set if the layout bounding info is dirty
  557. SmartPropertyPrim = __decorate([
  558. BABYLON.className("SmartPropertyPrim")
  559. ], SmartPropertyPrim);
  560. return SmartPropertyPrim;
  561. }());
  562. BABYLON.SmartPropertyPrim = SmartPropertyPrim;
  563. function modelLevelProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo, dirtyParentBoundingBox) {
  564. if (typeLevelCompare === void 0) { typeLevelCompare = false; }
  565. if (dirtyBoundingInfo === void 0) { dirtyBoundingInfo = false; }
  566. if (dirtyParentBoundingBox === void 0) { dirtyParentBoundingBox = false; }
  567. return SmartPropertyPrim._hookProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo, dirtyParentBoundingBox, Prim2DPropInfo.PROPKIND_MODEL);
  568. }
  569. BABYLON.modelLevelProperty = modelLevelProperty;
  570. function instanceLevelProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo, dirtyParentBoundingBox) {
  571. if (typeLevelCompare === void 0) { typeLevelCompare = false; }
  572. if (dirtyBoundingInfo === void 0) { dirtyBoundingInfo = false; }
  573. if (dirtyParentBoundingBox === void 0) { dirtyParentBoundingBox = false; }
  574. return SmartPropertyPrim._hookProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo, dirtyParentBoundingBox, Prim2DPropInfo.PROPKIND_INSTANCE);
  575. }
  576. BABYLON.instanceLevelProperty = instanceLevelProperty;
  577. function dynamicLevelProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo, dirtyParentBoundingBox) {
  578. if (typeLevelCompare === void 0) { typeLevelCompare = false; }
  579. if (dirtyBoundingInfo === void 0) { dirtyBoundingInfo = false; }
  580. if (dirtyParentBoundingBox === void 0) { dirtyParentBoundingBox = false; }
  581. return SmartPropertyPrim._hookProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo, dirtyParentBoundingBox, Prim2DPropInfo.PROPKIND_DYNAMIC);
  582. }
  583. BABYLON.dynamicLevelProperty = dynamicLevelProperty;
  584. })(BABYLON || (BABYLON = {}));