babylon.furMaterial.ts 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. /// <reference path="../../../dist/preview release/babylon.d.ts"/>
  2. module BABYLON {
  3. var maxSimultaneousLights = 4;
  4. class FurMaterialDefines extends MaterialDefines {
  5. public DIFFUSE = false;
  6. public HEIGHTMAP = false;
  7. public CLIPPLANE = false;
  8. public ALPHATEST = false;
  9. public POINTSIZE = false;
  10. public FOG = false;
  11. public LIGHT0 = false;
  12. public LIGHT1 = false;
  13. public LIGHT2 = false;
  14. public LIGHT3 = false;
  15. public SPOTLIGHT0 = false;
  16. public SPOTLIGHT1 = false;
  17. public SPOTLIGHT2 = false;
  18. public SPOTLIGHT3 = false;
  19. public HEMILIGHT0 = false;
  20. public HEMILIGHT1 = false;
  21. public HEMILIGHT2 = false;
  22. public HEMILIGHT3 = false;
  23. public DIRLIGHT0 = false;
  24. public DIRLIGHT1 = false;
  25. public DIRLIGHT2 = false;
  26. public DIRLIGHT3 = false;
  27. public POINTLIGHT0 = false;
  28. public POINTLIGHT1 = false;
  29. public POINTLIGHT2 = false;
  30. public POINTLIGHT3 = false;
  31. public SHADOW0 = false;
  32. public SHADOW1 = false;
  33. public SHADOW2 = false;
  34. public SHADOW3 = false;
  35. public SHADOWS = false;
  36. public SHADOWVSM0 = false;
  37. public SHADOWVSM1 = false;
  38. public SHADOWVSM2 = false;
  39. public SHADOWVSM3 = false;
  40. public SHADOWPCF0 = false;
  41. public SHADOWPCF1 = false;
  42. public SHADOWPCF2 = false;
  43. public SHADOWPCF3 = false;
  44. public NORMAL = false;
  45. public UV1 = false;
  46. public UV2 = false;
  47. public VERTEXCOLOR = false;
  48. public VERTEXALPHA = false;
  49. public BONES = false;
  50. public BONES4 = false;
  51. public BonesPerMesh = 0;
  52. public INSTANCES = false;
  53. public HIGHLEVEL = false;
  54. constructor() {
  55. super();
  56. this._keys = Object.keys(this);
  57. }
  58. }
  59. export class FurMaterial extends Material {
  60. public diffuseTexture: BaseTexture;
  61. public heightTexture: BaseTexture;
  62. public diffuseColor = new Color3(1, 1, 1);
  63. @serialize()
  64. public furLength: number = 1;
  65. @serialize()
  66. public furAngle: number = 0;
  67. @serializeAsColor3()
  68. public furColor = new Color3(0.44,0.21,0.02);
  69. @serialize()
  70. public furOffset: number = 0.0;
  71. @serialize()
  72. public furSpacing: number = 12;
  73. @serializeAsVector3()
  74. public furGravity = new Vector3(0, 0, 0);
  75. @serialize()
  76. public furSpeed: number = 100;
  77. @serialize()
  78. public furDensity: number = 20;
  79. @serializeAsTexture()
  80. public furTexture: DynamicTexture;
  81. @serialize()
  82. public disableLighting = false;
  83. @serialize()
  84. public highLevelFur: boolean = true;
  85. private _worldViewProjectionMatrix = Matrix.Zero();
  86. private _scaledDiffuse = new Color3(1.,1.,1.);
  87. private _renderId: number;
  88. private _furTime: number = 0;
  89. private _defines = new FurMaterialDefines();
  90. private _cachedDefines = new FurMaterialDefines();
  91. constructor(name: string, scene: Scene) {
  92. super(name, scene);
  93. this._cachedDefines.BonesPerMesh = -1;
  94. }
  95. @serialize()
  96. public get furTime() {
  97. return this._furTime;
  98. }
  99. public set furTime(furTime: number) {
  100. this._furTime = furTime;
  101. }
  102. public needAlphaBlending(): boolean {
  103. return (this.alpha < 1.0);
  104. }
  105. public needAlphaTesting(): boolean {
  106. return false;
  107. }
  108. public getAlphaTestTexture(): BaseTexture {
  109. return null;
  110. }
  111. // Methods
  112. private _checkCache(scene: Scene, mesh?: AbstractMesh, useInstances?: boolean): boolean {
  113. if (!mesh) {
  114. return true;
  115. }
  116. if (this._defines.INSTANCES !== useInstances) {
  117. return false;
  118. }
  119. if (mesh._materialDefines && mesh._materialDefines.isEqual(this._defines)) {
  120. return true;
  121. }
  122. return false;
  123. }
  124. public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean {
  125. if (this.checkReadyOnlyOnce) {
  126. if (this._wasPreviouslyReady) {
  127. return true;
  128. }
  129. }
  130. var scene = this.getScene();
  131. if (!this.checkReadyOnEveryCall) {
  132. if (this._renderId === scene.getRenderId()) {
  133. if (this._checkCache(scene, mesh, useInstances)) {
  134. return true;
  135. }
  136. }
  137. }
  138. var engine = scene.getEngine();
  139. var needNormals = false;
  140. var needUVs = false;
  141. this._defines.reset();
  142. // Textures
  143. if (scene.texturesEnabled) {
  144. if (this.diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {
  145. if (!this.diffuseTexture.isReady()) {
  146. return false;
  147. } else {
  148. needUVs = true;
  149. this._defines.DIFFUSE = true;
  150. }
  151. }
  152. if (this.heightTexture) {
  153. if (!this.heightTexture.isReady()) {
  154. return false;
  155. } else {
  156. needUVs = true;
  157. this._defines.HEIGHTMAP = true;
  158. }
  159. }
  160. }
  161. // Effect
  162. if (scene.clipPlane) {
  163. this._defines.CLIPPLANE = true;
  164. }
  165. if (engine.getAlphaTesting()) {
  166. this._defines.ALPHATEST = true;
  167. }
  168. // Point size
  169. if (this.pointsCloud || scene.forcePointsCloud) {
  170. this._defines.POINTSIZE = true;
  171. }
  172. // Fog
  173. if (scene.fogEnabled && mesh && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE && this.fogEnabled) {
  174. this._defines.FOG = true;
  175. }
  176. // High level
  177. if (this.highLevelFur) {
  178. this._defines.HIGHLEVEL = true;
  179. }
  180. var lightIndex = 0;
  181. if (scene.lightsEnabled && !this.disableLighting) {
  182. for (var index = 0; index < scene.lights.length; index++) {
  183. var light = scene.lights[index];
  184. if (!light.isEnabled()) {
  185. continue;
  186. }
  187. // Excluded check
  188. if (light._excludedMeshesIds.length > 0) {
  189. for (var excludedIndex = 0; excludedIndex < light._excludedMeshesIds.length; excludedIndex++) {
  190. var excludedMesh = scene.getMeshByID(light._excludedMeshesIds[excludedIndex]);
  191. if (excludedMesh) {
  192. light.excludedMeshes.push(excludedMesh);
  193. }
  194. }
  195. light._excludedMeshesIds = [];
  196. }
  197. // Included check
  198. if (light._includedOnlyMeshesIds.length > 0) {
  199. for (var includedOnlyIndex = 0; includedOnlyIndex < light._includedOnlyMeshesIds.length; includedOnlyIndex++) {
  200. var includedOnlyMesh = scene.getMeshByID(light._includedOnlyMeshesIds[includedOnlyIndex]);
  201. if (includedOnlyMesh) {
  202. light.includedOnlyMeshes.push(includedOnlyMesh);
  203. }
  204. }
  205. light._includedOnlyMeshesIds = [];
  206. }
  207. if (!light.canAffectMesh(mesh)) {
  208. continue;
  209. }
  210. needNormals = true;
  211. this._defines["LIGHT" + lightIndex] = true;
  212. var type;
  213. if (light instanceof SpotLight) {
  214. type = "SPOTLIGHT" + lightIndex;
  215. } else if (light instanceof HemisphericLight) {
  216. type = "HEMILIGHT" + lightIndex;
  217. } else if (light instanceof PointLight) {
  218. type = "POINTLIGHT" + lightIndex;
  219. } else {
  220. type = "DIRLIGHT" + lightIndex;
  221. }
  222. this._defines[type] = true;
  223. // Shadows
  224. if (scene.shadowsEnabled) {
  225. var shadowGenerator = light.getShadowGenerator();
  226. if (mesh && mesh.receiveShadows && shadowGenerator) {
  227. this._defines["SHADOW" + lightIndex] = true;
  228. this._defines.SHADOWS = true;
  229. if (shadowGenerator.useVarianceShadowMap || shadowGenerator.useBlurVarianceShadowMap) {
  230. this._defines["SHADOWVSM" + lightIndex] = true;
  231. }
  232. if (shadowGenerator.usePoissonSampling) {
  233. this._defines["SHADOWPCF" + lightIndex] = true;
  234. }
  235. }
  236. }
  237. lightIndex++;
  238. if (lightIndex === maxSimultaneousLights)
  239. break;
  240. }
  241. }
  242. // Attribs
  243. if (mesh) {
  244. if (needNormals && mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {
  245. this._defines.NORMAL = true;
  246. }
  247. if (needUVs) {
  248. if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {
  249. this._defines.UV1 = true;
  250. }
  251. if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {
  252. this._defines.UV2 = true;
  253. }
  254. }
  255. if (mesh.useVertexColors && mesh.isVerticesDataPresent(VertexBuffer.ColorKind)) {
  256. this._defines.VERTEXCOLOR = true;
  257. if (mesh.hasVertexAlpha) {
  258. this._defines.VERTEXALPHA = true;
  259. }
  260. }
  261. if (mesh.useBones && mesh.computeBonesUsingShaders) {
  262. this._defines.BONES = true;
  263. this._defines.BonesPerMesh = (mesh.skeleton.bones.length + 1);
  264. this._defines.BONES4 = true;
  265. }
  266. // Instances
  267. if (useInstances) {
  268. this._defines.INSTANCES = true;
  269. }
  270. }
  271. // Get correct effect
  272. if (!this._defines.isEqual(this._cachedDefines)) {
  273. this._defines.cloneTo(this._cachedDefines);
  274. scene.resetCachedMaterial();
  275. // Fallbacks
  276. var fallbacks = new EffectFallbacks();
  277. if (this._defines.FOG) {
  278. fallbacks.addFallback(1, "FOG");
  279. }
  280. for (lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {
  281. if (!this._defines["LIGHT" + lightIndex]) {
  282. continue;
  283. }
  284. if (lightIndex > 0) {
  285. fallbacks.addFallback(lightIndex, "LIGHT" + lightIndex);
  286. }
  287. if (this._defines["SHADOW" + lightIndex]) {
  288. fallbacks.addFallback(0, "SHADOW" + lightIndex);
  289. }
  290. if (this._defines["SHADOWPCF" + lightIndex]) {
  291. fallbacks.addFallback(0, "SHADOWPCF" + lightIndex);
  292. }
  293. if (this._defines["SHADOWVSM" + lightIndex]) {
  294. fallbacks.addFallback(0, "SHADOWVSM" + lightIndex);
  295. }
  296. }
  297. if (this._defines.BONES4) {
  298. fallbacks.addFallback(0, "BONES4");
  299. }
  300. //Attributes
  301. var attribs = [VertexBuffer.PositionKind];
  302. if (this._defines.NORMAL) {
  303. attribs.push(VertexBuffer.NormalKind);
  304. }
  305. if (this._defines.UV1) {
  306. attribs.push(VertexBuffer.UVKind);
  307. }
  308. if (this._defines.UV2) {
  309. attribs.push(VertexBuffer.UV2Kind);
  310. }
  311. if (this._defines.VERTEXCOLOR) {
  312. attribs.push(VertexBuffer.ColorKind);
  313. }
  314. if (this._defines.BONES) {
  315. attribs.push(VertexBuffer.MatricesIndicesKind);
  316. attribs.push(VertexBuffer.MatricesWeightsKind);
  317. }
  318. if (this._defines.INSTANCES) {
  319. attribs.push("world0");
  320. attribs.push("world1");
  321. attribs.push("world2");
  322. attribs.push("world3");
  323. }
  324. // Legacy browser patch
  325. var shaderName = "fur";
  326. var join = this._defines.toString();
  327. this._effect = scene.getEngine().createEffect(shaderName,
  328. attribs,
  329. ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor",
  330. "vLightData0", "vLightDiffuse0", "vLightSpecular0", "vLightDirection0", "vLightGround0", "lightMatrix0",
  331. "vLightData1", "vLightDiffuse1", "vLightSpecular1", "vLightDirection1", "vLightGround1", "lightMatrix1",
  332. "vLightData2", "vLightDiffuse2", "vLightSpecular2", "vLightDirection2", "vLightGround2", "lightMatrix2",
  333. "vLightData3", "vLightDiffuse3", "vLightSpecular3", "vLightDirection3", "vLightGround3", "lightMatrix3",
  334. "vFogInfos", "vFogColor", "pointSize",
  335. "vDiffuseInfos",
  336. "mBones",
  337. "vClipPlane", "diffuseMatrix",
  338. "shadowsInfo0", "shadowsInfo1", "shadowsInfo2", "shadowsInfo3",
  339. "furLength", "furAngle", "furColor", "furOffset", "furGravity", "furTime", "furSpacing", "furDensity"
  340. ],
  341. ["diffuseSampler",
  342. "shadowSampler0", "shadowSampler1", "shadowSampler2", "shadowSampler3",
  343. "heightTexture", "furTexture"
  344. ],
  345. join, fallbacks, this.onCompiled, this.onError);
  346. }
  347. if (!this._effect.isReady()) {
  348. return false;
  349. }
  350. this._renderId = scene.getRenderId();
  351. this._wasPreviouslyReady = true;
  352. if (mesh) {
  353. if (!mesh._materialDefines) {
  354. mesh._materialDefines = new FurMaterialDefines();
  355. }
  356. this._defines.cloneTo(mesh._materialDefines);
  357. }
  358. return true;
  359. }
  360. public bindOnlyWorldMatrix(world: Matrix): void {
  361. this._effect.setMatrix("world", world);
  362. }
  363. public bind(world: Matrix, mesh?: Mesh): void {
  364. var scene = this.getScene();
  365. // Matrices
  366. this.bindOnlyWorldMatrix(world);
  367. this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
  368. // Bones
  369. if (mesh && mesh.useBones && mesh.computeBonesUsingShaders) {
  370. this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
  371. }
  372. if (scene.getCachedMaterial() !== this) {
  373. // Textures
  374. if (this.diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {
  375. this._effect.setTexture("diffuseSampler", this.diffuseTexture);
  376. this._effect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
  377. this._effect.setMatrix("diffuseMatrix", this.diffuseTexture.getTextureMatrix());
  378. }
  379. if (this.heightTexture) {
  380. this._effect.setTexture("heightTexture", this.heightTexture);
  381. }
  382. // Clip plane
  383. if (scene.clipPlane) {
  384. var clipPlane = scene.clipPlane;
  385. this._effect.setFloat4("vClipPlane", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
  386. }
  387. // Point size
  388. if (this.pointsCloud) {
  389. this._effect.setFloat("pointSize", this.pointSize);
  390. }
  391. this._effect.setVector3("vEyePosition", scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.position);
  392. }
  393. this._effect.setColor4("vDiffuseColor", this._scaledDiffuse, this.alpha * mesh.visibility);
  394. if (scene.lightsEnabled && !this.disableLighting) {
  395. var lightIndex = 0;
  396. for (var index = 0; index < scene.lights.length; index++) {
  397. var light = scene.lights[index];
  398. if (!light.isEnabled()) {
  399. continue;
  400. }
  401. if (!light.canAffectMesh(mesh)) {
  402. continue;
  403. }
  404. if (light instanceof PointLight) {
  405. // Point Light
  406. light.transferToEffect(this._effect, "vLightData" + lightIndex);
  407. } else if (light instanceof DirectionalLight) {
  408. // Directional Light
  409. light.transferToEffect(this._effect, "vLightData" + lightIndex);
  410. } else if (light instanceof SpotLight) {
  411. // Spot Light
  412. light.transferToEffect(this._effect, "vLightData" + lightIndex, "vLightDirection" + lightIndex);
  413. } else if (light instanceof HemisphericLight) {
  414. // Hemispheric Light
  415. light.transferToEffect(this._effect, "vLightData" + lightIndex, "vLightGround" + lightIndex);
  416. }
  417. light.diffuse.scaleToRef(light.intensity, this._scaledDiffuse);
  418. this._effect.setColor4("vLightDiffuse" + lightIndex, this._scaledDiffuse, light.range);
  419. // Shadows
  420. if (scene.shadowsEnabled) {
  421. var shadowGenerator = light.getShadowGenerator();
  422. if (mesh.receiveShadows && shadowGenerator) {
  423. this._effect.setMatrix("lightMatrix" + lightIndex, shadowGenerator.getTransformMatrix());
  424. this._effect.setTexture("shadowSampler" + lightIndex, shadowGenerator.getShadowMapForRendering());
  425. this._effect.setFloat3("shadowsInfo" + lightIndex, shadowGenerator.getDarkness(), shadowGenerator.getShadowMap().getSize().width, shadowGenerator.bias);
  426. }
  427. }
  428. lightIndex++;
  429. if (lightIndex === maxSimultaneousLights)
  430. break;
  431. }
  432. }
  433. // View
  434. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
  435. this._effect.setMatrix("view", scene.getViewMatrix());
  436. }
  437. // Fog
  438. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
  439. this._effect.setFloat4("vFogInfos", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);
  440. this._effect.setColor3("vFogColor", scene.fogColor);
  441. }
  442. this._effect.setFloat("furLength", this.furLength);
  443. this._effect.setFloat("furAngle", this.furAngle);
  444. this._effect.setColor4("furColor", this.furColor, 1.0);
  445. if (this.highLevelFur) {
  446. this._effect.setVector3("furGravity", this.furGravity);
  447. this._effect.setFloat("furOffset", this.furOffset);
  448. this._effect.setFloat("furSpacing", this.furSpacing);
  449. this._effect.setFloat("furDensity", this.furDensity);
  450. this._furTime += this.getScene().getEngine().getDeltaTime() / this.furSpeed;
  451. this._effect.setFloat("furTime", this._furTime);
  452. this._effect.setTexture("furTexture", this.furTexture);
  453. }
  454. super.bind(world, mesh);
  455. }
  456. public getAnimatables(): IAnimatable[] {
  457. var results = [];
  458. if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
  459. results.push(this.diffuseTexture);
  460. }
  461. if (this.heightTexture && this.heightTexture.animations && this.heightTexture.animations.length > 0) {
  462. results.push(this.heightTexture);
  463. }
  464. return results;
  465. }
  466. public dispose(forceDisposeEffect?: boolean): void {
  467. if (this.diffuseTexture) {
  468. this.diffuseTexture.dispose();
  469. }
  470. super.dispose(forceDisposeEffect);
  471. }
  472. public clone(name: string): FurMaterial {
  473. return SerializationHelper.Clone(() => new FurMaterial(name, this.getScene()), this);
  474. }
  475. public serialize(): any {
  476. var serializationObject = SerializationHelper.Serialize(this);
  477. serializationObject.customType = "BABYLON.FurMaterial";
  478. return serializationObject;
  479. }
  480. // Statics
  481. public static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial {
  482. return SerializationHelper.Parse(() => new FurMaterial(source.name, scene), source, scene, rootUrl);
  483. }
  484. public static GenerateTexture(name: string, scene: Scene): DynamicTexture {
  485. // Generate fur textures
  486. var texture = new DynamicTexture("FurTexture " + name, 256, scene, true);
  487. var context = texture.getContext();
  488. for ( var i = 0; i < 20000; ++i ) {
  489. context.fillStyle = "rgba(255, " + Math.floor(Math.random() * 255) + ", " + Math.floor(Math.random() * 255) + ", 1)";
  490. context.fillRect((Math.random() * texture.getSize().width), (Math.random() * texture.getSize().height), 2, 2);
  491. }
  492. texture.update(false);
  493. texture.wrapU = Texture.WRAP_ADDRESSMODE;
  494. texture.wrapV = Texture.WRAP_ADDRESSMODE;
  495. return texture;
  496. }
  497. // Creates and returns an array of meshes used as shells for the Fur Material
  498. // that can be disposed later in your code
  499. // The quality is in interval [0, 100]
  500. public static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[] {
  501. var meshes = [sourceMesh];
  502. var mat: FurMaterial = <FurMaterial>sourceMesh.material;
  503. if (!(mat instanceof FurMaterial)) {
  504. throw "The material of the source mesh must be a Fur Material";
  505. }
  506. for (var i = 1; i < quality; i++) {
  507. var offsetFur = new BABYLON.FurMaterial(mat.name + i, sourceMesh.getScene());
  508. offsetFur.furLength = mat.furLength;
  509. offsetFur.furAngle = mat.furAngle;
  510. offsetFur.furGravity = mat.furGravity;
  511. offsetFur.furSpacing = mat.furSpacing;
  512. offsetFur.furSpeed = mat.furSpeed;
  513. offsetFur.furColor = mat.furColor;
  514. offsetFur.diffuseTexture = mat.diffuseTexture;
  515. offsetFur.furOffset = i / quality;
  516. offsetFur.furTexture = mat.furTexture;
  517. offsetFur.highLevelFur = mat.highLevelFur;
  518. offsetFur.furTime = mat.furTime;
  519. offsetFur.furDensity = mat.furDensity;
  520. var offsetMesh = sourceMesh.clone(sourceMesh.name + i);
  521. offsetMesh.material = offsetFur;
  522. offsetMesh.skeleton = sourceMesh.skeleton;
  523. offsetMesh.parent = sourceMesh;
  524. meshes.push(offsetMesh);
  525. }
  526. return meshes;
  527. }
  528. }
  529. }