babylonjs.materials.d.ts 37 KB

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