babylonjs.materials.d.ts 38 KB

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