babylonjs.materials.d.ts 38 KB

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