babylon.customMaterial.d.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. SAMPLER3DGREENDEPTH: boolean;
  71. SAMPLER3DBGRMAP: boolean;
  72. IMAGEPROCESSINGPOSTPROCESS: boolean;
  73. EXPOSURE: boolean;
  74. constructor();
  75. setReflectionMode(modeToEnable: string): void;
  76. }
  77. class StandardMaterial_OldVer extends PushMaterial {
  78. private _diffuseTexture;
  79. diffuseTexture: BaseTexture;
  80. private _ambientTexture;
  81. ambientTexture: BaseTexture;
  82. private _opacityTexture;
  83. opacityTexture: BaseTexture;
  84. private _reflectionTexture;
  85. reflectionTexture: BaseTexture;
  86. private _emissiveTexture;
  87. emissiveTexture: BaseTexture;
  88. private _specularTexture;
  89. specularTexture: BaseTexture;
  90. private _bumpTexture;
  91. bumpTexture: BaseTexture;
  92. private _lightmapTexture;
  93. lightmapTexture: BaseTexture;
  94. private _refractionTexture;
  95. refractionTexture: BaseTexture;
  96. ambientColor: Color3;
  97. diffuseColor: Color3;
  98. specularColor: Color3;
  99. emissiveColor: Color3;
  100. specularPower: number;
  101. private _useAlphaFromDiffuseTexture;
  102. useAlphaFromDiffuseTexture: boolean;
  103. private _useEmissiveAsIllumination;
  104. useEmissiveAsIllumination: boolean;
  105. private _linkEmissiveWithDiffuse;
  106. linkEmissiveWithDiffuse: boolean;
  107. private _useSpecularOverAlpha;
  108. useSpecularOverAlpha: boolean;
  109. private _useReflectionOverAlpha;
  110. useReflectionOverAlpha: boolean;
  111. private _disableLighting;
  112. disableLighting: boolean;
  113. private _useParallax;
  114. useParallax: boolean;
  115. private _useParallaxOcclusion;
  116. useParallaxOcclusion: boolean;
  117. parallaxScaleBias: number;
  118. private _roughness;
  119. roughness: number;
  120. indexOfRefraction: number;
  121. invertRefractionY: boolean;
  122. private _useLightmapAsShadowmap;
  123. useLightmapAsShadowmap: boolean;
  124. private _diffuseFresnelParameters;
  125. diffuseFresnelParameters: FresnelParameters;
  126. private _opacityFresnelParameters;
  127. opacityFresnelParameters: FresnelParameters;
  128. private _reflectionFresnelParameters;
  129. reflectionFresnelParameters: FresnelParameters;
  130. private _refractionFresnelParameters;
  131. refractionFresnelParameters: FresnelParameters;
  132. private _emissiveFresnelParameters;
  133. emissiveFresnelParameters: FresnelParameters;
  134. private _useReflectionFresnelFromSpecular;
  135. useReflectionFresnelFromSpecular: boolean;
  136. private _useGlossinessFromSpecularMapAlpha;
  137. useGlossinessFromSpecularMapAlpha: boolean;
  138. private _maxSimultaneousLights;
  139. maxSimultaneousLights: number;
  140. /**
  141. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  142. */
  143. private _invertNormalMapX;
  144. invertNormalMapX: boolean;
  145. /**
  146. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  147. */
  148. private _invertNormalMapY;
  149. invertNormalMapY: boolean;
  150. /**
  151. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  152. */
  153. private _twoSidedLighting;
  154. twoSidedLighting: boolean;
  155. /**
  156. * Default configuration related to image processing available in the standard Material.
  157. */
  158. protected _imageProcessingConfiguration: ImageProcessingConfiguration;
  159. /**
  160. * Gets the image processing configuration used either in this material.
  161. */
  162. /**
  163. * Sets the Default image processing configuration used either in the this material.
  164. *
  165. * If sets to null, the scene one is in use.
  166. */
  167. imageProcessingConfiguration: ImageProcessingConfiguration;
  168. /**
  169. * Keep track of the image processing observer to allow dispose and replace.
  170. */
  171. private _imageProcessingObserver;
  172. /**
  173. * Attaches a new image processing configuration to the Standard Material.
  174. * @param configuration
  175. */
  176. protected _attachImageProcessingConfiguration(configuration: ImageProcessingConfiguration): void;
  177. /**
  178. * Gets wether the color curves effect is enabled.
  179. */
  180. /**
  181. * Sets wether the color curves effect is enabled.
  182. */
  183. cameraColorCurvesEnabled: boolean;
  184. /**
  185. * Gets wether the color grading effect is enabled.
  186. */
  187. /**
  188. * Gets wether the color grading effect is enabled.
  189. */
  190. cameraColorGradingEnabled: boolean;
  191. /**
  192. * Gets wether tonemapping is enabled or not.
  193. */
  194. /**
  195. * Sets wether tonemapping is enabled or not
  196. */
  197. cameraToneMappingEnabled: boolean;
  198. /**
  199. * The camera exposure used on this material.
  200. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  201. * This corresponds to a photographic exposure.
  202. */
  203. /**
  204. * The camera exposure used on this material.
  205. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  206. * This corresponds to a photographic exposure.
  207. */
  208. cameraExposure: number;
  209. /**
  210. * Gets The camera contrast used on this material.
  211. */
  212. /**
  213. * Sets The camera contrast used on this material.
  214. */
  215. cameraContrast: number;
  216. /**
  217. * Gets the Color Grading 2D Lookup Texture.
  218. */
  219. /**
  220. * Sets the Color Grading 2D Lookup Texture.
  221. */
  222. cameraColorGradingTexture: BaseTexture;
  223. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer) => string;
  224. protected _renderTargets: SmartArray<RenderTargetTexture>;
  225. protected _worldViewProjectionMatrix: Matrix;
  226. protected _globalAmbientColor: Color3;
  227. protected _useLogarithmicDepth: boolean;
  228. constructor(name: string, scene: Scene);
  229. getClassName(): string;
  230. useLogarithmicDepth: boolean;
  231. needAlphaBlending(): boolean;
  232. needAlphaTesting(): boolean;
  233. protected _shouldUseAlphaFromDiffuseTexture(): boolean;
  234. getAlphaTestTexture(): BaseTexture;
  235. /**
  236. * Child classes can use it to update shaders
  237. */
  238. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  239. buildUniformLayout(): void;
  240. unbind(): void;
  241. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  242. getAnimatables(): IAnimatable[];
  243. getActiveTextures(): BaseTexture[];
  244. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  245. clone(name: string): StandardMaterial_OldVer;
  246. serialize(): any;
  247. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial_OldVer;
  248. static _DiffuseTextureEnabled: boolean;
  249. static DiffuseTextureEnabled: boolean;
  250. static _AmbientTextureEnabled: boolean;
  251. static AmbientTextureEnabled: boolean;
  252. static _OpacityTextureEnabled: boolean;
  253. static OpacityTextureEnabled: boolean;
  254. static _ReflectionTextureEnabled: boolean;
  255. static ReflectionTextureEnabled: boolean;
  256. static _EmissiveTextureEnabled: boolean;
  257. static EmissiveTextureEnabled: boolean;
  258. static _SpecularTextureEnabled: boolean;
  259. static SpecularTextureEnabled: boolean;
  260. static _BumpTextureEnabled: boolean;
  261. static BumpTextureEnabled: boolean;
  262. static _LightmapTextureEnabled: boolean;
  263. static LightmapTextureEnabled: boolean;
  264. static _RefractionTextureEnabled: boolean;
  265. static RefractionTextureEnabled: boolean;
  266. static _ColorGradingTextureEnabled: boolean;
  267. static ColorGradingTextureEnabled: boolean;
  268. static _FresnelEnabled: boolean;
  269. static FresnelEnabled: boolean;
  270. }
  271. class CustomShaderStructure {
  272. FragmentStore: string;
  273. VertexStore: string;
  274. constructor();
  275. }
  276. class ShaderSpecialParts {
  277. constructor();
  278. Fragment_Begin: string;
  279. Fragment_Definitions: string;
  280. Fragment_MainBegin: string;
  281. Fragment_Custom_Diffuse: string;
  282. Fragment_Custom_Alpha: string;
  283. Fragment_Before_FragColor: string;
  284. Vertex_Begin: string;
  285. Vertex_Definitions: string;
  286. Vertex_MainBegin: string;
  287. Vertex_Before_PositionUpdated: string;
  288. Vertex_Before_NormalUpdated: string;
  289. }
  290. class ShaderForVer3_0 extends CustomShaderStructure {
  291. constructor();
  292. }
  293. class StandardShaderVersions {
  294. static Ver3_0: string;
  295. }
  296. class CustomMaterial extends StandardMaterial_OldVer {
  297. static ShaderIndexer: number;
  298. CustomParts: ShaderSpecialParts;
  299. ShaderVersion: CustomShaderStructure;
  300. _isCreatedShader: boolean;
  301. _createdShaderName: string;
  302. _customUniform: string[];
  303. _newUniforms: string[];
  304. _newUniformInstances: any[];
  305. _newSamplerInstances: Texture[];
  306. AttachAfterBind(mesh: Mesh, effect: Effect): void;
  307. ReviewUniform(name: string, arr: string[]): string[];
  308. Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer): string;
  309. SelectVersion(ver: string): void;
  310. constructor(name: string, scene: Scene);
  311. AddUniform(name: string, kind: string, param: any): CustomMaterial;
  312. Fragment_Begin(shaderPart: string): CustomMaterial;
  313. Fragment_Definitions(shaderPart: string): CustomMaterial;
  314. Fragment_MainBegin(shaderPart: string): CustomMaterial;
  315. Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
  316. Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
  317. Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
  318. Vertex_Begin(shaderPart: string): CustomMaterial;
  319. Vertex_Definitions(shaderPart: string): CustomMaterial;
  320. Vertex_MainBegin(shaderPart: string): CustomMaterial;
  321. Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
  322. Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
  323. }
  324. }