babylonjs.materials.d.ts 38 KB

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