babylonjs.materials.module.d.ts 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. declare module 'babylonjs-materials' {
  2. export = BABYLON;
  3. }
  4. declare module BABYLON {
  5. class ShadowOnlyMaterial extends PushMaterial {
  6. private _renderId;
  7. private _activeLight;
  8. constructor(name: string, scene: Scene);
  9. shadowColor: Color3;
  10. needAlphaBlending(): boolean;
  11. needAlphaTesting(): boolean;
  12. getAlphaTestTexture(): Nullable<BaseTexture>;
  13. activeLight: IShadowLight;
  14. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  15. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  16. clone(name: string): ShadowOnlyMaterial;
  17. serialize(): any;
  18. getClassName(): string;
  19. static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
  20. }
  21. }
  22. declare module BABYLON {
  23. class GradientMaterial extends PushMaterial {
  24. private _maxSimultaneousLights;
  25. maxSimultaneousLights: number;
  26. topColor: Color3;
  27. topColorAlpha: number;
  28. bottomColor: Color3;
  29. bottomColorAlpha: number;
  30. offset: number;
  31. scale: number;
  32. smoothness: number;
  33. disableLighting: boolean;
  34. private _scaledDiffuse;
  35. private _renderId;
  36. constructor(name: string, scene: Scene);
  37. needAlphaBlending(): boolean;
  38. needAlphaTesting(): boolean;
  39. getAlphaTestTexture(): Nullable<BaseTexture>;
  40. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  41. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  42. getAnimatables(): IAnimatable[];
  43. dispose(forceDisposeEffect?: boolean): void;
  44. clone(name: string): GradientMaterial;
  45. serialize(): any;
  46. getClassName(): string;
  47. static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial;
  48. }
  49. }
  50. declare module BABYLON {
  51. class NormalMaterial extends PushMaterial {
  52. private _diffuseTexture;
  53. diffuseTexture: BaseTexture;
  54. diffuseColor: Color3;
  55. private _disableLighting;
  56. disableLighting: boolean;
  57. private _maxSimultaneousLights;
  58. maxSimultaneousLights: number;
  59. private _renderId;
  60. constructor(name: string, scene: Scene);
  61. needAlphaBlending(): boolean;
  62. needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
  63. needAlphaTesting(): boolean;
  64. getAlphaTestTexture(): Nullable<BaseTexture>;
  65. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  66. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  67. getAnimatables(): IAnimatable[];
  68. getActiveTextures(): BaseTexture[];
  69. hasTexture(texture: BaseTexture): boolean;
  70. dispose(forceDisposeEffect?: boolean): void;
  71. clone(name: string): NormalMaterial;
  72. serialize(): any;
  73. getClassName(): string;
  74. static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial;
  75. }
  76. }
  77. declare module BABYLON {
  78. class LavaMaterial extends PushMaterial {
  79. private _diffuseTexture;
  80. diffuseTexture: BaseTexture;
  81. noiseTexture: BaseTexture;
  82. fogColor: Color3;
  83. speed: number;
  84. movingSpeed: number;
  85. lowFrequencySpeed: number;
  86. fogDensity: number;
  87. private _lastTime;
  88. diffuseColor: Color3;
  89. private _disableLighting;
  90. disableLighting: boolean;
  91. private _unlit;
  92. unlit: boolean;
  93. private _maxSimultaneousLights;
  94. maxSimultaneousLights: number;
  95. private _scaledDiffuse;
  96. private _renderId;
  97. constructor(name: string, scene: Scene);
  98. needAlphaBlending(): boolean;
  99. needAlphaTesting(): boolean;
  100. getAlphaTestTexture(): Nullable<BaseTexture>;
  101. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  102. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  103. getAnimatables(): IAnimatable[];
  104. getActiveTextures(): BaseTexture[];
  105. hasTexture(texture: BaseTexture): boolean;
  106. dispose(forceDisposeEffect?: boolean): void;
  107. clone(name: string): LavaMaterial;
  108. serialize(): any;
  109. getClassName(): string;
  110. static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial;
  111. }
  112. }
  113. declare module BABYLON {
  114. class SimpleMaterial extends PushMaterial {
  115. private _diffuseTexture;
  116. diffuseTexture: BaseTexture;
  117. diffuseColor: Color3;
  118. private _disableLighting;
  119. disableLighting: boolean;
  120. private _maxSimultaneousLights;
  121. maxSimultaneousLights: number;
  122. private _renderId;
  123. constructor(name: string, scene: Scene);
  124. needAlphaBlending(): boolean;
  125. needAlphaTesting(): boolean;
  126. getAlphaTestTexture(): Nullable<BaseTexture>;
  127. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  128. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  129. getAnimatables(): IAnimatable[];
  130. getActiveTextures(): BaseTexture[];
  131. hasTexture(texture: BaseTexture): boolean;
  132. dispose(forceDisposeEffect?: boolean): void;
  133. clone(name: string): SimpleMaterial;
  134. serialize(): any;
  135. getClassName(): string;
  136. static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial;
  137. }
  138. }
  139. declare module BABYLON {
  140. class WaterMaterial extends PushMaterial {
  141. renderTargetSize: Vector2;
  142. private _bumpTexture;
  143. bumpTexture: BaseTexture;
  144. diffuseColor: Color3;
  145. specularColor: Color3;
  146. specularPower: number;
  147. private _disableLighting;
  148. disableLighting: boolean;
  149. private _maxSimultaneousLights;
  150. maxSimultaneousLights: number;
  151. /**
  152. * @param {number}: Represents the wind force
  153. */
  154. windForce: number;
  155. /**
  156. * @param {Vector2}: The direction of the wind in the plane (X, Z)
  157. */
  158. windDirection: Vector2;
  159. /**
  160. * @param {number}: Wave height, represents the height of the waves
  161. */
  162. waveHeight: number;
  163. /**
  164. * @param {number}: Bump height, represents the bump height related to the bump map
  165. */
  166. bumpHeight: number;
  167. /**
  168. * @param {boolean}: Add a smaller moving bump to less steady waves.
  169. */
  170. private _bumpSuperimpose;
  171. bumpSuperimpose: boolean;
  172. /**
  173. * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
  174. */
  175. private _fresnelSeparate;
  176. fresnelSeparate: boolean;
  177. /**
  178. * @param {boolean}: bump Waves modify the reflection.
  179. */
  180. private _bumpAffectsReflection;
  181. bumpAffectsReflection: boolean;
  182. /**
  183. * @param {number}: The water color blended with the refraction (near)
  184. */
  185. waterColor: Color3;
  186. /**
  187. * @param {number}: The blend factor related to the water color
  188. */
  189. colorBlendFactor: number;
  190. /**
  191. * @param {number}: The water color blended with the reflection (far)
  192. */
  193. waterColor2: Color3;
  194. /**
  195. * @param {number}: The blend factor related to the water color (reflection, far)
  196. */
  197. colorBlendFactor2: number;
  198. /**
  199. * @param {number}: Represents the maximum length of a wave
  200. */
  201. waveLength: number;
  202. /**
  203. * @param {number}: Defines the waves speed
  204. */
  205. waveSpeed: number;
  206. protected _renderTargets: SmartArray<RenderTargetTexture>;
  207. private _mesh;
  208. private _refractionRTT;
  209. private _reflectionRTT;
  210. private _reflectionTransform;
  211. private _lastTime;
  212. private _lastDeltaTime;
  213. private _renderId;
  214. private _useLogarithmicDepth;
  215. private _waitingRenderList;
  216. /**
  217. * Gets a boolean indicating that current material needs to register RTT
  218. */
  219. readonly hasRenderTargetTextures: boolean;
  220. /**
  221. * Constructor
  222. */
  223. constructor(name: string, scene: Scene, renderTargetSize?: Vector2);
  224. useLogarithmicDepth: boolean;
  225. readonly refractionTexture: Nullable<RenderTargetTexture>;
  226. readonly reflectionTexture: Nullable<RenderTargetTexture>;
  227. addToRenderList(node: any): void;
  228. enableRenderTargets(enable: boolean): void;
  229. getRenderList(): Nullable<AbstractMesh[]>;
  230. readonly renderTargetsEnabled: boolean;
  231. needAlphaBlending(): boolean;
  232. needAlphaTesting(): boolean;
  233. getAlphaTestTexture(): Nullable<BaseTexture>;
  234. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  235. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  236. private _createRenderTargets;
  237. getAnimatables(): IAnimatable[];
  238. getActiveTextures(): BaseTexture[];
  239. hasTexture(texture: BaseTexture): boolean;
  240. dispose(forceDisposeEffect?: boolean): void;
  241. clone(name: string): WaterMaterial;
  242. serialize(): any;
  243. getClassName(): string;
  244. static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial;
  245. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  246. }
  247. }
  248. declare module BABYLON {
  249. class FireMaterial extends PushMaterial {
  250. private _diffuseTexture;
  251. diffuseTexture: Nullable<BaseTexture>;
  252. private _distortionTexture;
  253. distortionTexture: Nullable<BaseTexture>;
  254. private _opacityTexture;
  255. opacityTexture: Nullable<BaseTexture>;
  256. diffuseColor: Color3;
  257. speed: number;
  258. private _scaledDiffuse;
  259. private _renderId;
  260. private _lastTime;
  261. constructor(name: string, scene: Scene);
  262. needAlphaBlending(): boolean;
  263. needAlphaTesting(): boolean;
  264. getAlphaTestTexture(): Nullable<BaseTexture>;
  265. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  266. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  267. getAnimatables(): IAnimatable[];
  268. getActiveTextures(): BaseTexture[];
  269. hasTexture(texture: BaseTexture): boolean;
  270. getClassName(): string;
  271. dispose(forceDisposeEffect?: boolean): void;
  272. clone(name: string): FireMaterial;
  273. serialize(): any;
  274. static Parse(source: any, scene: Scene, rootUrl: string): FireMaterial;
  275. }
  276. }
  277. declare module BABYLON {
  278. class FurMaterial extends PushMaterial {
  279. private _diffuseTexture;
  280. diffuseTexture: BaseTexture;
  281. private _heightTexture;
  282. heightTexture: BaseTexture;
  283. diffuseColor: Color3;
  284. furLength: number;
  285. furAngle: number;
  286. furColor: Color3;
  287. furOffset: number;
  288. furSpacing: number;
  289. furGravity: Vector3;
  290. furSpeed: number;
  291. furDensity: number;
  292. furOcclusion: number;
  293. furTexture: DynamicTexture;
  294. private _disableLighting;
  295. disableLighting: boolean;
  296. private _maxSimultaneousLights;
  297. maxSimultaneousLights: number;
  298. highLevelFur: boolean;
  299. _meshes: AbstractMesh[];
  300. private _renderId;
  301. private _furTime;
  302. constructor(name: string, scene: Scene);
  303. furTime: number;
  304. needAlphaBlending(): boolean;
  305. needAlphaTesting(): boolean;
  306. getAlphaTestTexture(): Nullable<BaseTexture>;
  307. updateFur(): void;
  308. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  309. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  310. getAnimatables(): IAnimatable[];
  311. getActiveTextures(): BaseTexture[];
  312. hasTexture(texture: BaseTexture): boolean;
  313. dispose(forceDisposeEffect?: boolean): void;
  314. clone(name: string): FurMaterial;
  315. serialize(): any;
  316. getClassName(): string;
  317. static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial;
  318. static GenerateTexture(name: string, scene: Scene): DynamicTexture;
  319. static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[];
  320. }
  321. }
  322. declare module BABYLON {
  323. class TerrainMaterial extends PushMaterial {
  324. private _mixTexture;
  325. mixTexture: BaseTexture;
  326. private _diffuseTexture1;
  327. diffuseTexture1: Texture;
  328. private _diffuseTexture2;
  329. diffuseTexture2: Texture;
  330. private _diffuseTexture3;
  331. diffuseTexture3: Texture;
  332. private _bumpTexture1;
  333. bumpTexture1: Texture;
  334. private _bumpTexture2;
  335. bumpTexture2: Texture;
  336. private _bumpTexture3;
  337. bumpTexture3: Texture;
  338. diffuseColor: Color3;
  339. specularColor: Color3;
  340. specularPower: number;
  341. private _disableLighting;
  342. disableLighting: boolean;
  343. private _maxSimultaneousLights;
  344. maxSimultaneousLights: number;
  345. private _renderId;
  346. constructor(name: string, scene: Scene);
  347. needAlphaBlending(): boolean;
  348. needAlphaTesting(): boolean;
  349. getAlphaTestTexture(): Nullable<BaseTexture>;
  350. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  351. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  352. getAnimatables(): IAnimatable[];
  353. getActiveTextures(): BaseTexture[];
  354. hasTexture(texture: BaseTexture): boolean;
  355. dispose(forceDisposeEffect?: boolean): void;
  356. clone(name: string): TerrainMaterial;
  357. serialize(): any;
  358. getClassName(): string;
  359. static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial;
  360. }
  361. }
  362. declare module BABYLON {
  363. class MixMaterial extends PushMaterial {
  364. /**
  365. * Mix textures
  366. */
  367. private _mixTexture1;
  368. mixTexture1: BaseTexture;
  369. private _mixTexture2;
  370. mixTexture2: BaseTexture;
  371. /**
  372. * Diffuse textures
  373. */
  374. private _diffuseTexture1;
  375. diffuseTexture1: Texture;
  376. private _diffuseTexture2;
  377. diffuseTexture2: Texture;
  378. private _diffuseTexture3;
  379. diffuseTexture3: Texture;
  380. private _diffuseTexture4;
  381. diffuseTexture4: Texture;
  382. private _diffuseTexture5;
  383. diffuseTexture5: Texture;
  384. private _diffuseTexture6;
  385. diffuseTexture6: Texture;
  386. private _diffuseTexture7;
  387. diffuseTexture7: Texture;
  388. private _diffuseTexture8;
  389. diffuseTexture8: Texture;
  390. /**
  391. * Uniforms
  392. */
  393. diffuseColor: Color3;
  394. specularColor: Color3;
  395. specularPower: number;
  396. private _disableLighting;
  397. disableLighting: boolean;
  398. private _maxSimultaneousLights;
  399. maxSimultaneousLights: number;
  400. private _renderId;
  401. constructor(name: string, scene: Scene);
  402. needAlphaBlending(): boolean;
  403. needAlphaTesting(): boolean;
  404. getAlphaTestTexture(): Nullable<BaseTexture>;
  405. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  406. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  407. getAnimatables(): IAnimatable[];
  408. getActiveTextures(): BaseTexture[];
  409. hasTexture(texture: BaseTexture): boolean;
  410. dispose(forceDisposeEffect?: boolean): void;
  411. clone(name: string): MixMaterial;
  412. serialize(): any;
  413. getClassName(): string;
  414. static Parse(source: any, scene: Scene, rootUrl: string): MixMaterial;
  415. }
  416. }
  417. declare module BABYLON {
  418. class TriPlanarMaterial extends PushMaterial {
  419. mixTexture: BaseTexture;
  420. private _diffuseTextureX;
  421. diffuseTextureX: BaseTexture;
  422. private _diffuseTextureY;
  423. diffuseTextureY: BaseTexture;
  424. private _diffuseTextureZ;
  425. diffuseTextureZ: BaseTexture;
  426. private _normalTextureX;
  427. normalTextureX: BaseTexture;
  428. private _normalTextureY;
  429. normalTextureY: BaseTexture;
  430. private _normalTextureZ;
  431. normalTextureZ: BaseTexture;
  432. tileSize: number;
  433. diffuseColor: Color3;
  434. specularColor: Color3;
  435. specularPower: number;
  436. private _disableLighting;
  437. disableLighting: boolean;
  438. private _maxSimultaneousLights;
  439. maxSimultaneousLights: number;
  440. private _renderId;
  441. constructor(name: string, scene: Scene);
  442. needAlphaBlending(): boolean;
  443. needAlphaTesting(): boolean;
  444. getAlphaTestTexture(): Nullable<BaseTexture>;
  445. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  446. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  447. getAnimatables(): IAnimatable[];
  448. getActiveTextures(): BaseTexture[];
  449. hasTexture(texture: BaseTexture): boolean;
  450. dispose(forceDisposeEffect?: boolean): void;
  451. clone(name: string): TriPlanarMaterial;
  452. serialize(): any;
  453. getClassName(): string;
  454. static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial;
  455. }
  456. }
  457. declare module BABYLON {
  458. /**
  459. * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
  460. * @see https://doc.babylonjs.com/extensions/sky
  461. */
  462. class SkyMaterial extends PushMaterial {
  463. /**
  464. * Defines the overall luminance of sky in interval ]0, 1[.
  465. */
  466. luminance: number;
  467. /**
  468. * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
  469. */
  470. turbidity: number;
  471. /**
  472. * Defines the sky appearance (light intensity).
  473. */
  474. rayleigh: number;
  475. /**
  476. * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
  477. */
  478. mieCoefficient: number;
  479. /**
  480. * Defines the amount of haze particles following the Mie scattering theory.
  481. */
  482. mieDirectionalG: number;
  483. /**
  484. * Defines the distance of the sun according to the active scene camera.
  485. */
  486. distance: number;
  487. /**
  488. * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said
  489. * "inclined".
  490. */
  491. inclination: number;
  492. /**
  493. * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between
  494. * an object direction and a reference direction.
  495. */
  496. azimuth: number;
  497. /**
  498. * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then
  499. * the property is overriden by the inclination and the azimuth and can be read at any moment.
  500. */
  501. sunPosition: Vector3;
  502. /**
  503. * Defines if the sun position should be computed (inclination and azimuth) according to the given
  504. * .sunPosition property.
  505. */
  506. useSunPosition: boolean;
  507. /**
  508. * Defines an offset vector used to get a horizon offset.
  509. * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis
  510. */
  511. cameraOffset: Vector3;
  512. private _cameraPosition;
  513. private _renderId;
  514. /**
  515. * Instantiates a new sky material.
  516. * This material allows to create dynamic and texture free
  517. * effects for skyboxes by taking care of the atmosphere state.
  518. * @see https://doc.babylonjs.com/extensions/sky
  519. * @param name Define the name of the material in the scene
  520. * @param scene Define the scene the material belong to
  521. */
  522. constructor(name: string, scene: Scene);
  523. /**
  524. * Specifies if the material will require alpha blending
  525. * @returns a boolean specifying if alpha blending is needed
  526. */
  527. needAlphaBlending(): boolean;
  528. /**
  529. * Specifies if this material should be rendered in alpha test mode
  530. * @returns false as the sky material doesn't need alpha testing.
  531. */
  532. needAlphaTesting(): boolean;
  533. /**
  534. * Get the texture used for alpha test purpose.
  535. * @returns null as the sky material has no texture.
  536. */
  537. getAlphaTestTexture(): Nullable<BaseTexture>;
  538. /**
  539. * Get if the submesh is ready to be used and all its information available.
  540. * Child classes can use it to update shaders
  541. * @param mesh defines the mesh to check
  542. * @param subMesh defines which submesh to check
  543. * @param useInstances specifies that instances should be used
  544. * @returns a boolean indicating that the submesh is ready or not
  545. */
  546. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  547. /**
  548. * Binds the submesh to this material by preparing the effect and shader to draw
  549. * @param world defines the world transformation matrix
  550. * @param mesh defines the mesh containing the submesh
  551. * @param subMesh defines the submesh to bind the material to
  552. */
  553. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  554. /**
  555. * Get the list of animatables in the material.
  556. * @returns the list of animatables object used in the material
  557. */
  558. getAnimatables(): IAnimatable[];
  559. /**
  560. * Disposes the material
  561. * @param forceDisposeEffect specifies if effects should be forcefully disposed
  562. */
  563. dispose(forceDisposeEffect?: boolean): void;
  564. /**
  565. * Makes a duplicate of the material, and gives it a new name
  566. * @param name defines the new name for the duplicated material
  567. * @returns the cloned material
  568. */
  569. clone(name: string): SkyMaterial;
  570. /**
  571. * Serializes this material in a JSON representation
  572. * @returns the serialized material object
  573. */
  574. serialize(): any;
  575. /**
  576. * Gets the current class name of the material e.g. "SkyMaterial"
  577. * Mainly use in serialization.
  578. * @returns the class name
  579. */
  580. getClassName(): string;
  581. /**
  582. * Creates a sky material from parsed material data
  583. * @param source defines the JSON representation of the material
  584. * @param scene defines the hosting scene
  585. * @param rootUrl defines the root URL to use to load textures and relative dependencies
  586. * @returns a new sky material
  587. */
  588. static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial;
  589. }
  590. }
  591. declare module BABYLON {
  592. /**
  593. * The grid materials allows you to wrap any shape with a grid.
  594. * Colors are customizable.
  595. */
  596. class GridMaterial extends BABYLON.PushMaterial {
  597. /**
  598. * Main color of the grid (e.g. between lines)
  599. */
  600. mainColor: Color3;
  601. /**
  602. * Color of the grid lines.
  603. */
  604. lineColor: Color3;
  605. /**
  606. * The scale of the grid compared to unit.
  607. */
  608. gridRatio: number;
  609. /**
  610. * Allows setting an offset for the grid lines.
  611. */
  612. gridOffset: Vector3;
  613. /**
  614. * The frequency of thicker lines.
  615. */
  616. majorUnitFrequency: number;
  617. /**
  618. * The visibility of minor units in the grid.
  619. */
  620. minorUnitVisibility: number;
  621. /**
  622. * The grid opacity outside of the lines.
  623. */
  624. opacity: number;
  625. /**
  626. * Determine RBG output is premultiplied by alpha value.
  627. */
  628. preMultiplyAlpha: boolean;
  629. private _opacityTexture;
  630. opacityTexture: BaseTexture;
  631. private _gridControl;
  632. private _renderId;
  633. /**
  634. * constructor
  635. * @param name The name given to the material in order to identify it afterwards.
  636. * @param scene The scene the material is used in.
  637. */
  638. constructor(name: string, scene: Scene);
  639. /**
  640. * Returns wehter or not the grid requires alpha blending.
  641. */
  642. needAlphaBlending(): boolean;
  643. needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
  644. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  645. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  646. dispose(forceDisposeEffect?: boolean): void;
  647. clone(name: string): GridMaterial;
  648. serialize(): any;
  649. getClassName(): string;
  650. static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial;
  651. }
  652. }
  653. declare module BABYLON {
  654. class CustomShaderStructure {
  655. FragmentStore: string;
  656. VertexStore: string;
  657. constructor();
  658. }
  659. class ShaderSpecialParts {
  660. constructor();
  661. Fragment_Begin: string;
  662. Fragment_Definitions: string;
  663. Fragment_MainBegin: string;
  664. Fragment_Custom_Diffuse: string;
  665. Fragment_Custom_Alpha: string;
  666. Fragment_Before_FragColor: string;
  667. Vertex_Begin: string;
  668. Vertex_Definitions: string;
  669. Vertex_MainBegin: string;
  670. Vertex_Before_PositionUpdated: string;
  671. Vertex_Before_NormalUpdated: string;
  672. }
  673. class CustomMaterial extends StandardMaterial {
  674. static ShaderIndexer: number;
  675. CustomParts: ShaderSpecialParts;
  676. _isCreatedShader: boolean;
  677. _createdShaderName: string;
  678. _customUniform: string[];
  679. _newUniforms: string[];
  680. _newUniformInstances: any[];
  681. _newSamplerInstances: Texture[];
  682. FragmentShader: string;
  683. VertexShader: string;
  684. AttachAfterBind(mesh: Mesh, effect: Effect): void;
  685. ReviewUniform(name: string, arr: string[]): string[];
  686. Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines): string;
  687. constructor(name: string, scene: Scene);
  688. AddUniform(name: string, kind: string, param: any): CustomMaterial;
  689. Fragment_Begin(shaderPart: string): CustomMaterial;
  690. Fragment_Definitions(shaderPart: string): CustomMaterial;
  691. Fragment_MainBegin(shaderPart: string): CustomMaterial;
  692. Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
  693. Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
  694. Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
  695. Vertex_Begin(shaderPart: string): CustomMaterial;
  696. Vertex_Definitions(shaderPart: string): CustomMaterial;
  697. Vertex_MainBegin(shaderPart: string): CustomMaterial;
  698. Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
  699. Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
  700. }
  701. }
  702. declare module BABYLON {
  703. class CellMaterial extends PushMaterial {
  704. private _diffuseTexture;
  705. diffuseTexture: BaseTexture;
  706. diffuseColor: Color3;
  707. _computeHighLevel: boolean;
  708. computeHighLevel: boolean;
  709. private _disableLighting;
  710. disableLighting: boolean;
  711. private _maxSimultaneousLights;
  712. maxSimultaneousLights: number;
  713. private _renderId;
  714. constructor(name: string, scene: Scene);
  715. needAlphaBlending(): boolean;
  716. needAlphaTesting(): boolean;
  717. getAlphaTestTexture(): Nullable<BaseTexture>;
  718. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  719. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  720. getAnimatables(): IAnimatable[];
  721. getActiveTextures(): BaseTexture[];
  722. hasTexture(texture: BaseTexture): boolean;
  723. dispose(forceDisposeEffect?: boolean): void;
  724. getClassName(): string;
  725. clone(name: string): CellMaterial;
  726. serialize(): any;
  727. static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial;
  728. }
  729. }