babylon.customMaterial.d.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. declare module BABYLON {
  2. class StandardMaterialDefines_OldVer extends MaterialDefines implements IImageProcessingConfigurationDefines {
  3. DIFFUSE: boolean;
  4. AMBIENT: boolean;
  5. OPACITY: boolean;
  6. OPACITYRGB: boolean;
  7. REFLECTION: boolean;
  8. EMISSIVE: boolean;
  9. SPECULAR: boolean;
  10. BUMP: boolean;
  11. PARALLAX: boolean;
  12. PARALLAXOCCLUSION: boolean;
  13. SPECULAROVERALPHA: boolean;
  14. CLIPPLANE: boolean;
  15. ALPHATEST: boolean;
  16. ALPHAFROMDIFFUSE: boolean;
  17. POINTSIZE: boolean;
  18. FOG: boolean;
  19. SPECULARTERM: boolean;
  20. DIFFUSEFRESNEL: boolean;
  21. OPACITYFRESNEL: boolean;
  22. REFLECTIONFRESNEL: boolean;
  23. REFRACTIONFRESNEL: boolean;
  24. EMISSIVEFRESNEL: boolean;
  25. FRESNEL: boolean;
  26. NORMAL: boolean;
  27. UV1: boolean;
  28. UV2: boolean;
  29. VERTEXCOLOR: boolean;
  30. VERTEXALPHA: boolean;
  31. NUM_BONE_INFLUENCERS: number;
  32. BonesPerMesh: number;
  33. INSTANCES: boolean;
  34. GLOSSINESS: boolean;
  35. ROUGHNESS: boolean;
  36. EMISSIVEASILLUMINATION: boolean;
  37. LINKEMISSIVEWITHDIFFUSE: boolean;
  38. REFLECTIONFRESNELFROMSPECULAR: boolean;
  39. LIGHTMAP: boolean;
  40. USELIGHTMAPASSHADOWMAP: boolean;
  41. REFLECTIONMAP_3D: boolean;
  42. REFLECTIONMAP_SPHERICAL: boolean;
  43. REFLECTIONMAP_PLANAR: boolean;
  44. REFLECTIONMAP_CUBIC: boolean;
  45. REFLECTIONMAP_PROJECTION: boolean;
  46. REFLECTIONMAP_SKYBOX: boolean;
  47. REFLECTIONMAP_EXPLICIT: boolean;
  48. REFLECTIONMAP_EQUIRECTANGULAR: boolean;
  49. REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
  50. REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
  51. INVERTCUBICMAP: boolean;
  52. LOGARITHMICDEPTH: boolean;
  53. REFRACTION: boolean;
  54. REFRACTIONMAP_3D: boolean;
  55. REFLECTIONOVERALPHA: boolean;
  56. TWOSIDEDLIGHTING: boolean;
  57. SHADOWFLOAT: boolean;
  58. MORPHTARGETS: boolean;
  59. MORPHTARGETS_NORMAL: boolean;
  60. MORPHTARGETS_TANGENT: boolean;
  61. NUM_MORPH_INFLUENCERS: number;
  62. IMAGEPROCESSING: boolean;
  63. VIGNETTE: boolean;
  64. VIGNETTEBLENDMODEMULTIPLY: boolean;
  65. VIGNETTEBLENDMODEOPAQUE: boolean;
  66. TONEMAPPING: boolean;
  67. CONTRAST: boolean;
  68. COLORCURVES: boolean;
  69. COLORGRADING: boolean;
  70. COLORGRADING3D: boolean;
  71. SAMPLER3DGREENDEPTH: boolean;
  72. SAMPLER3DBGRMAP: boolean;
  73. IMAGEPROCESSINGPOSTPROCESS: boolean;
  74. EXPOSURE: boolean;
  75. GRAIN: boolean;
  76. constructor();
  77. setReflectionMode(modeToEnable: string): void;
  78. }
  79. class StandardMaterial_OldVer extends PushMaterial {
  80. private _diffuseTexture;
  81. diffuseTexture: BaseTexture;
  82. private _ambientTexture;
  83. ambientTexture: BaseTexture;
  84. private _opacityTexture;
  85. opacityTexture: BaseTexture;
  86. private _reflectionTexture;
  87. reflectionTexture: BaseTexture;
  88. private _emissiveTexture;
  89. emissiveTexture: BaseTexture;
  90. private _specularTexture;
  91. specularTexture: BaseTexture;
  92. private _bumpTexture;
  93. bumpTexture: BaseTexture;
  94. private _lightmapTexture;
  95. lightmapTexture: BaseTexture;
  96. private _refractionTexture;
  97. refractionTexture: BaseTexture;
  98. ambientColor: Color3;
  99. diffuseColor: Color3;
  100. specularColor: Color3;
  101. emissiveColor: Color3;
  102. specularPower: number;
  103. private _useAlphaFromDiffuseTexture;
  104. useAlphaFromDiffuseTexture: boolean;
  105. private _useEmissiveAsIllumination;
  106. useEmissiveAsIllumination: boolean;
  107. private _linkEmissiveWithDiffuse;
  108. linkEmissiveWithDiffuse: boolean;
  109. private _useSpecularOverAlpha;
  110. useSpecularOverAlpha: boolean;
  111. private _useReflectionOverAlpha;
  112. useReflectionOverAlpha: boolean;
  113. private _disableLighting;
  114. disableLighting: boolean;
  115. private _useParallax;
  116. useParallax: boolean;
  117. private _useParallaxOcclusion;
  118. useParallaxOcclusion: boolean;
  119. parallaxScaleBias: number;
  120. private _roughness;
  121. roughness: number;
  122. indexOfRefraction: number;
  123. invertRefractionY: boolean;
  124. private _useLightmapAsShadowmap;
  125. useLightmapAsShadowmap: boolean;
  126. private _diffuseFresnelParameters;
  127. diffuseFresnelParameters: FresnelParameters;
  128. private _opacityFresnelParameters;
  129. opacityFresnelParameters: FresnelParameters;
  130. private _reflectionFresnelParameters;
  131. reflectionFresnelParameters: FresnelParameters;
  132. private _refractionFresnelParameters;
  133. refractionFresnelParameters: FresnelParameters;
  134. private _emissiveFresnelParameters;
  135. emissiveFresnelParameters: FresnelParameters;
  136. private _useReflectionFresnelFromSpecular;
  137. useReflectionFresnelFromSpecular: boolean;
  138. private _useGlossinessFromSpecularMapAlpha;
  139. useGlossinessFromSpecularMapAlpha: boolean;
  140. private _maxSimultaneousLights;
  141. maxSimultaneousLights: number;
  142. /**
  143. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  144. */
  145. private _invertNormalMapX;
  146. invertNormalMapX: boolean;
  147. /**
  148. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  149. */
  150. private _invertNormalMapY;
  151. invertNormalMapY: boolean;
  152. /**
  153. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  154. */
  155. private _twoSidedLighting;
  156. twoSidedLighting: boolean;
  157. /**
  158. * Default configuration related to image processing available in the standard Material.
  159. */
  160. protected _imageProcessingConfiguration: ImageProcessingConfiguration;
  161. /**
  162. * Gets the image processing configuration used either in this material.
  163. */
  164. /**
  165. * Sets the Default image processing configuration used either in the this material.
  166. *
  167. * If sets to null, the scene one is in use.
  168. */
  169. imageProcessingConfiguration: ImageProcessingConfiguration;
  170. /**
  171. * Keep track of the image processing observer to allow dispose and replace.
  172. */
  173. private _imageProcessingObserver;
  174. /**
  175. * Attaches a new image processing configuration to the Standard Material.
  176. * @param configuration
  177. */
  178. protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void;
  179. /**
  180. * Gets wether the color curves effect is enabled.
  181. */
  182. /**
  183. * Sets wether the color curves effect is enabled.
  184. */
  185. cameraColorCurvesEnabled: boolean;
  186. /**
  187. * Gets wether the color grading effect is enabled.
  188. */
  189. /**
  190. * Gets wether the color grading effect is enabled.
  191. */
  192. cameraColorGradingEnabled: boolean;
  193. /**
  194. * Gets wether tonemapping is enabled or not.
  195. */
  196. /**
  197. * Sets wether tonemapping is enabled or not
  198. */
  199. cameraToneMappingEnabled: boolean;
  200. /**
  201. * The camera exposure used on this material.
  202. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  203. * This corresponds to a photographic exposure.
  204. */
  205. /**
  206. * The camera exposure used on this material.
  207. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  208. * This corresponds to a photographic exposure.
  209. */
  210. cameraExposure: number;
  211. /**
  212. * Gets The camera contrast used on this material.
  213. */
  214. /**
  215. * Sets The camera contrast used on this material.
  216. */
  217. cameraContrast: number;
  218. /**
  219. * Gets the Color Grading 2D Lookup Texture.
  220. */
  221. /**
  222. * Sets the Color Grading 2D Lookup Texture.
  223. */
  224. cameraColorGradingTexture: Nullable<BaseTexture>;
  225. protected _shouldTurnAlphaTestOn(mesh: AbstractMesh): boolean;
  226. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer) => string;
  227. protected _renderTargets: SmartArray<RenderTargetTexture>;
  228. protected _worldViewProjectionMatrix: Matrix;
  229. protected _globalAmbientColor: Color3;
  230. protected _useLogarithmicDepth: boolean;
  231. constructor(name: string, scene: Scene);
  232. getClassName(): string;
  233. useLogarithmicDepth: boolean;
  234. needAlphaBlending(): boolean;
  235. needAlphaTesting(): boolean;
  236. protected _shouldUseAlphaFromDiffuseTexture(): boolean;
  237. getAlphaTestTexture(): BaseTexture;
  238. /**
  239. * Child classes can use it to update shaders
  240. */
  241. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  242. buildUniformLayout(): void;
  243. unbind(): void;
  244. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  245. getAnimatables(): IAnimatable[];
  246. getActiveTextures(): BaseTexture[];
  247. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  248. clone(name: string): StandardMaterial_OldVer;
  249. serialize(): any;
  250. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial_OldVer;
  251. static _DiffuseTextureEnabled: boolean;
  252. static DiffuseTextureEnabled: boolean;
  253. static _AmbientTextureEnabled: boolean;
  254. static AmbientTextureEnabled: boolean;
  255. static _OpacityTextureEnabled: boolean;
  256. static OpacityTextureEnabled: boolean;
  257. static _ReflectionTextureEnabled: boolean;
  258. static ReflectionTextureEnabled: boolean;
  259. static _EmissiveTextureEnabled: boolean;
  260. static EmissiveTextureEnabled: boolean;
  261. static _SpecularTextureEnabled: boolean;
  262. static SpecularTextureEnabled: boolean;
  263. static _BumpTextureEnabled: boolean;
  264. static BumpTextureEnabled: boolean;
  265. static _LightmapTextureEnabled: boolean;
  266. static LightmapTextureEnabled: boolean;
  267. static _RefractionTextureEnabled: boolean;
  268. static RefractionTextureEnabled: boolean;
  269. static _ColorGradingTextureEnabled: boolean;
  270. static ColorGradingTextureEnabled: boolean;
  271. static _FresnelEnabled: boolean;
  272. static FresnelEnabled: boolean;
  273. }
  274. class CustomShaderStructure {
  275. FragmentStore: string;
  276. VertexStore: string;
  277. constructor();
  278. }
  279. class ShaderSpecialParts {
  280. constructor();
  281. Fragment_Begin: string;
  282. Fragment_Definitions: string;
  283. Fragment_MainBegin: string;
  284. Fragment_Custom_Diffuse: string;
  285. Fragment_Custom_Alpha: string;
  286. Fragment_Before_FragColor: string;
  287. Vertex_Begin: string;
  288. Vertex_Definitions: string;
  289. Vertex_MainBegin: string;
  290. Vertex_Before_PositionUpdated: string;
  291. Vertex_Before_NormalUpdated: string;
  292. }
  293. class ShaderForVer3_0 extends CustomShaderStructure {
  294. constructor();
  295. }
  296. class StandardShaderVersions {
  297. static Ver3_0: string;
  298. }
  299. class CustomMaterial extends StandardMaterial_OldVer {
  300. static ShaderIndexer: number;
  301. CustomParts: ShaderSpecialParts;
  302. ShaderVersion: CustomShaderStructure;
  303. _isCreatedShader: boolean;
  304. _createdShaderName: string;
  305. _customUniform: string[];
  306. _newUniforms: string[];
  307. _newUniformInstances: any[];
  308. _newSamplerInstances: Texture[];
  309. AttachAfterBind(mesh: Mesh, effect: Effect): void;
  310. ReviewUniform(name: string, arr: string[]): string[];
  311. Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer): string;
  312. SelectVersion(ver: string): void;
  313. constructor(name: string, scene: Scene);
  314. AddUniform(name: string, kind: string, param: any): CustomMaterial;
  315. Fragment_Begin(shaderPart: string): CustomMaterial;
  316. Fragment_Definitions(shaderPart: string): CustomMaterial;
  317. Fragment_MainBegin(shaderPart: string): CustomMaterial;
  318. Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
  319. Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
  320. Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
  321. Vertex_Begin(shaderPart: string): CustomMaterial;
  322. Vertex_Definitions(shaderPart: string): CustomMaterial;
  323. Vertex_MainBegin(shaderPart: string): CustomMaterial;
  324. Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
  325. Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
  326. }
  327. }