babylonjs.materials.d.ts 28 KB

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