babylon.d.ts 158 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648
  1. declare module BABYLON {
  2. class _DepthCullingState {
  3. private _isDepthTestDirty;
  4. private _isDepthMaskDirty;
  5. private _isDepthFuncDirty;
  6. private _isCullFaceDirty;
  7. private _isCullDirty;
  8. private _depthTest;
  9. private _depthMask;
  10. private _depthFunc;
  11. private _cull;
  12. private _cullFace;
  13. public isDirty : boolean;
  14. public cullFace : number;
  15. public cull : boolean;
  16. public depthFunc : number;
  17. public depthMask : boolean;
  18. public depthTest : boolean;
  19. public reset(): void;
  20. public apply(gl: WebGLRenderingContext): void;
  21. }
  22. class _AlphaState {
  23. private _isAlphaBlendDirty;
  24. private _isBlendFunctionParametersDirty;
  25. private _alphaBlend;
  26. private _blendFunctionParameters;
  27. public isDirty : boolean;
  28. public alphaBlend : boolean;
  29. public setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  30. public reset(): void;
  31. public apply(gl: WebGLRenderingContext): void;
  32. }
  33. class EngineCapabilities {
  34. public maxTexturesImageUnits: number;
  35. public maxTextureSize: number;
  36. public maxCubemapTextureSize: number;
  37. public maxRenderTextureSize: number;
  38. public standardDerivatives: boolean;
  39. public s3tc: any;
  40. public textureFloat: boolean;
  41. public textureAnisotropicFilterExtension: any;
  42. public maxAnisotropy: number;
  43. public instancedArrays: any;
  44. }
  45. class Engine {
  46. private static _ALPHA_DISABLE;
  47. private static _ALPHA_ADD;
  48. private static _ALPHA_COMBINE;
  49. private static _DELAYLOADSTATE_NONE;
  50. private static _DELAYLOADSTATE_LOADED;
  51. private static _DELAYLOADSTATE_LOADING;
  52. private static _DELAYLOADSTATE_NOTLOADED;
  53. static ALPHA_DISABLE : number;
  54. static ALPHA_ADD : number;
  55. static ALPHA_COMBINE : number;
  56. static DELAYLOADSTATE_NONE : number;
  57. static DELAYLOADSTATE_LOADED : number;
  58. static DELAYLOADSTATE_LOADING : number;
  59. static DELAYLOADSTATE_NOTLOADED : number;
  60. static Version : string;
  61. static Epsilon: number;
  62. static CollisionsEpsilon: number;
  63. static ShadersRepository: string;
  64. public isFullscreen: boolean;
  65. public isPointerLock: boolean;
  66. public forceWireframe: boolean;
  67. public cullBackFaces: boolean;
  68. public renderEvenInBackground: boolean;
  69. public scenes: Scene[];
  70. private _gl;
  71. private _renderingCanvas;
  72. private _windowIsBackground;
  73. private _onBlur;
  74. private _onFocus;
  75. private _onFullscreenChange;
  76. private _onPointerLockChange;
  77. private _hardwareScalingLevel;
  78. private _caps;
  79. private _pointerLockRequested;
  80. private _alphaTest;
  81. private _runningLoop;
  82. private _renderFunction;
  83. private _resizeLoadingUI;
  84. private _loadingDiv;
  85. private _loadingTextDiv;
  86. private _loadingDivBackgroundColor;
  87. private _depthCullingState;
  88. private _alphaState;
  89. private _loadedTexturesCache;
  90. public _activeTexturesCache: BaseTexture[];
  91. private _currentEffect;
  92. private _compiledEffects;
  93. private _vertexAttribArrays;
  94. private _cachedViewport;
  95. private _cachedVertexBuffers;
  96. private _cachedIndexBuffer;
  97. private _cachedEffectForVertexBuffers;
  98. private _currentRenderTarget;
  99. private _canvasClientRect;
  100. private _workingCanvas;
  101. private _workingContext;
  102. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: any);
  103. public getAspectRatio(camera: Camera): number;
  104. public getRenderWidth(): number;
  105. public getRenderHeight(): number;
  106. public getRenderingCanvas(): HTMLCanvasElement;
  107. public getRenderingCanvasClientRect(): ClientRect;
  108. public setHardwareScalingLevel(level: number): void;
  109. public getHardwareScalingLevel(): number;
  110. public getLoadedTexturesCache(): WebGLTexture[];
  111. public getCaps(): EngineCapabilities;
  112. public setDepthFunctionToGreater(): void;
  113. public setDepthFunctionToGreaterOrEqual(): void;
  114. public setDepthFunctionToLess(): void;
  115. public setDepthFunctionToLessOrEqual(): void;
  116. public stopRenderLoop(): void;
  117. public _renderLoop(): void;
  118. public runRenderLoop(renderFunction: () => void): void;
  119. public switchFullscreen(requestPointerLock: boolean): void;
  120. public clear(color: any, backBuffer: boolean, depthStencil: boolean): void;
  121. public setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  122. public setDirectViewport(x: number, y: number, width: number, height: number): void;
  123. public beginFrame(): void;
  124. public endFrame(): void;
  125. public resize(): void;
  126. public bindFramebuffer(texture: WebGLTexture): void;
  127. public unBindFramebuffer(texture: WebGLTexture): void;
  128. public flushFramebuffer(): void;
  129. public restoreDefaultFramebuffer(): void;
  130. private _resetVertexBufferBinding();
  131. public createVertexBuffer(vertices: number[]): WebGLBuffer;
  132. public createDynamicVertexBuffer(capacity: number): WebGLBuffer;
  133. public updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: any, length?: number): void;
  134. private _resetIndexBufferBinding();
  135. public createIndexBuffer(indices: number[]): WebGLBuffer;
  136. public bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  137. public bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void;
  138. public _releaseBuffer(buffer: WebGLBuffer): boolean;
  139. public createInstancesBuffer(capacity: number): WebGLBuffer;
  140. public deleteInstancesBuffer(buffer: WebGLBuffer): void;
  141. public updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void;
  142. public unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void;
  143. public applyStates(): void;
  144. public draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  145. public _releaseEffect(effect: Effect): void;
  146. public createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  147. public createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  148. public createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram;
  149. public getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  150. public getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  151. public enableEffect(effect: Effect): void;
  152. public setArray(uniform: WebGLUniformLocation, array: number[]): void;
  153. public setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  154. public setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  155. public setFloat(uniform: WebGLUniformLocation, value: number): void;
  156. public setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  157. public setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  158. public setBool(uniform: WebGLUniformLocation, bool: number): void;
  159. public setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  160. public setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  161. public setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  162. public setState(culling: boolean, force?: boolean): void;
  163. public setDepthBuffer(enable: boolean): void;
  164. public getDepthWrite(): boolean;
  165. public setDepthWrite(enable: boolean): void;
  166. public setColorWrite(enable: boolean): void;
  167. public setAlphaMode(mode: number): void;
  168. public setAlphaTesting(enable: boolean): void;
  169. public getAlphaTesting(): boolean;
  170. public wipeCaches(): void;
  171. public setSamplingMode(texture: WebGLTexture, samplingMode: number): void;
  172. public createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void): WebGLTexture;
  173. public createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture;
  174. public updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void;
  175. public updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  176. public createRenderTargetTexture(size: any, options: any): WebGLTexture;
  177. public createCubeTexture(rootUrl: string, scene: Scene, extensions: string[], noMipmap?: boolean): WebGLTexture;
  178. public _releaseTexture(texture: WebGLTexture): void;
  179. public bindSamplers(effect: Effect): void;
  180. public _bindTexture(channel: number, texture: WebGLTexture): void;
  181. public setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
  182. public setTexture(channel: number, texture: BaseTexture): void;
  183. public _setAnisotropicLevel(key: number, texture: BaseTexture): void;
  184. public readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  185. public dispose(): void;
  186. public displayLoadingUI(): void;
  187. public loadingUIText : string;
  188. public loadingUIBackgroundColor : string;
  189. public hideLoadingUI(): void;
  190. static isSupported(): boolean;
  191. }
  192. }
  193. interface Window {
  194. mozIndexedDB(func: any): any;
  195. webkitIndexedDB(func: any): any;
  196. IDBTransaction(func: any): any;
  197. webkitIDBTransaction(func: any): any;
  198. msIDBTransaction(func: any): any;
  199. IDBKeyRange(func: any): any;
  200. webkitIDBKeyRange(func: any): any;
  201. msIDBKeyRange(func: any): any;
  202. URL: HTMLURL;
  203. webkitURL: HTMLURL;
  204. webkitRequestAnimationFrame(func: any): any;
  205. mozRequestAnimationFrame(func: any): any;
  206. oRequestAnimationFrame(func: any): any;
  207. WebGLRenderingContext: WebGLRenderingContext;
  208. MSGesture: MSGesture;
  209. }
  210. interface HTMLURL {
  211. createObjectURL(param1: any, param2?: any): any;
  212. }
  213. interface Document {
  214. exitFullscreen(): void;
  215. webkitCancelFullScreen(): void;
  216. mozCancelFullScreen(): void;
  217. msCancelFullScreen(): void;
  218. webkitIsFullScreen: boolean;
  219. mozFullScreen: boolean;
  220. msIsFullScreen: boolean;
  221. fullscreen: boolean;
  222. mozPointerLockElement: HTMLElement;
  223. msPointerLockElement: HTMLElement;
  224. webkitPointerLockElement: HTMLElement;
  225. pointerLockElement: HTMLElement;
  226. }
  227. interface HTMLCanvasElement {
  228. requestPointerLock(): void;
  229. msRequestPointerLock(): void;
  230. mozRequestPointerLock(): void;
  231. webkitRequestPointerLock(): void;
  232. }
  233. interface WebGLTexture {
  234. isReady: boolean;
  235. isCube: boolean;
  236. url: string;
  237. noMipmap: boolean;
  238. references: number;
  239. generateMipMaps: boolean;
  240. _size: number;
  241. _baseWidth: number;
  242. _baseHeight: number;
  243. _width: number;
  244. _height: number;
  245. _workingCanvas: HTMLCanvasElement;
  246. _workingContext: CanvasRenderingContext2D;
  247. _framebuffer: WebGLFramebuffer;
  248. _depthBuffer: WebGLRenderbuffer;
  249. _cachedCoordinatesMode: number;
  250. _cachedWrapU: number;
  251. _cachedWrapV: number;
  252. }
  253. interface WebGLBuffer {
  254. references: number;
  255. capacity: number;
  256. }
  257. interface MouseEvent {
  258. movementX: number;
  259. movementY: number;
  260. mozMovementX: number;
  261. mozMovementY: number;
  262. webkitMovementX: number;
  263. webkitMovementY: number;
  264. msMovementX: number;
  265. msMovementY: number;
  266. }
  267. interface MSStyleCSSProperties {
  268. webkitTransform: string;
  269. webkitTransition: string;
  270. }
  271. interface Navigator {
  272. getVRDevices: () => any;
  273. mozGetVRDevices: (any: any) => any;
  274. }
  275. declare module BABYLON {
  276. class Node {
  277. public parent: Node;
  278. public name: string;
  279. public id: string;
  280. public state: string;
  281. public animations: Animation[];
  282. public onReady: (node: Node) => void;
  283. private _childrenFlag;
  284. private _isEnabled;
  285. private _isReady;
  286. public _currentRenderId: number;
  287. public _waitingParentId: string;
  288. private _scene;
  289. public _cache: any;
  290. constructor(name: string, scene: any);
  291. public getScene(): Scene;
  292. public getEngine(): Engine;
  293. public getWorldMatrix(): Matrix;
  294. public _initCache(): void;
  295. public updateCache(force?: boolean): void;
  296. public _updateCache(ignoreParentClass?: boolean): void;
  297. public _isSynchronized(): boolean;
  298. public isSynchronizedWithParent(): boolean;
  299. public isSynchronized(updateCache?: boolean): boolean;
  300. public hasNewParent(update?: boolean): boolean;
  301. public isReady(): boolean;
  302. public isEnabled(): boolean;
  303. public setEnabled(value: boolean): void;
  304. public isDescendantOf(ancestor: Node): boolean;
  305. public _getDescendants(list: Node[], results: Node[]): void;
  306. public getDescendants(): Node[];
  307. public _setReady(state: boolean): void;
  308. }
  309. }
  310. declare module BABYLON {
  311. interface IDisposable {
  312. dispose(): void;
  313. }
  314. class Scene {
  315. static FOGMODE_NONE: number;
  316. static FOGMODE_EXP: number;
  317. static FOGMODE_EXP2: number;
  318. static FOGMODE_LINEAR: number;
  319. static MinDeltaTime: number;
  320. static MaxDeltaTime: number;
  321. public autoClear: boolean;
  322. public clearColor: any;
  323. public ambientColor: Color3;
  324. public beforeRender: () => void;
  325. public afterRender: () => void;
  326. public onDispose: () => void;
  327. public beforeCameraRender: (camera: Camera) => void;
  328. public afterCameraRender: (camera: Camera) => void;
  329. public forceWireframe: boolean;
  330. public clipPlane: Plane;
  331. private _onPointerMove;
  332. private _onPointerDown;
  333. public onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  334. public cameraToUseForPointers: Camera;
  335. private _pointerX;
  336. private _pointerY;
  337. private _meshUnderPointer;
  338. private _onKeyDown;
  339. private _onKeyUp;
  340. public fogMode: number;
  341. public fogColor: Color3;
  342. public fogDensity: number;
  343. public fogStart: number;
  344. public fogEnd: number;
  345. public lightsEnabled: boolean;
  346. public lights: Light[];
  347. public cameras: Camera[];
  348. public activeCameras: Camera[];
  349. public activeCamera: Camera;
  350. public meshes: AbstractMesh[];
  351. private _geometries;
  352. public materials: Material[];
  353. public multiMaterials: MultiMaterial[];
  354. public defaultMaterial: StandardMaterial;
  355. public texturesEnabled: boolean;
  356. public textures: BaseTexture[];
  357. public particlesEnabled: boolean;
  358. public particleSystems: ParticleSystem[];
  359. public spriteManagers: SpriteManager[];
  360. public layers: Layer[];
  361. public skeletons: Skeleton[];
  362. public lensFlareSystems: LensFlareSystem[];
  363. public collisionsEnabled: boolean;
  364. public gravity: Vector3;
  365. public postProcessesEnabled: boolean;
  366. public postProcessManager: PostProcessManager;
  367. public postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  368. public renderTargetsEnabled: boolean;
  369. public customRenderTargets: RenderTargetTexture[];
  370. public useDelayedTextureLoading: boolean;
  371. public importedMeshesFiles: String[];
  372. public database: any;
  373. public actionManager: ActionManager;
  374. public _actionManagers: ActionManager[];
  375. private _meshesForIntersections;
  376. private _engine;
  377. private _totalVertices;
  378. public _activeVertices: number;
  379. public _activeParticles: number;
  380. private _lastFrameDuration;
  381. private _evaluateActiveMeshesDuration;
  382. private _renderTargetsDuration;
  383. public _particlesDuration: number;
  384. private _renderDuration;
  385. public _spritesDuration: number;
  386. private _animationRatio;
  387. private _animationStartDate;
  388. private _renderId;
  389. private _executeWhenReadyTimeoutId;
  390. public _toBeDisposed: SmartArray<IDisposable>;
  391. private _onReadyCallbacks;
  392. private _pendingData;
  393. private _onBeforeRenderCallbacks;
  394. private _activeMeshes;
  395. private _processedMaterials;
  396. private _renderTargets;
  397. public _activeParticleSystems: SmartArray<ParticleSystem>;
  398. private _activeSkeletons;
  399. private _renderingManager;
  400. private _physicsEngine;
  401. public _activeAnimatables: Animatable[];
  402. private _transformMatrix;
  403. private _pickWithRayInverseMatrix;
  404. private _scaledPosition;
  405. private _scaledVelocity;
  406. private _boundingBoxRenderer;
  407. private _outlineRenderer;
  408. private _viewMatrix;
  409. private _projectionMatrix;
  410. private _frustumPlanes;
  411. private _selectionOctree;
  412. private _pointerOverMesh;
  413. constructor(engine: Engine);
  414. public meshUnderPointer : AbstractMesh;
  415. public pointerX : number;
  416. public pointerY : number;
  417. public getBoundingBoxRenderer(): BoundingBoxRenderer;
  418. public getOutlineRenderer(): OutlineRenderer;
  419. public getEngine(): Engine;
  420. public getTotalVertices(): number;
  421. public getActiveVertices(): number;
  422. public getActiveParticles(): number;
  423. public getLastFrameDuration(): number;
  424. public getEvaluateActiveMeshesDuration(): number;
  425. public getActiveMeshes(): SmartArray<Mesh>;
  426. public getRenderTargetsDuration(): number;
  427. public getRenderDuration(): number;
  428. public getParticlesDuration(): number;
  429. public getSpritesDuration(): number;
  430. public getAnimationRatio(): number;
  431. public getRenderId(): number;
  432. private _updatePointerPosition(evt);
  433. public attachControl(): void;
  434. public detachControl(): void;
  435. public isReady(): boolean;
  436. public registerBeforeRender(func: () => void): void;
  437. public unregisterBeforeRender(func: () => void): void;
  438. public _addPendingData(data: any): void;
  439. public _removePendingData(data: any): void;
  440. public getWaitingItemsCount(): number;
  441. public executeWhenReady(func: () => void): void;
  442. public _checkIsReady(): void;
  443. public beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  444. public beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  445. public getAnimatableByTarget(target: any): Animatable;
  446. public stopAnimation(target: any): void;
  447. private _animate();
  448. public getViewMatrix(): Matrix;
  449. public getProjectionMatrix(): Matrix;
  450. public getTransformMatrix(): Matrix;
  451. public setTransformMatrix(view: Matrix, projection: Matrix): void;
  452. public setActiveCameraByID(id: string): Camera;
  453. public setActiveCameraByName(name: string): Camera;
  454. public getMaterialByID(id: string): Material;
  455. public getMaterialByName(name: string): Material;
  456. public getCameraByID(id: string): Camera;
  457. public getCameraByName(name: string): Camera;
  458. public getLightByName(name: string): Light;
  459. public getLightByID(id: string): Light;
  460. public getGeometryByID(id: string): Geometry;
  461. public pushGeometry(geometry: Geometry, force?: boolean): boolean;
  462. public getGeometries(): Geometry[];
  463. public getMeshByID(id: string): AbstractMesh;
  464. public getLastMeshByID(id: string): AbstractMesh;
  465. public getLastEntryByID(id: string): Node;
  466. public getMeshByName(name: string): AbstractMesh;
  467. public getLastSkeletonByID(id: string): Skeleton;
  468. public getSkeletonById(id: string): Skeleton;
  469. public getSkeletonByName(name: string): Skeleton;
  470. public isActiveMesh(mesh: Mesh): boolean;
  471. private _evaluateSubMesh(subMesh, mesh);
  472. private _evaluateActiveMeshes();
  473. private _activeMesh(mesh);
  474. public updateTransformMatrix(force?: boolean): void;
  475. private _renderForCamera(camera);
  476. private _processSubCameras(camera);
  477. private _checkIntersections();
  478. public render(): void;
  479. public dispose(): void;
  480. public _getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, finalPosition: Vector3, excludedMesh?: AbstractMesh): void;
  481. private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
  482. public createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  483. public createPickingRay(x: number, y: number, world: Matrix, camera: Camera): Ray;
  484. private _internalPick(rayFunction, predicate, fastCheck?);
  485. public pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  486. public pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  487. public setPointerOverMesh(mesh: AbstractMesh): void;
  488. public getPointerOverMesh(): AbstractMesh;
  489. public getPhysicsEngine(): PhysicsEngine;
  490. public enablePhysics(gravity: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  491. public disablePhysicsEngine(): void;
  492. public isPhysicsEnabled(): boolean;
  493. public setGravity(gravity: Vector3): void;
  494. public createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any;
  495. public deleteCompoundImpostor(compound: any): void;
  496. private _getByTags(list, tagsQuery);
  497. public getMeshesByTags(tagsQuery: string): Mesh[];
  498. public getCamerasByTags(tagsQuery: string): Camera[];
  499. public getLightsByTags(tagsQuery: string): Light[];
  500. public getMaterialByTags(tagsQuery: string): Material[];
  501. }
  502. }
  503. declare module BABYLON {
  504. class Action {
  505. public triggerOptions: any;
  506. public trigger: number;
  507. public _actionManager: ActionManager;
  508. private _nextActiveAction;
  509. private _child;
  510. private _condition;
  511. private _triggerParameter;
  512. constructor(triggerOptions: any, condition?: Condition);
  513. public _prepare(): void;
  514. public getTriggerParameter(): any;
  515. public _executeCurrent(evt: ActionEvent): void;
  516. public execute(evt: ActionEvent): void;
  517. public then(action: Action): Action;
  518. public _getProperty(propertyPath: string): string;
  519. public _getEffectiveTarget(target: any, propertyPath: string): any;
  520. }
  521. }
  522. declare module BABYLON {
  523. class ActionEvent {
  524. public source: AbstractMesh;
  525. public pointerX: number;
  526. public pointerY: number;
  527. public meshUnderPointer: AbstractMesh;
  528. public sourceEvent: any;
  529. constructor(source: AbstractMesh, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any);
  530. static CreateNew(source: AbstractMesh): ActionEvent;
  531. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  532. }
  533. class ActionManager {
  534. private static _NothingTrigger;
  535. private static _OnPickTrigger;
  536. private static _OnLeftPickTrigger;
  537. private static _OnRightPickTrigger;
  538. private static _OnCenterPickTrigger;
  539. private static _OnPointerOverTrigger;
  540. private static _OnPointerOutTrigger;
  541. private static _OnEveryFrameTrigger;
  542. private static _OnIntersectionEnterTrigger;
  543. private static _OnIntersectionExitTrigger;
  544. private static _OnKeyDownTrigger;
  545. private static _OnKeyUpTrigger;
  546. static NothingTrigger : number;
  547. static OnPickTrigger : number;
  548. static OnLeftPickTrigger : number;
  549. static OnRightPickTrigger : number;
  550. static OnCenterPickTrigger : number;
  551. static OnPointerOverTrigger : number;
  552. static OnPointerOutTrigger : number;
  553. static OnEveryFrameTrigger : number;
  554. static OnIntersectionEnterTrigger : number;
  555. static OnIntersectionExitTrigger : number;
  556. static OnKeyDownTrigger : number;
  557. static OnKeyUpTrigger : number;
  558. public actions: Action[];
  559. private _scene;
  560. constructor(scene: Scene);
  561. public dispose(): void;
  562. public getScene(): Scene;
  563. public hasSpecificTriggers(triggers: number[]): boolean;
  564. public hasPointerTriggers : boolean;
  565. public hasPickTriggers : boolean;
  566. public registerAction(action: Action): Action;
  567. public processTrigger(trigger: number, evt: ActionEvent): void;
  568. public _getEffectiveTarget(target: any, propertyPath: string): any;
  569. public _getProperty(propertyPath: string): string;
  570. }
  571. }
  572. declare module BABYLON {
  573. class Condition {
  574. public _actionManager: ActionManager;
  575. public _evaluationId: number;
  576. public _currentResult: boolean;
  577. constructor(actionManager: ActionManager);
  578. public isValid(): boolean;
  579. public _getProperty(propertyPath: string): string;
  580. public _getEffectiveTarget(target: any, propertyPath: string): any;
  581. }
  582. class ValueCondition extends Condition {
  583. public propertyPath: string;
  584. public value: any;
  585. public operator: number;
  586. private static _IsEqual;
  587. private static _IsDifferent;
  588. private static _IsGreater;
  589. private static _IsLesser;
  590. static IsEqual : number;
  591. static IsDifferent : number;
  592. static IsGreater : number;
  593. static IsLesser : number;
  594. public _actionManager: ActionManager;
  595. private _target;
  596. private _property;
  597. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  598. public isValid(): boolean;
  599. }
  600. class PredicateCondition extends Condition {
  601. public predicate: () => boolean;
  602. public _actionManager: ActionManager;
  603. constructor(actionManager: ActionManager, predicate: () => boolean);
  604. public isValid(): boolean;
  605. }
  606. class StateCondition extends Condition {
  607. public value: string;
  608. public _actionManager: ActionManager;
  609. private _target;
  610. constructor(actionManager: ActionManager, target: any, value: string);
  611. public isValid(): boolean;
  612. }
  613. }
  614. declare module BABYLON {
  615. class SwitchBooleanAction extends Action {
  616. public propertyPath: string;
  617. private _target;
  618. private _property;
  619. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  620. public _prepare(): void;
  621. public execute(): void;
  622. }
  623. class SetStateAction extends Action {
  624. public value: string;
  625. private _target;
  626. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  627. public execute(): void;
  628. }
  629. class SetValueAction extends Action {
  630. public propertyPath: string;
  631. public value: any;
  632. private _target;
  633. private _property;
  634. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  635. public _prepare(): void;
  636. public execute(): void;
  637. }
  638. class IncrementValueAction extends Action {
  639. public propertyPath: string;
  640. public value: any;
  641. private _target;
  642. private _property;
  643. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  644. public _prepare(): void;
  645. public execute(): void;
  646. }
  647. class PlayAnimationAction extends Action {
  648. public from: number;
  649. public to: number;
  650. public loop: boolean;
  651. private _target;
  652. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  653. public _prepare(): void;
  654. public execute(): void;
  655. }
  656. class StopAnimationAction extends Action {
  657. private _target;
  658. constructor(triggerOptions: any, target: any, condition?: Condition);
  659. public _prepare(): void;
  660. public execute(): void;
  661. }
  662. class DoNothingAction extends Action {
  663. constructor(triggerOptions?: any, condition?: Condition);
  664. public execute(): void;
  665. }
  666. class CombineAction extends Action {
  667. public children: Action[];
  668. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  669. public _prepare(): void;
  670. public execute(evt: ActionEvent): void;
  671. }
  672. class ExecuteCodeAction extends Action {
  673. public func: (evt: ActionEvent) => void;
  674. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  675. public execute(evt: ActionEvent): void;
  676. }
  677. class SetParentAction extends Action {
  678. private _parent;
  679. private _target;
  680. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  681. public _prepare(): void;
  682. public execute(): void;
  683. }
  684. }
  685. declare module BABYLON {
  686. class InterpolateValueAction extends Action {
  687. public propertyPath: string;
  688. public value: any;
  689. public duration: number;
  690. public stopOtherAnimations: boolean;
  691. private _target;
  692. private _property;
  693. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean);
  694. public _prepare(): void;
  695. public execute(): void;
  696. }
  697. }
  698. declare module BABYLON {
  699. class Animatable {
  700. public target: any;
  701. public fromFrame: number;
  702. public toFrame: number;
  703. public loopAnimation: boolean;
  704. public speedRatio: number;
  705. public onAnimationEnd: any;
  706. private _localDelayOffset;
  707. private _animations;
  708. private _paused;
  709. private _scene;
  710. public animationStarted: boolean;
  711. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  712. public appendAnimations(target: any, animations: Animation[]): void;
  713. public getAnimationByTargetProperty(property: string): Animation;
  714. public pause(): void;
  715. public restart(): void;
  716. public stop(): void;
  717. public _animate(delay: number): boolean;
  718. }
  719. }
  720. declare module BABYLON {
  721. class Animation {
  722. public name: string;
  723. public targetProperty: string;
  724. public framePerSecond: number;
  725. public dataType: number;
  726. public loopMode: number;
  727. private _keys;
  728. private _offsetsCache;
  729. private _highLimitsCache;
  730. private _stopped;
  731. public _target: any;
  732. public targetPropertyPath: string[];
  733. public currentFrame: number;
  734. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number);
  735. public isStopped(): boolean;
  736. public getKeys(): any[];
  737. public floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  738. public quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  739. public vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  740. public color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  741. public clone(): Animation;
  742. public setKeys(values: any[]): void;
  743. private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?);
  744. public animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean;
  745. private static _ANIMATIONTYPE_FLOAT;
  746. private static _ANIMATIONTYPE_VECTOR3;
  747. private static _ANIMATIONTYPE_QUATERNION;
  748. private static _ANIMATIONTYPE_MATRIX;
  749. private static _ANIMATIONTYPE_COLOR3;
  750. private static _ANIMATIONLOOPMODE_RELATIVE;
  751. private static _ANIMATIONLOOPMODE_CYCLE;
  752. private static _ANIMATIONLOOPMODE_CONSTANT;
  753. static ANIMATIONTYPE_FLOAT : number;
  754. static ANIMATIONTYPE_VECTOR3 : number;
  755. static ANIMATIONTYPE_QUATERNION : number;
  756. static ANIMATIONTYPE_MATRIX : number;
  757. static ANIMATIONTYPE_COLOR3 : number;
  758. static ANIMATIONLOOPMODE_RELATIVE : number;
  759. static ANIMATIONLOOPMODE_CYCLE : number;
  760. static ANIMATIONLOOPMODE_CONSTANT : number;
  761. }
  762. }
  763. declare module BABYLON {
  764. class Bone {
  765. public name: string;
  766. public children: Bone[];
  767. public animations: Animation[];
  768. private _skeleton;
  769. private _matrix;
  770. private _baseMatrix;
  771. private _worldTransform;
  772. private _absoluteTransform;
  773. private _invertedAbsoluteTransform;
  774. private _parent;
  775. constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix);
  776. public getParent(): Bone;
  777. public getLocalMatrix(): Matrix;
  778. public getBaseMatrix(): Matrix;
  779. public getWorldMatrix(): Matrix;
  780. public getInvertedAbsoluteTransform(): Matrix;
  781. public getAbsoluteMatrix(): Matrix;
  782. public updateMatrix(matrix: Matrix): void;
  783. private _updateDifferenceMatrix();
  784. public markAsDirty(): void;
  785. }
  786. }
  787. declare module BABYLON {
  788. class Skeleton {
  789. public name: string;
  790. public id: string;
  791. public bones: Bone[];
  792. private _scene;
  793. private _isDirty;
  794. private _transformMatrices;
  795. private _animatables;
  796. private _identity;
  797. constructor(name: string, id: string, scene: Scene);
  798. public getTransformMatrices(): Float32Array;
  799. public _markAsDirty(): void;
  800. public prepare(): void;
  801. public getAnimatables(): IAnimatable[];
  802. public clone(name: string, id: string): Skeleton;
  803. }
  804. }
  805. declare module BABYLON {
  806. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  807. private _eyeSpace;
  808. private _leftCamera;
  809. private _rightCamera;
  810. constructor(name: string, alpha: number, beta: number, radius: number, target: any, eyeSpace: number, scene: any);
  811. public _update(): void;
  812. public _updateCamera(camera: ArcRotateCamera): void;
  813. }
  814. class AnaglyphFreeCamera extends FreeCamera {
  815. private _eyeSpace;
  816. private _leftCamera;
  817. private _rightCamera;
  818. private _transformMatrix;
  819. constructor(name: string, position: Vector3, eyeSpace: number, scene: Scene);
  820. public _getSubCameraPosition(eyeSpace: any, result: any): void;
  821. public _update(): void;
  822. public _updateCamera(camera: FreeCamera): void;
  823. }
  824. }
  825. declare module BABYLON {
  826. class ArcRotateCamera extends Camera {
  827. public alpha: number;
  828. public beta: number;
  829. public radius: number;
  830. public target: any;
  831. public inertialAlphaOffset: number;
  832. public inertialBetaOffset: number;
  833. public inertialRadiusOffset: number;
  834. public lowerAlphaLimit: any;
  835. public upperAlphaLimit: any;
  836. public lowerBetaLimit: number;
  837. public upperBetaLimit: number;
  838. public lowerRadiusLimit: any;
  839. public upperRadiusLimit: any;
  840. public angularSensibility: number;
  841. public wheelPrecision: number;
  842. public keysUp: number[];
  843. public keysDown: number[];
  844. public keysLeft: number[];
  845. public keysRight: number[];
  846. public zoomOnFactor: number;
  847. private _keys;
  848. private _viewMatrix;
  849. private _attachedElement;
  850. private _onPointerDown;
  851. private _onPointerUp;
  852. private _onPointerMove;
  853. private _wheel;
  854. private _onMouseMove;
  855. private _onKeyDown;
  856. private _onKeyUp;
  857. private _onLostFocus;
  858. private _reset;
  859. private _onGestureStart;
  860. private _onGesture;
  861. private _MSGestureHandler;
  862. public onCollide: (collidedMesh: AbstractMesh) => void;
  863. public checkCollisions: boolean;
  864. public collisionRadius: Vector3;
  865. private _collider;
  866. private _previousPosition;
  867. private _collisionVelocity;
  868. private _newPosition;
  869. private _previousAlpha;
  870. private _previousBeta;
  871. private _previousRadius;
  872. public pinchPrecision: number;
  873. private _touchStart;
  874. private _touchMove;
  875. private _touchEnd;
  876. private _pinchStart;
  877. private _pinchMove;
  878. private _pinchEnd;
  879. constructor(name: string, alpha: number, beta: number, radius: number, target: any, scene: Scene);
  880. public _getTargetPosition(): Vector3;
  881. public _initCache(): void;
  882. public _updateCache(ignoreParentClass?: boolean): void;
  883. public _isSynchronizedViewMatrix(): boolean;
  884. public attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  885. public detachControl(element: HTMLElement): void;
  886. public _update(): void;
  887. public setPosition(position: Vector3): void;
  888. public _getViewMatrix(): Matrix;
  889. public zoomOn(meshes?: AbstractMesh[]): void;
  890. public focusOn(meshesOrMinMaxVectorAndDistance: any): void;
  891. }
  892. }
  893. declare module BABYLON {
  894. class Camera extends Node {
  895. public position: Vector3;
  896. static PERSPECTIVE_CAMERA: number;
  897. static ORTHOGRAPHIC_CAMERA: number;
  898. public upVector: Vector3;
  899. public orthoLeft: any;
  900. public orthoRight: any;
  901. public orthoBottom: any;
  902. public orthoTop: any;
  903. public fov: number;
  904. public minZ: number;
  905. public maxZ: number;
  906. public inertia: number;
  907. public mode: number;
  908. public isIntermediate: boolean;
  909. public viewport: Viewport;
  910. public subCameras: any[];
  911. public layerMask: number;
  912. private _computedViewMatrix;
  913. public _projectionMatrix: Matrix;
  914. private _worldMatrix;
  915. public _postProcesses: PostProcess[];
  916. public _postProcessesTakenIndices: any[];
  917. constructor(name: string, position: Vector3, scene: Scene);
  918. public _initCache(): void;
  919. public _updateCache(ignoreParentClass?: boolean): void;
  920. public _updateFromScene(): void;
  921. public _isSynchronized(): boolean;
  922. public _isSynchronizedViewMatrix(): boolean;
  923. public _isSynchronizedProjectionMatrix(): boolean;
  924. public attachControl(element: HTMLElement): void;
  925. public detachControl(element: HTMLElement): void;
  926. public _update(): void;
  927. public attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  928. public detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  929. public getWorldMatrix(): Matrix;
  930. public _getViewMatrix(): Matrix;
  931. public getViewMatrix(): Matrix;
  932. public _computeViewMatrix(force?: boolean): Matrix;
  933. public getProjectionMatrix(force?: boolean): Matrix;
  934. public dispose(): void;
  935. }
  936. }
  937. declare module BABYLON {
  938. class DeviceOrientationCamera extends FreeCamera {
  939. private _offsetX;
  940. private _offsetY;
  941. private _orientationGamma;
  942. private _orientationBeta;
  943. private _initialOrientationGamma;
  944. private _initialOrientationBeta;
  945. private _attachedCanvas;
  946. private _orientationChanged;
  947. public angularSensibility: number;
  948. public moveSensibility: number;
  949. constructor(name: string, position: Vector3, scene: Scene);
  950. public attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void;
  951. public detachControl(canvas: HTMLCanvasElement): void;
  952. public _checkInputs(): void;
  953. }
  954. }
  955. declare module BABYLON {
  956. class FollowCamera extends TargetCamera {
  957. public radius: number;
  958. public rotationOffset: number;
  959. public heightOffset: number;
  960. public cameraAcceleration: number;
  961. public maxCameraSpeed: number;
  962. public target: AbstractMesh;
  963. constructor(name: string, position: Vector3, scene: Scene);
  964. private getRadians(degrees);
  965. private follow(cameraTarget);
  966. public _update(): void;
  967. }
  968. }
  969. declare module BABYLON {
  970. class FreeCamera extends TargetCamera {
  971. public ellipsoid: Vector3;
  972. public keysUp: number[];
  973. public keysDown: number[];
  974. public keysLeft: number[];
  975. public keysRight: number[];
  976. public checkCollisions: boolean;
  977. public applyGravity: boolean;
  978. public angularSensibility: number;
  979. public onCollide: (collidedMesh: AbstractMesh) => void;
  980. private _keys;
  981. private _collider;
  982. private _needMoveForGravity;
  983. private _oldPosition;
  984. private _diffPosition;
  985. private _newPosition;
  986. private _attachedElement;
  987. private _localDirection;
  988. private _transformedDirection;
  989. private _onMouseDown;
  990. private _onMouseUp;
  991. private _onMouseOut;
  992. private _onMouseMove;
  993. private _onKeyDown;
  994. private _onKeyUp;
  995. public _onLostFocus: (e: FocusEvent) => any;
  996. public _waitingLockedTargetId: string;
  997. constructor(name: string, position: Vector3, scene: Scene);
  998. public attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  999. public detachControl(element: HTMLElement): void;
  1000. public _collideWithWorld(velocity: Vector3): void;
  1001. public _checkInputs(): void;
  1002. public _decideIfNeedsToMove(): boolean;
  1003. public _updatePosition(): void;
  1004. public _update(): void;
  1005. }
  1006. }
  1007. declare module BABYLON {
  1008. class GamepadCamera extends FreeCamera {
  1009. private _gamepad;
  1010. private _gamepads;
  1011. public angularSensibility: number;
  1012. public moveSensibility: number;
  1013. constructor(name: string, position: Vector3, scene: Scene);
  1014. private _onNewGameConnected(gamepad);
  1015. public _checkInputs(): void;
  1016. public dispose(): void;
  1017. }
  1018. }
  1019. declare module BABYLON {
  1020. class OculusCamera extends FreeCamera {
  1021. private _leftCamera;
  1022. private _rightCamera;
  1023. private _offsetOrientation;
  1024. private _deviceOrientationHandler;
  1025. constructor(name: string, position: Vector3, scene: Scene);
  1026. public _update(): void;
  1027. public _updateCamera(camera: FreeCamera): void;
  1028. public _onOrientationEvent(evt: DeviceOrientationEvent): void;
  1029. public attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  1030. public detachControl(element: HTMLElement): void;
  1031. }
  1032. }
  1033. declare module BABYLON {
  1034. class TargetCamera extends Camera {
  1035. public cameraDirection: Vector3;
  1036. public cameraRotation: Vector2;
  1037. public rotation: Vector3;
  1038. public speed: number;
  1039. public noRotationConstraint: boolean;
  1040. public lockedTarget: any;
  1041. public _currentTarget: Vector3;
  1042. public _viewMatrix: Matrix;
  1043. public _camMatrix: Matrix;
  1044. public _cameraTransformMatrix: Matrix;
  1045. public _cameraRotationMatrix: Matrix;
  1046. public _referencePoint: Vector3;
  1047. public _transformedReferencePoint: Vector3;
  1048. public _lookAtTemp: Matrix;
  1049. public _tempMatrix: Matrix;
  1050. public _reset: () => void;
  1051. public _waitingLockedTargetId: string;
  1052. constructor(name: string, position: Vector3, scene: Scene);
  1053. public _getLockedTargetPosition(): Vector3;
  1054. public _initCache(): void;
  1055. public _updateCache(ignoreParentClass?: boolean): void;
  1056. public _isSynchronizedViewMatrix(): boolean;
  1057. public _computeLocalCameraSpeed(): number;
  1058. public setTarget(target: Vector3): void;
  1059. public getTarget(): Vector3;
  1060. public _decideIfNeedsToMove(): boolean;
  1061. public _updatePosition(): void;
  1062. public _update(): void;
  1063. public _getViewMatrix(): Matrix;
  1064. }
  1065. }
  1066. declare module BABYLON {
  1067. class TouchCamera extends FreeCamera {
  1068. private _offsetX;
  1069. private _offsetY;
  1070. private _pointerCount;
  1071. private _pointerPressed;
  1072. private _attachedCanvas;
  1073. private _onPointerDown;
  1074. private _onPointerUp;
  1075. private _onPointerMove;
  1076. public angularSensibility: number;
  1077. public moveSensibility: number;
  1078. constructor(name: string, position: Vector3, scene: Scene);
  1079. public attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void;
  1080. public detachControl(canvas: HTMLCanvasElement): void;
  1081. public _checkInputs(): void;
  1082. }
  1083. }
  1084. declare module BABYLON {
  1085. class VirtualJoysticksCamera extends FreeCamera {
  1086. private _leftjoystick;
  1087. private _rightjoystick;
  1088. constructor(name: string, position: Vector3, scene: Scene);
  1089. public _checkInputs(): void;
  1090. public dispose(): void;
  1091. }
  1092. }
  1093. declare module BABYLON {
  1094. class VRDeviceOrientationCamera extends OculusCamera {
  1095. public _alpha: number;
  1096. public _beta: number;
  1097. public _gamma: number;
  1098. constructor(name: string, position: Vector3, scene: Scene);
  1099. public _onOrientationEvent(evt: DeviceOrientationEvent): void;
  1100. }
  1101. }
  1102. declare var HMDVRDevice: any;
  1103. declare var PositionSensorVRDevice: any;
  1104. declare module BABYLON {
  1105. class WebVRCamera extends OculusCamera {
  1106. public _hmdDevice: any;
  1107. public _sensorDevice: any;
  1108. public _cacheState: any;
  1109. public _cacheQuaternion: Quaternion;
  1110. public _cacheRotation: Vector3;
  1111. public _vrEnabled: boolean;
  1112. constructor(name: string, position: Vector3, scene: Scene);
  1113. private _getWebVRDevices(devices);
  1114. public _update(): void;
  1115. public attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  1116. public detachControl(element: HTMLElement): void;
  1117. }
  1118. }
  1119. declare module BABYLON {
  1120. class Collider {
  1121. public radius: Vector3;
  1122. public retry: number;
  1123. public velocity: Vector3;
  1124. public basePoint: Vector3;
  1125. public epsilon: number;
  1126. public collisionFound: boolean;
  1127. public velocityWorldLength: number;
  1128. public basePointWorld: Vector3;
  1129. public velocityWorld: Vector3;
  1130. public normalizedVelocity: Vector3;
  1131. public initialVelocity: Vector3;
  1132. public initialPosition: Vector3;
  1133. public nearestDistance: number;
  1134. public intersectionPoint: Vector3;
  1135. public collidedMesh: AbstractMesh;
  1136. private _collisionPoint;
  1137. private _planeIntersectionPoint;
  1138. private _tempVector;
  1139. private _tempVector2;
  1140. private _tempVector3;
  1141. private _tempVector4;
  1142. private _edge;
  1143. private _baseToVertex;
  1144. private _destinationPoint;
  1145. private _slidePlaneNormal;
  1146. private _displacementVector;
  1147. public _initialize(source: Vector3, dir: Vector3, e: number): void;
  1148. public _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
  1149. public _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
  1150. public _testTriangle(faceIndex: number, subMesh: SubMesh, p1: Vector3, p2: Vector3, p3: Vector3): void;
  1151. public _collide(subMesh: any, pts: Vector3[], indices: number[], indexStart: number, indexEnd: number, decal: number): void;
  1152. public _getResponse(pos: Vector3, vel: Vector3): void;
  1153. }
  1154. }
  1155. declare module BABYLON {
  1156. class IntersectionInfo {
  1157. public bu: number;
  1158. public bv: number;
  1159. public distance: number;
  1160. public faceId: number;
  1161. constructor(bu: number, bv: number, distance: number);
  1162. }
  1163. class PickingInfo {
  1164. public hit: boolean;
  1165. public distance: number;
  1166. public pickedPoint: Vector3;
  1167. public pickedMesh: AbstractMesh;
  1168. public bu: number;
  1169. public bv: number;
  1170. public faceId: number;
  1171. public getNormal(): Vector3;
  1172. public getTextureCoordinates(): Vector2;
  1173. }
  1174. }
  1175. declare module BABYLON {
  1176. class BoundingBox {
  1177. public minimum: Vector3;
  1178. public maximum: Vector3;
  1179. public vectors: Vector3[];
  1180. public center: Vector3;
  1181. public extendSize: Vector3;
  1182. public directions: Vector3[];
  1183. public vectorsWorld: Vector3[];
  1184. public minimumWorld: Vector3;
  1185. public maximumWorld: Vector3;
  1186. private _worldMatrix;
  1187. constructor(minimum: Vector3, maximum: Vector3);
  1188. public getWorldMatrix(): Matrix;
  1189. public _update(world: Matrix): void;
  1190. public isInFrustum(frustumPlanes: Plane[]): boolean;
  1191. public intersectsPoint(point: Vector3): boolean;
  1192. public intersectsSphere(sphere: BoundingSphere): boolean;
  1193. public intersectsMinMax(min: Vector3, max: Vector3): boolean;
  1194. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  1195. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  1196. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  1197. }
  1198. }
  1199. declare module BABYLON {
  1200. class BoundingInfo {
  1201. public minimum: Vector3;
  1202. public maximum: Vector3;
  1203. public boundingBox: BoundingBox;
  1204. public boundingSphere: BoundingSphere;
  1205. constructor(minimum: Vector3, maximum: Vector3);
  1206. public _update(world: Matrix): void;
  1207. public isInFrustum(frustumPlanes: Plane[]): boolean;
  1208. public _checkCollision(collider: Collider): boolean;
  1209. public intersectsPoint(point: Vector3): boolean;
  1210. public intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  1211. }
  1212. }
  1213. declare module BABYLON {
  1214. class BoundingSphere {
  1215. public minimum: Vector3;
  1216. public maximum: Vector3;
  1217. public center: Vector3;
  1218. public radius: number;
  1219. public centerWorld: Vector3;
  1220. public radiusWorld: number;
  1221. private _tempRadiusVector;
  1222. constructor(minimum: Vector3, maximum: Vector3);
  1223. public _update(world: Matrix): void;
  1224. public isInFrustum(frustumPlanes: Plane[]): boolean;
  1225. public intersectsPoint(point: Vector3): boolean;
  1226. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  1227. }
  1228. }
  1229. declare module BABYLON {
  1230. interface IOctreeContainer<T> {
  1231. blocks: OctreeBlock<T>[];
  1232. }
  1233. class Octree<T> {
  1234. public maxDepth: number;
  1235. public blocks: OctreeBlock<T>[];
  1236. public dynamicContent: T[];
  1237. private _maxBlockCapacity;
  1238. private _selectionContent;
  1239. private _creationFunc;
  1240. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  1241. public update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  1242. public addMesh(entry: T): void;
  1243. public select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  1244. public intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  1245. public intersectsRay(ray: Ray): SmartArray<T>;
  1246. static _CreateBlocks<T>(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer<T>, creationFunc: (entry: T, block: OctreeBlock<T>) => void): void;
  1247. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  1248. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  1249. }
  1250. }
  1251. declare module BABYLON {
  1252. class OctreeBlock<T> {
  1253. public entries: T[];
  1254. public blocks: OctreeBlock<T>[];
  1255. private _depth;
  1256. private _maxDepth;
  1257. private _capacity;
  1258. private _minPoint;
  1259. private _maxPoint;
  1260. private _boundingVectors;
  1261. private _creationFunc;
  1262. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  1263. public capacity : number;
  1264. public minPoint : Vector3;
  1265. public maxPoint : Vector3;
  1266. public addEntry(entry: T): void;
  1267. public addEntries(entries: T[]): void;
  1268. public select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  1269. public intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  1270. public intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  1271. public createInnerBlocks(): void;
  1272. }
  1273. }
  1274. declare module BABYLON {
  1275. class Layer {
  1276. public name: string;
  1277. public texture: Texture;
  1278. public isBackground: boolean;
  1279. public color: Color4;
  1280. public onDispose: () => void;
  1281. private _scene;
  1282. private _vertexDeclaration;
  1283. private _vertexStrideSize;
  1284. private _vertexBuffer;
  1285. private _indexBuffer;
  1286. private _effect;
  1287. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  1288. public render(): void;
  1289. public dispose(): void;
  1290. }
  1291. }
  1292. declare module BABYLON {
  1293. class LensFlare {
  1294. public size: number;
  1295. public position: number;
  1296. public color: Color3;
  1297. public texture: Texture;
  1298. private _system;
  1299. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  1300. public dispose: () => void;
  1301. }
  1302. }
  1303. declare module BABYLON {
  1304. class LensFlareSystem {
  1305. public name: string;
  1306. public lensFlares: LensFlare[];
  1307. public borderLimit: number;
  1308. public meshesSelectionPredicate: (mesh: Mesh) => boolean;
  1309. private _scene;
  1310. private _emitter;
  1311. private _vertexDeclaration;
  1312. private _vertexStrideSize;
  1313. private _vertexBuffer;
  1314. private _indexBuffer;
  1315. private _effect;
  1316. private _positionX;
  1317. private _positionY;
  1318. private _isEnabled;
  1319. constructor(name: string, emitter: any, scene: Scene);
  1320. public isEnabled : boolean;
  1321. public getScene(): Scene;
  1322. public getEmitter(): any;
  1323. public getEmitterPosition(): Vector3;
  1324. public computeEffectivePosition(globalViewport: Viewport): boolean;
  1325. public _isVisible(): boolean;
  1326. public render(): boolean;
  1327. public dispose(): void;
  1328. }
  1329. }
  1330. declare module BABYLON {
  1331. class DirectionalLight extends Light {
  1332. public direction: Vector3;
  1333. public position: Vector3;
  1334. private _transformedDirection;
  1335. public _transformedPosition: Vector3;
  1336. private _worldMatrix;
  1337. constructor(name: string, direction: Vector3, scene: Scene);
  1338. public setDirectionToTarget(target: Vector3): Vector3;
  1339. public _computeTransformedPosition(): boolean;
  1340. public transferToEffect(effect: Effect, directionUniformName: string): void;
  1341. public _getWorldMatrix(): Matrix;
  1342. }
  1343. }
  1344. declare module BABYLON {
  1345. class HemisphericLight extends Light {
  1346. public direction: Vector3;
  1347. public groundColor: Color3;
  1348. private _worldMatrix;
  1349. constructor(name: string, direction: Vector3, scene: Scene);
  1350. public setDirectionToTarget(target: Vector3): Vector3;
  1351. public getShadowGenerator(): ShadowGenerator;
  1352. public transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void;
  1353. public _getWorldMatrix(): Matrix;
  1354. }
  1355. }
  1356. declare module BABYLON {
  1357. class Light extends Node {
  1358. public diffuse: Color3;
  1359. public specular: Color3;
  1360. public intensity: number;
  1361. public range: number;
  1362. public includedOnlyMeshes: AbstractMesh[];
  1363. public excludedMeshes: AbstractMesh[];
  1364. public _shadowGenerator: ShadowGenerator;
  1365. private _parentedWorldMatrix;
  1366. public _excludedMeshesIds: string[];
  1367. public _includedOnlyMeshesIds: string[];
  1368. constructor(name: string, scene: Scene);
  1369. public getShadowGenerator(): ShadowGenerator;
  1370. public transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void;
  1371. public _getWorldMatrix(): Matrix;
  1372. public canAffectMesh(mesh: AbstractMesh): boolean;
  1373. public getWorldMatrix(): Matrix;
  1374. public dispose(): void;
  1375. }
  1376. }
  1377. declare module BABYLON {
  1378. class PointLight extends Light {
  1379. public position: Vector3;
  1380. private _worldMatrix;
  1381. private _transformedPosition;
  1382. constructor(name: string, position: Vector3, scene: Scene);
  1383. public transferToEffect(effect: Effect, positionUniformName: string): void;
  1384. public getShadowGenerator(): ShadowGenerator;
  1385. public _getWorldMatrix(): Matrix;
  1386. }
  1387. }
  1388. declare module BABYLON {
  1389. class SpotLight extends Light {
  1390. public position: Vector3;
  1391. public direction: Vector3;
  1392. public angle: number;
  1393. public exponent: number;
  1394. private _transformedDirection;
  1395. private _transformedPosition;
  1396. private _worldMatrix;
  1397. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  1398. public setDirectionToTarget(target: Vector3): Vector3;
  1399. public transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void;
  1400. public _getWorldMatrix(): Matrix;
  1401. }
  1402. }
  1403. declare module BABYLON {
  1404. class ShadowGenerator {
  1405. private static _FILTER_NONE;
  1406. private static _FILTER_VARIANCESHADOWMAP;
  1407. private static _FILTER_POISSONSAMPLING;
  1408. static FILTER_NONE : number;
  1409. static FILTER_VARIANCESHADOWMAP : number;
  1410. static FILTER_POISSONSAMPLING : number;
  1411. public filter: number;
  1412. public useVarianceShadowMap : boolean;
  1413. public usePoissonSampling : boolean;
  1414. private _light;
  1415. private _scene;
  1416. private _shadowMap;
  1417. private _darkness;
  1418. private _transparencyShadow;
  1419. private _effect;
  1420. private _viewMatrix;
  1421. private _projectionMatrix;
  1422. private _transformMatrix;
  1423. private _worldViewProjection;
  1424. private _cachedPosition;
  1425. private _cachedDirection;
  1426. private _cachedDefines;
  1427. constructor(mapSize: number, light: DirectionalLight);
  1428. public isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  1429. public getShadowMap(): RenderTargetTexture;
  1430. public getLight(): DirectionalLight;
  1431. public getTransformMatrix(): Matrix;
  1432. public getDarkness(): number;
  1433. public setDarkness(darkness: number): void;
  1434. public setTransparencyShadow(hasShadow: boolean): void;
  1435. public dispose(): void;
  1436. }
  1437. }
  1438. declare module BABYLON {
  1439. interface ISceneLoaderPlugin {
  1440. extensions: string;
  1441. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  1442. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  1443. }
  1444. class SceneLoader {
  1445. private static _ForceFullSceneLoadingForIncremental;
  1446. private static _ShowLoadingScreen;
  1447. static ForceFullSceneLoadingForIncremental : boolean;
  1448. static ShowLoadingScreen : boolean;
  1449. private static _registeredPlugins;
  1450. private static _getPluginForFilename(sceneFilename);
  1451. static RegisterPlugin(plugin: ISceneLoaderPlugin): void;
  1452. static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene) => void): void;
  1453. /**
  1454. * Load a scene
  1455. * @param rootUrl a string that defines the root url for scene and resources
  1456. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  1457. * @param engine is the instance of BABYLON.Engine to use to create the scene
  1458. */
  1459. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  1460. /**
  1461. * Append a scene
  1462. * @param rootUrl a string that defines the root url for scene and resources
  1463. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  1464. * @param scene is the instance of BABYLON.Scene to append to
  1465. */
  1466. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  1467. }
  1468. }
  1469. declare module BABYLON.Internals {
  1470. }
  1471. declare module BABYLON {
  1472. class EffectFallbacks {
  1473. private _defines;
  1474. private _currentRank;
  1475. private _maxRank;
  1476. public addFallback(rank: number, define: string): void;
  1477. public isMoreFallbacks : boolean;
  1478. public reduce(currentDefines: string): string;
  1479. }
  1480. class Effect {
  1481. public name: any;
  1482. public defines: string;
  1483. public onCompiled: (effect: Effect) => void;
  1484. public onError: (effect: Effect, errors: string) => void;
  1485. private _engine;
  1486. private _uniformsNames;
  1487. private _samplers;
  1488. private _isReady;
  1489. private _compilationError;
  1490. private _attributesNames;
  1491. private _attributes;
  1492. private _uniforms;
  1493. public _key: string;
  1494. private _program;
  1495. private _valueCache;
  1496. constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void);
  1497. public isReady(): boolean;
  1498. public getProgram(): WebGLProgram;
  1499. public getAttributesNames(): string[];
  1500. public getAttributeLocation(index: number): number;
  1501. public getAttributeLocationByName(name: string): number;
  1502. public getAttributesCount(): number;
  1503. public getUniformIndex(uniformName: string): number;
  1504. public getUniform(uniformName: string): WebGLUniformLocation;
  1505. public getSamplers(): string[];
  1506. public getCompilationError(): string;
  1507. public _loadVertexShader(vertex: any, callback: (data: any) => void): void;
  1508. public _loadFragmentShader(fragment: any, callback: (data: any) => void): void;
  1509. private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?);
  1510. public _bindTexture(channel: string, texture: WebGLTexture): void;
  1511. public setTexture(channel: string, texture: BaseTexture): void;
  1512. public setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  1513. public _cacheFloat2(uniformName: string, x: number, y: number): void;
  1514. public _cacheFloat3(uniformName: string, x: number, y: number, z: number): void;
  1515. public _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void;
  1516. public setArray(uniformName: string, array: number[]): Effect;
  1517. public setMatrices(uniformName: string, matrices: Float32Array): Effect;
  1518. public setMatrix(uniformName: string, matrix: Matrix): Effect;
  1519. public setFloat(uniformName: string, value: number): Effect;
  1520. public setBool(uniformName: string, bool: boolean): Effect;
  1521. public setVector2(uniformName: string, vector2: Vector2): Effect;
  1522. public setFloat2(uniformName: string, x: number, y: number): Effect;
  1523. public setVector3(uniformName: string, vector3: Vector3): Effect;
  1524. public setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  1525. public setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  1526. public setColor3(uniformName: string, color3: Color3): Effect;
  1527. public setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  1528. static ShadersStore: {};
  1529. }
  1530. }
  1531. declare module BABYLON {
  1532. class Material {
  1533. public name: string;
  1534. public id: string;
  1535. public checkReadyOnEveryCall: boolean;
  1536. public checkReadyOnlyOnce: boolean;
  1537. public state: string;
  1538. public alpha: number;
  1539. public wireframe: boolean;
  1540. public backFaceCulling: boolean;
  1541. public onCompiled: (effect: Effect) => void;
  1542. public onError: (effect: Effect, errors: string) => void;
  1543. public onDispose: () => void;
  1544. public getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  1545. public _effect: Effect;
  1546. public _wasPreviouslyReady: boolean;
  1547. private _scene;
  1548. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  1549. public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  1550. public getEffect(): Effect;
  1551. public getScene(): Scene;
  1552. public needAlphaBlending(): boolean;
  1553. public needAlphaTesting(): boolean;
  1554. public getAlphaTestTexture(): BaseTexture;
  1555. public trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void;
  1556. public _preBind(): void;
  1557. public bind(world: Matrix, mesh: Mesh): void;
  1558. public bindOnlyWorldMatrix(world: Matrix): void;
  1559. public unbind(): void;
  1560. public dispose(forceDisposeEffect?: boolean): void;
  1561. }
  1562. }
  1563. declare module BABYLON {
  1564. class MultiMaterial extends Material {
  1565. public subMaterials: Material[];
  1566. constructor(name: string, scene: Scene);
  1567. public getSubMaterial(index: any): Material;
  1568. public isReady(mesh?: AbstractMesh): boolean;
  1569. }
  1570. }
  1571. declare module BABYLON {
  1572. class ShaderMaterial extends Material {
  1573. private _shaderPath;
  1574. private _options;
  1575. private _textures;
  1576. private _floats;
  1577. private _floatsArrays;
  1578. private _colors3;
  1579. private _colors4;
  1580. private _vectors2;
  1581. private _vectors3;
  1582. private _matrices;
  1583. private _cachedWorldViewMatrix;
  1584. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  1585. public needAlphaBlending(): boolean;
  1586. public needAlphaTesting(): boolean;
  1587. private _checkUniform(uniformName);
  1588. public setTexture(name: string, texture: Texture): ShaderMaterial;
  1589. public setFloat(name: string, value: number): ShaderMaterial;
  1590. public setFloats(name: string, value: number[]): ShaderMaterial;
  1591. public setColor3(name: string, value: Color3): ShaderMaterial;
  1592. public setColor4(name: string, value: Color4): ShaderMaterial;
  1593. public setVector2(name: string, value: Vector2): ShaderMaterial;
  1594. public setVector3(name: string, value: Vector3): ShaderMaterial;
  1595. public setMatrix(name: string, value: Matrix): ShaderMaterial;
  1596. public isReady(): boolean;
  1597. public bind(world: Matrix): void;
  1598. public dispose(forceDisposeEffect?: boolean): void;
  1599. }
  1600. }
  1601. declare module BABYLON {
  1602. class FresnelParameters {
  1603. public isEnabled: boolean;
  1604. public leftColor: Color3;
  1605. public rightColor: Color3;
  1606. public bias: number;
  1607. public power: number;
  1608. }
  1609. class StandardMaterial extends Material {
  1610. public diffuseTexture: BaseTexture;
  1611. public ambientTexture: BaseTexture;
  1612. public opacityTexture: BaseTexture;
  1613. public reflectionTexture: BaseTexture;
  1614. public emissiveTexture: BaseTexture;
  1615. public specularTexture: BaseTexture;
  1616. public bumpTexture: BaseTexture;
  1617. public ambientColor: Color3;
  1618. public diffuseColor: Color3;
  1619. public specularColor: Color3;
  1620. public specularPower: number;
  1621. public emissiveColor: Color3;
  1622. public useAlphaFromDiffuseTexture: boolean;
  1623. public useSpecularOverAlpha: boolean;
  1624. public diffuseFresnelParameters: FresnelParameters;
  1625. public opacityFresnelParameters: FresnelParameters;
  1626. public reflectionFresnelParameters: FresnelParameters;
  1627. public emissiveFresnelParameters: FresnelParameters;
  1628. private _cachedDefines;
  1629. private _renderTargets;
  1630. private _worldViewProjectionMatrix;
  1631. private _globalAmbientColor;
  1632. private _scaledDiffuse;
  1633. private _scaledSpecular;
  1634. private _renderId;
  1635. constructor(name: string, scene: Scene);
  1636. public needAlphaBlending(): boolean;
  1637. public needAlphaTesting(): boolean;
  1638. private _shouldUseAlphaFromDiffuseTexture();
  1639. public getAlphaTestTexture(): BaseTexture;
  1640. public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  1641. public unbind(): void;
  1642. public bindOnlyWorldMatrix(world: Matrix): void;
  1643. public bind(world: Matrix, mesh: Mesh): void;
  1644. public getAnimatables(): IAnimatable[];
  1645. public dispose(forceDisposeEffect?: boolean): void;
  1646. public clone(name: string): StandardMaterial;
  1647. static DiffuseTextureEnabled: boolean;
  1648. static AmbientTextureEnabled: boolean;
  1649. static OpacityTextureEnabled: boolean;
  1650. static ReflectionTextureEnabled: boolean;
  1651. static EmissiveTextureEnabled: boolean;
  1652. static SpecularTextureEnabled: boolean;
  1653. static BumpTextureEnabled: boolean;
  1654. }
  1655. }
  1656. declare module BABYLON {
  1657. class BaseTexture {
  1658. public name: string;
  1659. public delayLoadState: number;
  1660. public hasAlpha: boolean;
  1661. public getAlphaFromRGB: boolean;
  1662. public level: number;
  1663. public isCube: boolean;
  1664. public isRenderTarget: boolean;
  1665. public animations: Animation[];
  1666. public onDispose: () => void;
  1667. public coordinatesIndex: number;
  1668. public coordinatesMode: number;
  1669. public wrapU: number;
  1670. public wrapV: number;
  1671. public anisotropicFilteringLevel: number;
  1672. public _cachedAnisotropicFilteringLevel: number;
  1673. private _scene;
  1674. public _texture: WebGLTexture;
  1675. constructor(scene: Scene);
  1676. public getScene(): Scene;
  1677. public getTextureMatrix(): Matrix;
  1678. public getReflectionTextureMatrix(): Matrix;
  1679. public getInternalTexture(): WebGLTexture;
  1680. public isReady(): boolean;
  1681. public getSize(): ISize;
  1682. public getBaseSize(): ISize;
  1683. public _getFromCache(url: string, noMipmap: boolean): WebGLTexture;
  1684. public delayLoad(): void;
  1685. public releaseInternalTexture(): void;
  1686. public clone(): BaseTexture;
  1687. public dispose(): void;
  1688. }
  1689. }
  1690. declare module BABYLON {
  1691. class CubeTexture extends BaseTexture {
  1692. public url: string;
  1693. public coordinatesMode: number;
  1694. private _noMipmap;
  1695. private _extensions;
  1696. private _textureMatrix;
  1697. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean);
  1698. public clone(): CubeTexture;
  1699. public delayLoad(): void;
  1700. public getReflectionTextureMatrix(): Matrix;
  1701. }
  1702. }
  1703. declare module BABYLON {
  1704. class DynamicTexture extends Texture {
  1705. private _generateMipMaps;
  1706. private _canvas;
  1707. private _context;
  1708. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number);
  1709. public getContext(): CanvasRenderingContext2D;
  1710. public update(invertY?: boolean): void;
  1711. public drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean): void;
  1712. public clone(): DynamicTexture;
  1713. }
  1714. }
  1715. declare module BABYLON {
  1716. class MirrorTexture extends RenderTargetTexture {
  1717. public mirrorPlane: Plane;
  1718. private _transformMatrix;
  1719. private _mirrorMatrix;
  1720. private _savedViewMatrix;
  1721. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  1722. public clone(): MirrorTexture;
  1723. }
  1724. }
  1725. declare module BABYLON {
  1726. class RenderTargetTexture extends Texture {
  1727. public renderList: AbstractMesh[];
  1728. public renderParticles: boolean;
  1729. public renderSprites: boolean;
  1730. public coordinatesMode: number;
  1731. public onBeforeRender: () => void;
  1732. public onAfterRender: () => void;
  1733. public activeCamera: Camera;
  1734. public customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  1735. private _size;
  1736. public _generateMipMaps: boolean;
  1737. private _renderingManager;
  1738. public _waitingRenderList: string[];
  1739. private _doNotChangeAspectRatio;
  1740. private _currentRefreshId;
  1741. private _refreshRate;
  1742. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean);
  1743. public resetRefreshCounter(): void;
  1744. public refreshRate : number;
  1745. public _shouldRender(): boolean;
  1746. public getRenderSize(): number;
  1747. public resize(size: any, generateMipMaps: any): void;
  1748. public render(useCameraPostProcess?: boolean): void;
  1749. public clone(): RenderTargetTexture;
  1750. }
  1751. }
  1752. declare module BABYLON {
  1753. class Texture extends BaseTexture {
  1754. static NEAREST_SAMPLINGMODE: number;
  1755. static BILINEAR_SAMPLINGMODE: number;
  1756. static TRILINEAR_SAMPLINGMODE: number;
  1757. static EXPLICIT_MODE: number;
  1758. static SPHERICAL_MODE: number;
  1759. static PLANAR_MODE: number;
  1760. static CUBIC_MODE: number;
  1761. static PROJECTION_MODE: number;
  1762. static SKYBOX_MODE: number;
  1763. static CLAMP_ADDRESSMODE: number;
  1764. static WRAP_ADDRESSMODE: number;
  1765. static MIRROR_ADDRESSMODE: number;
  1766. public url: string;
  1767. public uOffset: number;
  1768. public vOffset: number;
  1769. public uScale: number;
  1770. public vScale: number;
  1771. public uAng: number;
  1772. public vAng: number;
  1773. public wAng: number;
  1774. private _noMipmap;
  1775. public _invertY: boolean;
  1776. private _rowGenerationMatrix;
  1777. private _cachedTextureMatrix;
  1778. private _projectionModeMatrix;
  1779. private _t0;
  1780. private _t1;
  1781. private _t2;
  1782. private _cachedUOffset;
  1783. private _cachedVOffset;
  1784. private _cachedUScale;
  1785. private _cachedVScale;
  1786. private _cachedUAng;
  1787. private _cachedVAng;
  1788. private _cachedWAng;
  1789. private _cachedCoordinatesMode;
  1790. private _samplingMode;
  1791. constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void);
  1792. public delayLoad(): void;
  1793. private _prepareRowForTextureGeneration(x, y, z, t);
  1794. public getTextureMatrix(): Matrix;
  1795. public getReflectionTextureMatrix(): Matrix;
  1796. public clone(): Texture;
  1797. }
  1798. }
  1799. declare module BABYLON {
  1800. class VideoTexture extends Texture {
  1801. public video: HTMLVideoElement;
  1802. private _autoLaunch;
  1803. private _lastUpdate;
  1804. constructor(name: string, urls: string[], size: any, scene: Scene, generateMipMaps: boolean, invertY: boolean, samplingMode?: number);
  1805. public update(): boolean;
  1806. }
  1807. }
  1808. declare module BABYLON {
  1809. class Color3 {
  1810. public r: number;
  1811. public g: number;
  1812. public b: number;
  1813. constructor(r?: number, g?: number, b?: number);
  1814. public toString(): string;
  1815. public toArray(array: number[], index?: number): void;
  1816. public toColor4(alpha?: number): Color4;
  1817. public asArray(): number[];
  1818. public toLuminance(): number;
  1819. public multiply(otherColor: Color3): Color3;
  1820. public multiplyToRef(otherColor: Color3, result: Color3): void;
  1821. public equals(otherColor: Color3): boolean;
  1822. public scale(scale: number): Color3;
  1823. public scaleToRef(scale: number, result: Color3): void;
  1824. public add(otherColor: Color3): Color3;
  1825. public addToRef(otherColor: Color3, result: Color3): void;
  1826. public subtract(otherColor: Color3): Color3;
  1827. public subtractToRef(otherColor: Color3, result: Color3): void;
  1828. public clone(): Color3;
  1829. public copyFrom(source: Color3): void;
  1830. public copyFromFloats(r: number, g: number, b: number): void;
  1831. static FromArray(array: number[]): Color3;
  1832. static FromInts(r: number, g: number, b: number): Color3;
  1833. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  1834. static Red(): Color3;
  1835. static Green(): Color3;
  1836. static Blue(): Color3;
  1837. static Black(): Color3;
  1838. static White(): Color3;
  1839. static Purple(): Color3;
  1840. static Magenta(): Color3;
  1841. static Yellow(): Color3;
  1842. static Gray(): Color3;
  1843. }
  1844. class Color4 {
  1845. public r: number;
  1846. public g: number;
  1847. public b: number;
  1848. public a: number;
  1849. constructor(r: number, g: number, b: number, a: number);
  1850. public addInPlace(right: any): void;
  1851. public asArray(): number[];
  1852. public toArray(array: number[], index?: number): void;
  1853. public add(right: Color4): Color4;
  1854. public subtract(right: Color4): Color4;
  1855. public subtractToRef(right: Color4, result: Color4): void;
  1856. public scale(scale: number): Color4;
  1857. public scaleToRef(scale: number, result: Color4): void;
  1858. public toString(): string;
  1859. public clone(): Color4;
  1860. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  1861. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  1862. static FromArray(array: number[], offset?: number): Color4;
  1863. static FromInts(r: number, g: number, b: number, a: number): Color4;
  1864. }
  1865. class Vector2 {
  1866. public x: number;
  1867. public y: number;
  1868. constructor(x: number, y: number);
  1869. public toString(): string;
  1870. public toArray(array: number[], index?: number): void;
  1871. public asArray(): number[];
  1872. public copyFrom(source: Vector2): void;
  1873. public copyFromFloats(x: number, y: number): void;
  1874. public add(otherVector: Vector2): Vector2;
  1875. public addVector3(otherVector: Vector3): Vector2;
  1876. public subtract(otherVector: Vector2): Vector2;
  1877. public multiplyInPlace(otherVector: Vector2): void;
  1878. public multiply(otherVector: Vector2): Vector2;
  1879. public multiplyToRef(otherVector: Vector2, result: Vector2): void;
  1880. public multiplyByFloats(x: number, y: number): Vector2;
  1881. public divide(otherVector: Vector2): Vector2;
  1882. public divideToRef(otherVector: Vector2, result: Vector2): void;
  1883. public negate(): Vector2;
  1884. public scaleInPlace(scale: number): void;
  1885. public scale(scale: number): Vector2;
  1886. public equals(otherVector: Vector2): boolean;
  1887. public length(): number;
  1888. public lengthSquared(): number;
  1889. public normalize(): void;
  1890. public clone(): Vector2;
  1891. static Zero(): Vector2;
  1892. static FromArray(array: number[], offset?: number): Vector2;
  1893. static FromArrayToRef(array: number[], offset: number, result: Vector2): void;
  1894. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  1895. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  1896. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  1897. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  1898. static Dot(left: Vector2, right: Vector2): number;
  1899. static Normalize(vector: Vector2): Vector2;
  1900. static Minimize(left: Vector2, right: Vector2): Vector2;
  1901. static Maximize(left: Vector2, right: Vector2): Vector2;
  1902. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  1903. static Distance(value1: Vector2, value2: Vector2): number;
  1904. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  1905. }
  1906. class Vector3 {
  1907. public x: number;
  1908. public y: number;
  1909. public z: number;
  1910. constructor(x: number, y: number, z: number);
  1911. public toString(): string;
  1912. public asArray(): number[];
  1913. public toArray(array: number[], index?: number): void;
  1914. public addInPlace(otherVector: Vector3): void;
  1915. public add(otherVector: Vector3): Vector3;
  1916. public addToRef(otherVector: Vector3, result: Vector3): void;
  1917. public subtractInPlace(otherVector: Vector3): void;
  1918. public subtract(otherVector: Vector3): Vector3;
  1919. public subtractToRef(otherVector: Vector3, result: Vector3): void;
  1920. public subtractFromFloats(x: number, y: number, z: number): Vector3;
  1921. public subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  1922. public negate(): Vector3;
  1923. public scaleInPlace(scale: number): void;
  1924. public scale(scale: number): Vector3;
  1925. public scaleToRef(scale: number, result: Vector3): void;
  1926. public equals(otherVector: Vector3): boolean;
  1927. public equalsWithEpsilon(otherVector: Vector3): boolean;
  1928. public equalsToFloats(x: number, y: number, z: number): boolean;
  1929. public multiplyInPlace(otherVector: Vector3): void;
  1930. public multiply(otherVector: Vector3): Vector3;
  1931. public multiplyToRef(otherVector: Vector3, result: Vector3): void;
  1932. public multiplyByFloats(x: number, y: number, z: number): Vector3;
  1933. public divide(otherVector: Vector3): Vector3;
  1934. public divideToRef(otherVector: Vector3, result: Vector3): void;
  1935. public MinimizeInPlace(other: Vector3): void;
  1936. public MaximizeInPlace(other: Vector3): void;
  1937. public length(): number;
  1938. public lengthSquared(): number;
  1939. public normalize(): void;
  1940. public clone(): Vector3;
  1941. public copyFrom(source: Vector3): void;
  1942. public copyFromFloats(x: number, y: number, z: number): void;
  1943. static FromArray(array: number[], offset?: number): Vector3;
  1944. static FromArrayToRef(array: number[], offset: number, result: Vector3): void;
  1945. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  1946. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  1947. static Zero(): Vector3;
  1948. static Up(): Vector3;
  1949. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  1950. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  1951. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  1952. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  1953. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  1954. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  1955. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  1956. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  1957. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  1958. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  1959. static Dot(left: Vector3, right: Vector3): number;
  1960. static Cross(left: Vector3, right: Vector3): Vector3;
  1961. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  1962. static Normalize(vector: Vector3): Vector3;
  1963. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  1964. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  1965. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  1966. static Minimize(left: Vector3, right: Vector3): Vector3;
  1967. static Maximize(left: Vector3, right: Vector3): Vector3;
  1968. static Distance(value1: Vector3, value2: Vector3): number;
  1969. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  1970. static Center(value1: Vector3, value2: Vector3): Vector3;
  1971. }
  1972. class Quaternion {
  1973. public x: number;
  1974. public y: number;
  1975. public z: number;
  1976. public w: number;
  1977. constructor(x?: number, y?: number, z?: number, w?: number);
  1978. public toString(): string;
  1979. public asArray(): number[];
  1980. public equals(otherQuaternion: Quaternion): boolean;
  1981. public clone(): Quaternion;
  1982. public copyFrom(other: Quaternion): void;
  1983. public copyFromFloats(x: number, y: number, z: number, w: number): void;
  1984. public add(other: Quaternion): Quaternion;
  1985. public subtract(other: Quaternion): Quaternion;
  1986. public scale(value: number): Quaternion;
  1987. public multiply(q1: Quaternion): Quaternion;
  1988. public multiplyToRef(q1: Quaternion, result: Quaternion): void;
  1989. public length(): number;
  1990. public normalize(): void;
  1991. public toEulerAngles(): Vector3;
  1992. public toEulerAnglesToRef(result: Vector3): void;
  1993. public toRotationMatrix(result: Matrix): void;
  1994. public fromRotationMatrix(matrix: Matrix): void;
  1995. static Inverse(q: Quaternion): Quaternion;
  1996. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  1997. static FromArray(array: number[], offset?: number): Quaternion;
  1998. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  1999. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  2000. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  2001. }
  2002. class Matrix {
  2003. private static _tempQuaternion;
  2004. private static _xAxis;
  2005. private static _yAxis;
  2006. private static _zAxis;
  2007. public m: Float32Array;
  2008. public isIdentity(): boolean;
  2009. public determinant(): number;
  2010. public toArray(): Float32Array;
  2011. public asArray(): Float32Array;
  2012. public invert(): void;
  2013. public invertToRef(other: Matrix): void;
  2014. public setTranslation(vector3: Vector3): void;
  2015. public multiply(other: Matrix): Matrix;
  2016. public copyFrom(other: Matrix): void;
  2017. public copyToArray(array: Float32Array, offset?: number): void;
  2018. public multiplyToRef(other: Matrix, result: Matrix): void;
  2019. public multiplyToArray(other: Matrix, result: Float32Array, offset: number): void;
  2020. public equals(value: Matrix): boolean;
  2021. public clone(): Matrix;
  2022. static FromArray(array: number[], offset?: number): Matrix;
  2023. static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
  2024. static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void;
  2025. static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix;
  2026. static Identity(): Matrix;
  2027. static IdentityToRef(result: Matrix): void;
  2028. static Zero(): Matrix;
  2029. static RotationX(angle: number): Matrix;
  2030. static RotationXToRef(angle: number, result: Matrix): void;
  2031. static RotationY(angle: number): Matrix;
  2032. static RotationYToRef(angle: number, result: Matrix): void;
  2033. static RotationZ(angle: number): Matrix;
  2034. static RotationZToRef(angle: number, result: Matrix): void;
  2035. static RotationAxis(axis: Vector3, angle: number): Matrix;
  2036. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  2037. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  2038. static Scaling(x: number, y: number, z: number): Matrix;
  2039. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  2040. static Translation(x: number, y: number, z: number): Matrix;
  2041. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  2042. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  2043. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  2044. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  2045. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  2046. static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  2047. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  2048. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  2049. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix): void;
  2050. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  2051. static Transpose(matrix: Matrix): Matrix;
  2052. static Reflection(plane: Plane): Matrix;
  2053. static ReflectionToRef(plane: Plane, result: Matrix): void;
  2054. }
  2055. class Plane {
  2056. public normal: Vector3;
  2057. public d: number;
  2058. constructor(a: number, b: number, c: number, d: number);
  2059. public asArray(): number[];
  2060. public clone(): Plane;
  2061. public normalize(): void;
  2062. public transform(transformation: Matrix): Plane;
  2063. public dotCoordinate(point: any): number;
  2064. public copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): void;
  2065. public isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  2066. public signedDistanceTo(point: Vector3): number;
  2067. static FromArray(array: number[]): Plane;
  2068. static FromPoints(point1: any, point2: any, point3: any): Plane;
  2069. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  2070. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  2071. }
  2072. class Viewport {
  2073. public x: number;
  2074. public y: number;
  2075. public width: number;
  2076. public height: number;
  2077. constructor(x: number, y: number, width: number, height: number);
  2078. public toGlobal(engine: any): Viewport;
  2079. }
  2080. class Frustum {
  2081. static GetPlanes(transform: Matrix): Plane[];
  2082. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  2083. }
  2084. class Ray {
  2085. public origin: Vector3;
  2086. public direction: Vector3;
  2087. private _edge1;
  2088. private _edge2;
  2089. private _pvec;
  2090. private _tvec;
  2091. private _qvec;
  2092. constructor(origin: Vector3, direction: Vector3);
  2093. public intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  2094. public intersectsBox(box: BoundingBox): boolean;
  2095. public intersectsSphere(sphere: any): boolean;
  2096. public intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  2097. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  2098. static Transform(ray: Ray, matrix: Matrix): Ray;
  2099. }
  2100. enum Space {
  2101. LOCAL = 0,
  2102. WORLD = 1,
  2103. }
  2104. class Axis {
  2105. static X: Vector3;
  2106. static Y: Vector3;
  2107. static Z: Vector3;
  2108. }
  2109. }
  2110. declare module BABYLON {
  2111. class AbstractMesh extends Node implements IDisposable {
  2112. private static _BILLBOARDMODE_NONE;
  2113. private static _BILLBOARDMODE_X;
  2114. private static _BILLBOARDMODE_Y;
  2115. private static _BILLBOARDMODE_Z;
  2116. private static _BILLBOARDMODE_ALL;
  2117. static BILLBOARDMODE_NONE : number;
  2118. static BILLBOARDMODE_X : number;
  2119. static BILLBOARDMODE_Y : number;
  2120. static BILLBOARDMODE_Z : number;
  2121. static BILLBOARDMODE_ALL : number;
  2122. public position: Vector3;
  2123. public rotation: Vector3;
  2124. public rotationQuaternion: Quaternion;
  2125. public scaling: Vector3;
  2126. public billboardMode: number;
  2127. public visibility: number;
  2128. public infiniteDistance: boolean;
  2129. public isVisible: boolean;
  2130. public isPickable: boolean;
  2131. public showBoundingBox: boolean;
  2132. public showSubMeshesBoundingBox: boolean;
  2133. public onDispose: any;
  2134. public checkCollisions: boolean;
  2135. public isBlocker: boolean;
  2136. public skeleton: Skeleton;
  2137. public renderingGroupId: number;
  2138. public material: Material;
  2139. public receiveShadows: boolean;
  2140. public actionManager: ActionManager;
  2141. public renderOutline: boolean;
  2142. public outlineColor: Color3;
  2143. public outlineWidth: number;
  2144. public useOctreeForRenderingSelection: boolean;
  2145. public useOctreeForPicking: boolean;
  2146. public useOctreeForCollisions: boolean;
  2147. public layerMask: number;
  2148. public _physicImpostor: number;
  2149. public _physicsMass: number;
  2150. public _physicsFriction: number;
  2151. public _physicRestitution: number;
  2152. public ellipsoid: Vector3;
  2153. public ellipsoidOffset: Vector3;
  2154. private _collider;
  2155. private _oldPositionForCollisions;
  2156. private _diffPositionForCollisions;
  2157. private _newPositionForCollisions;
  2158. private _localScaling;
  2159. private _localRotation;
  2160. private _localTranslation;
  2161. private _localBillboard;
  2162. private _localPivotScaling;
  2163. private _localPivotScalingRotation;
  2164. private _localWorld;
  2165. private _worldMatrix;
  2166. private _rotateYByPI;
  2167. private _absolutePosition;
  2168. private _collisionsTransformMatrix;
  2169. private _collisionsScalingMatrix;
  2170. public _positions: Vector3[];
  2171. private _isDirty;
  2172. public _boundingInfo: BoundingInfo;
  2173. private _pivotMatrix;
  2174. public _isDisposed: boolean;
  2175. public _renderId: number;
  2176. public subMeshes: SubMesh[];
  2177. public _submeshesOctree: Octree<SubMesh>;
  2178. public _intersectionsInProgress: AbstractMesh[];
  2179. constructor(name: string, scene: Scene);
  2180. public getTotalVertices(): number;
  2181. public getIndices(): number[];
  2182. public getVerticesData(kind: string): number[];
  2183. public isVerticesDataPresent(kind: string): boolean;
  2184. public getBoundingInfo(): BoundingInfo;
  2185. public _preActivate(): void;
  2186. public _activate(renderId: number): void;
  2187. public getWorldMatrix(): Matrix;
  2188. public worldMatrixFromCache : Matrix;
  2189. public absolutePosition : Vector3;
  2190. public rotate(axis: Vector3, amount: number, space: Space): void;
  2191. public translate(axis: Vector3, distance: number, space: Space): void;
  2192. public getAbsolutePosition(): Vector3;
  2193. public setAbsolutePosition(absolutePosition: Vector3): void;
  2194. public setPivotMatrix(matrix: Matrix): void;
  2195. public getPivotMatrix(): Matrix;
  2196. public _isSynchronized(): boolean;
  2197. public _initCache(): void;
  2198. public markAsDirty(property: string): void;
  2199. public _updateBoundingInfo(): void;
  2200. public computeWorldMatrix(force?: boolean): Matrix;
  2201. public setPositionWithLocalVector(vector3: Vector3): void;
  2202. public getPositionExpressedInLocalSpace(): Vector3;
  2203. public locallyTranslate(vector3: Vector3): void;
  2204. public lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void;
  2205. public isInFrustum(frustumPlanes: Plane[]): boolean;
  2206. public intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean;
  2207. public intersectsPoint(point: Vector3): boolean;
  2208. public setPhysicsState(impostor?: any, options?: PhysicsBodyCreationOptions): void;
  2209. public getPhysicsImpostor(): number;
  2210. public getPhysicsMass(): number;
  2211. public getPhysicsFriction(): number;
  2212. public getPhysicsRestitution(): number;
  2213. public applyImpulse(force: Vector3, contactPoint: Vector3): void;
  2214. public setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void;
  2215. public updatePhysicsBodyPosition(): void;
  2216. public moveWithCollisions(velocity: Vector3): void;
  2217. /**
  2218. * This function will create an octree to help select the right submeshes for rendering, picking and collisions
  2219. * Please note that you must have a decent number of submeshes to get performance improvements when using octree
  2220. */
  2221. public createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  2222. public _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void;
  2223. public _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void;
  2224. public _checkCollision(collider: Collider): void;
  2225. public _generatePointsArray(): boolean;
  2226. public intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  2227. public clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  2228. public releaseSubMeshes(): void;
  2229. public dispose(doNotRecurse?: boolean): void;
  2230. }
  2231. }
  2232. declare module BABYLON {
  2233. class CSG {
  2234. private polygons;
  2235. public matrix: Matrix;
  2236. public position: Vector3;
  2237. public rotation: Vector3;
  2238. public scaling: Vector3;
  2239. static FromMesh(mesh: Mesh): CSG;
  2240. private static FromPolygons(polygons);
  2241. public clone(): CSG;
  2242. private toPolygons();
  2243. public union(csg: CSG): CSG;
  2244. public unionInPlace(csg: CSG): void;
  2245. public subtract(csg: CSG): CSG;
  2246. public subtractInPlace(csg: CSG): void;
  2247. public intersect(csg: CSG): CSG;
  2248. public intersectInPlace(csg: CSG): void;
  2249. public inverse(): CSG;
  2250. public inverseInPlace(): void;
  2251. public copyTransformAttributes(csg: CSG): CSG;
  2252. public buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  2253. public toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  2254. }
  2255. }
  2256. declare module BABYLON {
  2257. class Geometry implements IGetSetVerticesData {
  2258. public id: string;
  2259. public delayLoadState: number;
  2260. public delayLoadingFile: string;
  2261. private _scene;
  2262. private _engine;
  2263. private _meshes;
  2264. private _totalVertices;
  2265. private _indices;
  2266. private _vertexBuffers;
  2267. public _delayInfo: any;
  2268. private _indexBuffer;
  2269. public _boundingInfo: BoundingInfo;
  2270. public _delayLoadingFunction: (any: any, Geometry: any) => void;
  2271. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  2272. public getScene(): Scene;
  2273. public getEngine(): Engine;
  2274. public isReady(): boolean;
  2275. public setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  2276. public setVerticesData(kind: string, data: number[], updatable?: boolean): void;
  2277. public updateVerticesDataDirectly(kind: string, data: Float32Array): void;
  2278. public updateVerticesData(kind: string, data: number[], updateExtends?: boolean): void;
  2279. public getTotalVertices(): number;
  2280. public getVerticesData(kind: string): number[];
  2281. public getVertexBuffer(kind: string): VertexBuffer;
  2282. public getVertexBuffers(): VertexBuffer[];
  2283. public isVerticesDataPresent(kind: string): boolean;
  2284. public getVerticesDataKinds(): string[];
  2285. public setIndices(indices: number[]): void;
  2286. public getTotalIndices(): number;
  2287. public getIndices(): number[];
  2288. public getIndexBuffer(): any;
  2289. public releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  2290. public applyToMesh(mesh: Mesh): void;
  2291. private _applyToMesh(mesh);
  2292. public load(scene: Scene, onLoaded?: () => void): void;
  2293. public dispose(): void;
  2294. public copy(id: string): Geometry;
  2295. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  2296. static RandomId(): string;
  2297. }
  2298. module Geometry.Primitives {
  2299. class _Primitive extends Geometry {
  2300. private _beingRegenerated;
  2301. private _canBeRegenerated;
  2302. constructor(id: string, scene: Scene, vertexData?: VertexData, canBeRegenerated?: boolean, mesh?: Mesh);
  2303. public canBeRegenerated(): boolean;
  2304. public regenerate(): void;
  2305. public asNewGeometry(id: string): Geometry;
  2306. public setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  2307. public setVerticesData(kind: string, data: number[], updatable?: boolean): void;
  2308. public _regenerateVertexData(): VertexData;
  2309. public copy(id: string): Geometry;
  2310. }
  2311. class Box extends _Primitive {
  2312. public size: number;
  2313. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh);
  2314. public _regenerateVertexData(): VertexData;
  2315. public copy(id: string): Geometry;
  2316. }
  2317. class Sphere extends _Primitive {
  2318. public segments: number;
  2319. public diameter: number;
  2320. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh);
  2321. public _regenerateVertexData(): VertexData;
  2322. public copy(id: string): Geometry;
  2323. }
  2324. class Cylinder extends _Primitive {
  2325. public height: number;
  2326. public diameterTop: number;
  2327. public diameterBottom: number;
  2328. public tessellation: number;
  2329. public subdivisions: number;
  2330. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh);
  2331. public _regenerateVertexData(): VertexData;
  2332. public copy(id: string): Geometry;
  2333. }
  2334. class Torus extends _Primitive {
  2335. public diameter: number;
  2336. public thickness: number;
  2337. public tessellation: number;
  2338. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh);
  2339. public _regenerateVertexData(): VertexData;
  2340. public copy(id: string): Geometry;
  2341. }
  2342. class Ground extends _Primitive {
  2343. public width: number;
  2344. public height: number;
  2345. public subdivisions: number;
  2346. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  2347. public _regenerateVertexData(): VertexData;
  2348. public copy(id: string): Geometry;
  2349. }
  2350. class TiledGround extends _Primitive {
  2351. public xmin: number;
  2352. public zmin: number;
  2353. public xmax: number;
  2354. public zmax: number;
  2355. public subdivisions: {
  2356. w: number;
  2357. h: number;
  2358. };
  2359. public precision: {
  2360. w: number;
  2361. h: number;
  2362. };
  2363. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  2364. w: number;
  2365. h: number;
  2366. }, precision: {
  2367. w: number;
  2368. h: number;
  2369. }, canBeRegenerated?: boolean, mesh?: Mesh);
  2370. public _regenerateVertexData(): VertexData;
  2371. public copy(id: string): Geometry;
  2372. }
  2373. class Plane extends _Primitive {
  2374. public size: number;
  2375. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh);
  2376. public _regenerateVertexData(): VertexData;
  2377. public copy(id: string): Geometry;
  2378. }
  2379. class TorusKnot extends _Primitive {
  2380. public radius: number;
  2381. public tube: number;
  2382. public radialSegments: number;
  2383. public tubularSegments: number;
  2384. public p: number;
  2385. public q: number;
  2386. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh);
  2387. public _regenerateVertexData(): VertexData;
  2388. public copy(id: string): Geometry;
  2389. }
  2390. }
  2391. }
  2392. declare module BABYLON {
  2393. class GroundMesh extends Mesh {
  2394. public generateOctree: boolean;
  2395. private _worldInverse;
  2396. public _subdivisions: number;
  2397. constructor(name: string, scene: Scene);
  2398. public subdivisions : number;
  2399. public optimize(chunksCount: number): void;
  2400. public getHeightAtCoordinates(x: number, z: number): number;
  2401. }
  2402. }
  2403. declare module BABYLON {
  2404. class InstancedMesh extends AbstractMesh {
  2405. private _sourceMesh;
  2406. constructor(name: string, source: Mesh);
  2407. public receiveShadows : boolean;
  2408. public material : Material;
  2409. public visibility : number;
  2410. public skeleton : Skeleton;
  2411. public getTotalVertices(): number;
  2412. public sourceMesh : Mesh;
  2413. public getVerticesData(kind: string): number[];
  2414. public isVerticesDataPresent(kind: string): boolean;
  2415. public getIndices(): number[];
  2416. public _positions : Vector3[];
  2417. public refreshBoundingInfo(): void;
  2418. public _preActivate(): void;
  2419. public _activate(renderId: number): void;
  2420. public _syncSubMeshes(): void;
  2421. public _generatePointsArray(): boolean;
  2422. public clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  2423. public dispose(doNotRecurse?: boolean): void;
  2424. }
  2425. }
  2426. declare module BABYLON {
  2427. class LinesMesh extends Mesh {
  2428. public color: Color3;
  2429. public alpha: number;
  2430. private _colorShader;
  2431. private _ib;
  2432. private _indicesLength;
  2433. private _indices;
  2434. constructor(name: string, scene: Scene, updatable?: boolean);
  2435. public material : Material;
  2436. public isPickable : boolean;
  2437. public checkCollisions : boolean;
  2438. public _bind(subMesh: SubMesh, effect: Effect, wireframe?: boolean): void;
  2439. public _draw(subMesh: SubMesh, useTriangles: boolean, instancesCount?: number): void;
  2440. public intersects(ray: Ray, fastCheck?: boolean): any;
  2441. public dispose(doNotRecurse?: boolean): void;
  2442. }
  2443. }
  2444. declare module BABYLON {
  2445. class _InstancesBatch {
  2446. public mustReturn: boolean;
  2447. public visibleInstances: InstancedMesh[][];
  2448. public renderSelf: boolean[];
  2449. }
  2450. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  2451. public delayLoadState: number;
  2452. public instances: InstancedMesh[];
  2453. public delayLoadingFile: string;
  2454. public _binaryInfo: any;
  2455. public _geometry: Geometry;
  2456. private _onBeforeRenderCallbacks;
  2457. private _onAfterRenderCallbacks;
  2458. public _delayInfo: any;
  2459. public _delayLoadingFunction: (any: any, Mesh: any) => void;
  2460. public _visibleInstances: any;
  2461. private _renderIdForInstances;
  2462. private _batchCache;
  2463. private _worldMatricesInstancesBuffer;
  2464. private _worldMatricesInstancesArray;
  2465. private _instancesBufferSize;
  2466. public _shouldGenerateFlatShading: boolean;
  2467. private _preActivateId;
  2468. constructor(name: string, scene: Scene);
  2469. public getTotalVertices(): number;
  2470. public getVerticesData(kind: string): number[];
  2471. public getVertexBuffer(kind: any): VertexBuffer;
  2472. public isVerticesDataPresent(kind: string): boolean;
  2473. public getVerticesDataKinds(): string[];
  2474. public getTotalIndices(): number;
  2475. public getIndices(): number[];
  2476. public isReady(): boolean;
  2477. public isDisposed(): boolean;
  2478. public _preActivate(): void;
  2479. public _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void;
  2480. public refreshBoundingInfo(): void;
  2481. public _createGlobalSubMesh(): SubMesh;
  2482. public subdivide(count: number): void;
  2483. public setVerticesData(kind: any, data: any, updatable?: boolean): void;
  2484. public updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void;
  2485. public updateVerticesDataDirectly(kind: string, data: Float32Array, makeItUnique?: boolean): void;
  2486. public makeGeometryUnique(): void;
  2487. public setIndices(indices: number[]): void;
  2488. public _bind(subMesh: SubMesh, effect: Effect, wireframe?: boolean): void;
  2489. public _draw(subMesh: SubMesh, useTriangles: boolean, instancesCount?: number): void;
  2490. public _fullDraw(subMesh: SubMesh, useTriangles: boolean, instancesCount?: number): void;
  2491. public registerBeforeRender(func: () => void): void;
  2492. public unregisterBeforeRender(func: () => void): void;
  2493. public registerAfterRender(func: () => void): void;
  2494. public unregisterAfterRender(func: () => void): void;
  2495. public _getInstancesRenderList(subMeshId: number): _InstancesBatch;
  2496. public _renderWithInstances(subMesh: SubMesh, wireFrame: boolean, batch: _InstancesBatch, effect: Effect, engine: Engine): void;
  2497. public render(subMesh: SubMesh): void;
  2498. public getEmittedParticleSystems(): ParticleSystem[];
  2499. public getHierarchyEmittedParticleSystems(): ParticleSystem[];
  2500. public getChildren(): Node[];
  2501. public _checkDelayState(): void;
  2502. public isInFrustum(frustumPlanes: Plane[]): boolean;
  2503. public setMaterialByID(id: string): void;
  2504. public getAnimatables(): IAnimatable[];
  2505. public bakeTransformIntoVertices(transform: Matrix): void;
  2506. public _resetPointsArrayCache(): void;
  2507. public _generatePointsArray(): boolean;
  2508. public clone(name: string, newParent: Node, doNotCloneChildren?: boolean): Mesh;
  2509. public dispose(doNotRecurse?: boolean): void;
  2510. public applyDisplacementMap(url: string, minHeight: number, maxHeight: number): void;
  2511. public applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void;
  2512. public convertToFlatShadedMesh(): void;
  2513. public createInstance(name: string): InstancedMesh;
  2514. public synchronizeInstances(): void;
  2515. static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean): Mesh;
  2516. static CreateSphere(name: string, segments: number, diameter: number, scene: Scene, updatable?: boolean): Mesh;
  2517. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any): Mesh;
  2518. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean): Mesh;
  2519. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean): Mesh;
  2520. static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean): LinesMesh;
  2521. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean): Mesh;
  2522. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
  2523. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  2524. w: number;
  2525. h: number;
  2526. }, precision: {
  2527. w: number;
  2528. h: number;
  2529. }, scene: Scene, updatable?: boolean): Mesh;
  2530. static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean): GroundMesh;
  2531. static MinMax(meshes: AbstractMesh[]): {
  2532. min: Vector3;
  2533. max: Vector3;
  2534. };
  2535. static Center(meshesOrMinMaxVector: any): Vector3;
  2536. }
  2537. }
  2538. declare module BABYLON {
  2539. interface IGetSetVerticesData {
  2540. isVerticesDataPresent(kind: string): boolean;
  2541. getVerticesData(kind: string): number[];
  2542. getIndices(): number[];
  2543. setVerticesData(kind: string, data: number[], updatable?: boolean): void;
  2544. updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void;
  2545. setIndices(indices: number[]): void;
  2546. }
  2547. class VertexData {
  2548. public positions: number[];
  2549. public normals: number[];
  2550. public uvs: number[];
  2551. public uv2s: number[];
  2552. public colors: number[];
  2553. public matricesIndices: number[];
  2554. public matricesWeights: number[];
  2555. public indices: number[];
  2556. public set(data: number[], kind: string): void;
  2557. public applyToMesh(mesh: Mesh, updatable?: boolean): void;
  2558. public applyToGeometry(geometry: Geometry, updatable?: boolean): void;
  2559. public updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void;
  2560. public updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void;
  2561. private _applyTo(meshOrGeometry, updatable?);
  2562. private _update(meshOrGeometry, updateExtends?, makeItUnique?);
  2563. public transform(matrix: Matrix): void;
  2564. public merge(other: VertexData): void;
  2565. static ExtractFromMesh(mesh: Mesh): VertexData;
  2566. static ExtractFromGeometry(geometry: Geometry): VertexData;
  2567. private static _ExtractFrom(meshOrGeometry);
  2568. static CreateBox(size: number): VertexData;
  2569. static CreateSphere(segments: number, diameter: number): VertexData;
  2570. static CreateCylinder(height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number): VertexData;
  2571. static CreateTorus(diameter: any, thickness: any, tessellation: any): VertexData;
  2572. static CreateLines(points: Vector3[]): VertexData;
  2573. static CreateGround(width: number, height: number, subdivisions: number): VertexData;
  2574. static CreateTiledGround(xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: {
  2575. w: number;
  2576. h: number;
  2577. }, precision?: {
  2578. w: number;
  2579. h: number;
  2580. }): VertexData;
  2581. static CreateGroundFromHeightMap(width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number): VertexData;
  2582. static CreatePlane(size: number): VertexData;
  2583. static CreateTorusKnot(radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number): VertexData;
  2584. static ComputeNormals(positions: number[], indices: number[], normals: number[]): void;
  2585. }
  2586. }
  2587. declare module BABYLON {
  2588. class SubMesh {
  2589. public materialIndex: number;
  2590. public verticesStart: number;
  2591. public verticesCount: number;
  2592. public indexStart: any;
  2593. public indexCount: number;
  2594. public linesIndexCount: number;
  2595. private _mesh;
  2596. private _renderingMesh;
  2597. private _boundingInfo;
  2598. private _linesIndexBuffer;
  2599. public _lastColliderWorldVertices: Vector3[];
  2600. public _trianglePlanes: Plane[];
  2601. public _lastColliderTransformMatrix: Matrix;
  2602. public _renderId: number;
  2603. public _distanceToCamera: number;
  2604. public _id: number;
  2605. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  2606. public getBoundingInfo(): BoundingInfo;
  2607. public getMesh(): AbstractMesh;
  2608. public getRenderingMesh(): Mesh;
  2609. public getMaterial(): Material;
  2610. public refreshBoundingInfo(): void;
  2611. public _checkCollision(collider: Collider): boolean;
  2612. public updateBoundingInfo(world: Matrix): void;
  2613. public isInFrustum(frustumPlanes: Plane[]): boolean;
  2614. public render(): void;
  2615. public getLinesIndexBuffer(indices: number[], engine: any): WebGLBuffer;
  2616. public canIntersects(ray: Ray): boolean;
  2617. public intersects(ray: Ray, positions: Vector3[], indices: number[], fastCheck?: boolean): IntersectionInfo;
  2618. public clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  2619. public dispose(): void;
  2620. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  2621. }
  2622. }
  2623. declare module BABYLON {
  2624. class VertexBuffer {
  2625. private _mesh;
  2626. private _engine;
  2627. private _buffer;
  2628. private _data;
  2629. private _updatable;
  2630. private _kind;
  2631. private _strideSize;
  2632. constructor(engine: any, data: number[], kind: string, updatable: boolean, postponeInternalCreation?: boolean);
  2633. public isUpdatable(): boolean;
  2634. public getData(): number[];
  2635. public getBuffer(): WebGLBuffer;
  2636. public getStrideSize(): number;
  2637. public create(data?: number[]): void;
  2638. public update(data: number[]): void;
  2639. public updateDirectly(data: Float32Array): void;
  2640. public dispose(): void;
  2641. private static _PositionKind;
  2642. private static _NormalKind;
  2643. private static _UVKind;
  2644. private static _UV2Kind;
  2645. private static _ColorKind;
  2646. private static _MatricesIndicesKind;
  2647. private static _MatricesWeightsKind;
  2648. static PositionKind : string;
  2649. static NormalKind : string;
  2650. static UVKind : string;
  2651. static UV2Kind : string;
  2652. static ColorKind : string;
  2653. static MatricesIndicesKind : string;
  2654. static MatricesWeightsKind : string;
  2655. }
  2656. }
  2657. declare module BABYLON {
  2658. class Particle {
  2659. public position: Vector3;
  2660. public direction: Vector3;
  2661. public color: Color4;
  2662. public colorStep: Color4;
  2663. public lifeTime: number;
  2664. public age: number;
  2665. public size: number;
  2666. public angle: number;
  2667. public angularSpeed: number;
  2668. }
  2669. }
  2670. declare module BABYLON {
  2671. class ParticleSystem implements IDisposable {
  2672. public name: string;
  2673. static BLENDMODE_ONEONE: number;
  2674. static BLENDMODE_STANDARD: number;
  2675. public id: string;
  2676. public renderingGroupId: number;
  2677. public emitter: any;
  2678. public emitRate: number;
  2679. public manualEmitCount: number;
  2680. public updateSpeed: number;
  2681. public targetStopDuration: number;
  2682. public disposeOnStop: boolean;
  2683. public minEmitPower: number;
  2684. public maxEmitPower: number;
  2685. public minLifeTime: number;
  2686. public maxLifeTime: number;
  2687. public minSize: number;
  2688. public maxSize: number;
  2689. public minAngularSpeed: number;
  2690. public maxAngularSpeed: number;
  2691. public particleTexture: Texture;
  2692. public onDispose: () => void;
  2693. public blendMode: number;
  2694. public forceDepthWrite: boolean;
  2695. public gravity: Vector3;
  2696. public direction1: Vector3;
  2697. public direction2: Vector3;
  2698. public minEmitBox: Vector3;
  2699. public maxEmitBox: Vector3;
  2700. public color1: Color4;
  2701. public color2: Color4;
  2702. public colorDead: Color4;
  2703. public textureMask: Color4;
  2704. public startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void;
  2705. public startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void;
  2706. private particles;
  2707. private _capacity;
  2708. private _scene;
  2709. private _vertexDeclaration;
  2710. private _vertexStrideSize;
  2711. private _stockParticles;
  2712. private _newPartsExcess;
  2713. private _vertexBuffer;
  2714. private _indexBuffer;
  2715. private _vertices;
  2716. private _effect;
  2717. private _customEffect;
  2718. private _cachedDefines;
  2719. private _scaledColorStep;
  2720. private _colorDiff;
  2721. private _scaledDirection;
  2722. private _scaledGravity;
  2723. private _currentRenderId;
  2724. private _alive;
  2725. private _started;
  2726. private _stopped;
  2727. private _actualFrame;
  2728. private _scaledUpdateSpeed;
  2729. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  2730. public getCapacity(): number;
  2731. public isAlive(): boolean;
  2732. public isStarted(): boolean;
  2733. public start(): void;
  2734. public stop(): void;
  2735. public _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
  2736. private _update(newParticles);
  2737. private _getEffect();
  2738. public animate(): void;
  2739. public render(): number;
  2740. public dispose(): void;
  2741. public clone(name: string, newEmitter: any): ParticleSystem;
  2742. }
  2743. }
  2744. declare module BABYLON {
  2745. interface IPhysicsEnginePlugin {
  2746. initialize(iterations?: number): any;
  2747. setGravity(gravity: Vector3): void;
  2748. runOneStep(delta: number): void;
  2749. registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any;
  2750. registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  2751. unregisterMesh(mesh: AbstractMesh): any;
  2752. applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  2753. createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean;
  2754. dispose(): void;
  2755. isSupported(): boolean;
  2756. updateBodyPosition(mesh: AbstractMesh): void;
  2757. }
  2758. interface PhysicsBodyCreationOptions {
  2759. mass: number;
  2760. friction: number;
  2761. restitution: number;
  2762. }
  2763. interface PhysicsCompoundBodyPart {
  2764. mesh: Mesh;
  2765. impostor: number;
  2766. }
  2767. class PhysicsEngine {
  2768. public gravity: Vector3;
  2769. private _currentPlugin;
  2770. constructor(plugin?: IPhysicsEnginePlugin);
  2771. public _initialize(gravity?: Vector3): void;
  2772. public _runOneStep(delta: number): void;
  2773. public _setGravity(gravity: Vector3): void;
  2774. public _registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any;
  2775. public _registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  2776. public _unregisterMesh(mesh: AbstractMesh): void;
  2777. public _applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  2778. public _createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean;
  2779. public _updateBodyPosition(mesh: AbstractMesh): void;
  2780. public dispose(): void;
  2781. public isSupported(): boolean;
  2782. static NoImpostor: number;
  2783. static SphereImpostor: number;
  2784. static BoxImpostor: number;
  2785. static PlaneImpostor: number;
  2786. static CompoundImpostor: number;
  2787. static MeshImpostor: number;
  2788. static CapsuleImpostor: number;
  2789. static ConeImpostor: number;
  2790. static CylinderImpostor: number;
  2791. static ConvexHullImpostor: number;
  2792. static Epsilon: number;
  2793. }
  2794. }
  2795. declare module BABYLON {
  2796. class CannonJSPlugin implements IPhysicsEnginePlugin {
  2797. public checkWithEpsilon: (value: number) => number;
  2798. private _world;
  2799. private _registeredMeshes;
  2800. private _physicsMaterials;
  2801. public initialize(iterations?: number): void;
  2802. private _checkWithEpsilon(value);
  2803. public runOneStep(delta: number): void;
  2804. public setGravity(gravity: Vector3): void;
  2805. public registerMesh(mesh: AbstractMesh, impostor: number, options?: PhysicsBodyCreationOptions): any;
  2806. private _createSphere(radius, mesh, options?);
  2807. private _createBox(x, y, z, mesh, options?);
  2808. private _createPlane(mesh, options?);
  2809. private _createConvexPolyhedron(rawVerts, rawFaces, mesh, options?);
  2810. private _addMaterial(friction, restitution);
  2811. private _createRigidBodyFromShape(shape, mesh, mass, friction, restitution);
  2812. public registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  2813. private _unbindBody(body);
  2814. public unregisterMesh(mesh: AbstractMesh): void;
  2815. public applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  2816. public updateBodyPosition: (mesh: AbstractMesh) => void;
  2817. public createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3): boolean;
  2818. public dispose(): void;
  2819. public isSupported(): boolean;
  2820. }
  2821. }
  2822. declare module BABYLON {
  2823. class OimoJSPlugin implements IPhysicsEnginePlugin {
  2824. private _world;
  2825. private _registeredMeshes;
  2826. private _checkWithEpsilon(value);
  2827. public initialize(iterations?: number): void;
  2828. public setGravity(gravity: Vector3): void;
  2829. public registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any;
  2830. public registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  2831. private _createBodyAsCompound(part, options, initialMesh);
  2832. public unregisterMesh(mesh: AbstractMesh): void;
  2833. private _unbindBody(body);
  2834. /**
  2835. * Update the body position according to the mesh position
  2836. * @param mesh
  2837. */
  2838. public updateBodyPosition: (mesh: AbstractMesh) => void;
  2839. public applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  2840. public createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean;
  2841. public dispose(): void;
  2842. public isSupported(): boolean;
  2843. private _getLastShape(body);
  2844. public runOneStep(time: number): void;
  2845. }
  2846. }
  2847. declare module BABYLON {
  2848. class AnaglyphPostProcess extends PostProcess {
  2849. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2850. }
  2851. }
  2852. declare module BABYLON {
  2853. class BlackAndWhitePostProcess extends PostProcess {
  2854. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2855. }
  2856. }
  2857. declare module BABYLON {
  2858. class BlurPostProcess extends PostProcess {
  2859. public direction: Vector2;
  2860. public blurWidth: number;
  2861. constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2862. }
  2863. }
  2864. declare module BABYLON {
  2865. class ConvolutionPostProcess extends PostProcess {
  2866. public kernel: number[];
  2867. constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2868. static EdgeDetect0Kernel: number[];
  2869. static EdgeDetect1Kernel: number[];
  2870. static EdgeDetect2Kernel: number[];
  2871. static SharpenKernel: number[];
  2872. static EmbossKernel: number[];
  2873. static GaussianKernel: number[];
  2874. }
  2875. }
  2876. declare module BABYLON {
  2877. class DisplayPassPostProcess extends PostProcess {
  2878. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2879. }
  2880. }
  2881. declare module BABYLON {
  2882. class FilterPostProcess extends PostProcess {
  2883. public kernelMatrix: Matrix;
  2884. constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2885. }
  2886. }
  2887. declare module BABYLON {
  2888. class FxaaPostProcess extends PostProcess {
  2889. public texelWidth: number;
  2890. public texelHeight: number;
  2891. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2892. }
  2893. }
  2894. declare module BABYLON {
  2895. class OculusDistortionCorrectionPostProcess extends PostProcess {
  2896. public aspectRatio: number;
  2897. private _isRightEye;
  2898. private _distortionFactors;
  2899. private _postProcessScaleFactor;
  2900. private _lensCenterOffset;
  2901. private _scaleIn;
  2902. private _scaleFactor;
  2903. private _lensCenter;
  2904. constructor(name: string, camera: Camera, isRightEye: boolean, cameraSettings: any);
  2905. }
  2906. }
  2907. declare module BABYLON {
  2908. class PassPostProcess extends PostProcess {
  2909. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2910. }
  2911. }
  2912. declare module BABYLON {
  2913. class PostProcess {
  2914. public name: string;
  2915. public onApply: (Effect: any) => void;
  2916. public onBeforeRender: (Effect: any) => void;
  2917. public onSizeChanged: () => void;
  2918. public onActivate: (Camera: any) => void;
  2919. public width: number;
  2920. public height: number;
  2921. public renderTargetSamplingMode: number;
  2922. private _camera;
  2923. private _scene;
  2924. private _engine;
  2925. private _renderRatio;
  2926. private _reusable;
  2927. public _textures: SmartArray<WebGLTexture>;
  2928. public _currentRenderTextureInd: number;
  2929. private _effect;
  2930. constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number, camera: Camera, samplingMode: number, engine?: Engine, reusable?: boolean);
  2931. public isReusable(): boolean;
  2932. public activate(camera: Camera, sourceTexture?: WebGLTexture): void;
  2933. public apply(): Effect;
  2934. public dispose(camera: Camera): void;
  2935. }
  2936. }
  2937. declare module BABYLON {
  2938. class PostProcessManager {
  2939. private _scene;
  2940. private _indexBuffer;
  2941. private _vertexDeclaration;
  2942. private _vertexStrideSize;
  2943. private _vertexBuffer;
  2944. constructor(scene: Scene);
  2945. public _prepareFrame(sourceTexture?: WebGLTexture): boolean;
  2946. public _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture): void;
  2947. public dispose(): void;
  2948. }
  2949. }
  2950. declare module BABYLON {
  2951. class RefractionPostProcess extends PostProcess {
  2952. public color: Color3;
  2953. public depth: number;
  2954. public colorLevel: number;
  2955. private _refRexture;
  2956. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  2957. public dispose(camera: Camera): void;
  2958. }
  2959. }
  2960. declare module BABYLON {
  2961. class PostProcessRenderEffect {
  2962. private _engine;
  2963. private _postProcesses;
  2964. private _getPostProcess;
  2965. private _singleInstance;
  2966. private _cameras;
  2967. private _indicesForCamera;
  2968. private _renderPasses;
  2969. private _renderEffectAsPasses;
  2970. public _name: string;
  2971. public applyParameters: (postProcess: PostProcess) => void;
  2972. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  2973. public _update(): void;
  2974. public addPass(renderPass: PostProcessRenderPass): void;
  2975. public removePass(renderPass: PostProcessRenderPass): void;
  2976. public addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  2977. public getPass(passName: string): void;
  2978. public emptyPasses(): void;
  2979. public _attachCameras(cameras: Camera): any;
  2980. public _attachCameras(cameras: Camera[]): any;
  2981. public _detachCameras(cameras: Camera): any;
  2982. public _detachCameras(cameras: Camera[]): any;
  2983. public _enable(cameras: Camera): any;
  2984. public _enable(cameras: Camera[]): any;
  2985. public _disable(cameras: Camera): any;
  2986. public _disable(cameras: Camera[]): any;
  2987. public getPostProcess(camera?: Camera): PostProcess;
  2988. private _linkParameters();
  2989. private _linkTextures(effect);
  2990. }
  2991. }
  2992. declare module BABYLON {
  2993. class PostProcessRenderPass {
  2994. private _enabled;
  2995. private _renderList;
  2996. private _renderTexture;
  2997. private _scene;
  2998. private _refCount;
  2999. public _name: string;
  3000. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  3001. public _incRefCount(): number;
  3002. public _decRefCount(): number;
  3003. public _update(): void;
  3004. public setRenderList(renderList: Mesh[]): void;
  3005. public getRenderTexture(): RenderTargetTexture;
  3006. }
  3007. }
  3008. declare module BABYLON {
  3009. class PostProcessRenderPipeline {
  3010. private _engine;
  3011. private _renderEffects;
  3012. private _renderEffectsForIsolatedPass;
  3013. private _cameras;
  3014. public _name: string;
  3015. private static PASS_EFFECT_NAME;
  3016. private static PASS_SAMPLER_NAME;
  3017. constructor(engine: Engine, name: string);
  3018. public addEffect(renderEffect: PostProcessRenderEffect): void;
  3019. public _enableEffect(renderEffectName: string, cameras: Camera): any;
  3020. public _enableEffect(renderEffectName: string, cameras: Camera[]): any;
  3021. public _disableEffect(renderEffectName: string, cameras: Camera): any;
  3022. public _disableEffect(renderEffectName: string, cameras: Camera[]): any;
  3023. public _attachCameras(cameras: Camera, unique: boolean): any;
  3024. public _attachCameras(cameras: Camera[], unique: boolean): any;
  3025. public _detachCameras(cameras: Camera): any;
  3026. public _detachCameras(cameras: Camera[]): any;
  3027. public _enableDisplayOnlyPass(passName: any, cameras: Camera): any;
  3028. public _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any;
  3029. public _disableDisplayOnlyPass(cameras: Camera): any;
  3030. public _disableDisplayOnlyPass(cameras: Camera[]): any;
  3031. public _update(): void;
  3032. }
  3033. }
  3034. declare module BABYLON {
  3035. class PostProcessRenderPipelineManager {
  3036. private _renderPipelines;
  3037. constructor();
  3038. public addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  3039. public attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  3040. public attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  3041. public detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  3042. public detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  3043. public enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  3044. public enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  3045. public disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  3046. public disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  3047. public enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  3048. public enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  3049. public disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  3050. public disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  3051. public update(): void;
  3052. }
  3053. }
  3054. declare module BABYLON {
  3055. class BoundingBoxRenderer {
  3056. public frontColor: Color3;
  3057. public backColor: Color3;
  3058. public showBackLines: boolean;
  3059. public renderList: SmartArray<BoundingBox>;
  3060. private _scene;
  3061. private _colorShader;
  3062. private _vb;
  3063. private _ib;
  3064. constructor(scene: Scene);
  3065. public reset(): void;
  3066. public render(): void;
  3067. public dispose(): void;
  3068. }
  3069. }
  3070. declare module BABYLON {
  3071. class OutlineRenderer {
  3072. private _scene;
  3073. private _effect;
  3074. private _cachedDefines;
  3075. constructor(scene: Scene);
  3076. public render(subMesh: SubMesh, batch: _InstancesBatch): void;
  3077. public isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  3078. }
  3079. }
  3080. declare module BABYLON {
  3081. class RenderingGroup {
  3082. public index: number;
  3083. private _scene;
  3084. private _opaqueSubMeshes;
  3085. private _transparentSubMeshes;
  3086. private _alphaTestSubMeshes;
  3087. private _activeVertices;
  3088. constructor(index: number, scene: Scene);
  3089. public render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents: () => void) => void, beforeTransparents: any): boolean;
  3090. public prepare(): void;
  3091. public dispatch(subMesh: SubMesh): void;
  3092. }
  3093. }
  3094. declare module BABYLON {
  3095. class RenderingManager {
  3096. static MAX_RENDERINGGROUPS: number;
  3097. private _scene;
  3098. private _renderingGroups;
  3099. private _depthBufferAlreadyCleaned;
  3100. constructor(scene: Scene);
  3101. private _renderParticles(index, activeMeshes);
  3102. private _renderSprites(index);
  3103. private _clearDepthBuffer();
  3104. public render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents: () => void) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  3105. public reset(): void;
  3106. public dispatch(subMesh: SubMesh): void;
  3107. }
  3108. }
  3109. declare module BABYLON {
  3110. class Sprite {
  3111. public name: string;
  3112. public position: Vector3;
  3113. public color: Color4;
  3114. public size: number;
  3115. public angle: number;
  3116. public cellIndex: number;
  3117. public invertU: number;
  3118. public invertV: number;
  3119. public disposeWhenFinishedAnimating: boolean;
  3120. public animations: Animation[];
  3121. private _animationStarted;
  3122. private _loopAnimation;
  3123. private _fromIndex;
  3124. private _toIndex;
  3125. private _delay;
  3126. private _direction;
  3127. private _frameCount;
  3128. private _manager;
  3129. private _time;
  3130. constructor(name: string, manager: SpriteManager);
  3131. public playAnimation(from: number, to: number, loop: boolean, delay: number): void;
  3132. public stopAnimation(): void;
  3133. public _animate(deltaTime: number): void;
  3134. public dispose(): void;
  3135. }
  3136. }
  3137. declare module BABYLON {
  3138. class SpriteManager {
  3139. public name: string;
  3140. public cellSize: number;
  3141. public sprites: Sprite[];
  3142. public renderingGroupId: number;
  3143. public onDispose: () => void;
  3144. private _capacity;
  3145. private _spriteTexture;
  3146. private _epsilon;
  3147. private _scene;
  3148. private _vertexDeclaration;
  3149. private _vertexStrideSize;
  3150. private _vertexBuffer;
  3151. private _indexBuffer;
  3152. private _vertices;
  3153. private _effectBase;
  3154. private _effectFog;
  3155. constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number);
  3156. private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize);
  3157. public render(): void;
  3158. public dispose(): void;
  3159. }
  3160. }
  3161. declare module BABYLON.Internals {
  3162. class AndOrNotEvaluator {
  3163. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  3164. private static _HandleParenthesisContent(parenthesisContent, evaluateCallback);
  3165. private static _SimplifyNegation(booleanString);
  3166. }
  3167. }
  3168. declare module BABYLON {
  3169. interface IAssetTask {
  3170. onSuccess: (task: IAssetTask) => void;
  3171. onError: (task: IAssetTask) => void;
  3172. isCompleted: boolean;
  3173. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  3174. }
  3175. class MeshAssetTask implements IAssetTask {
  3176. public name: string;
  3177. public meshesNames: any;
  3178. public rootUrl: string;
  3179. public sceneFilename: string;
  3180. public loadedMeshes: AbstractMesh[];
  3181. public loadedParticleSystems: ParticleSystem[];
  3182. public loadedSkeletons: Skeleton[];
  3183. public onSuccess: (task: IAssetTask) => void;
  3184. public onError: (task: IAssetTask) => void;
  3185. public isCompleted: boolean;
  3186. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  3187. public run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  3188. }
  3189. class TextFileAssetTask implements IAssetTask {
  3190. public name: string;
  3191. public url: string;
  3192. public onSuccess: (task: IAssetTask) => void;
  3193. public onError: (task: IAssetTask) => void;
  3194. public isCompleted: boolean;
  3195. public text: string;
  3196. constructor(name: string, url: string);
  3197. public run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  3198. }
  3199. class BinaryFileAssetTask implements IAssetTask {
  3200. public name: string;
  3201. public url: string;
  3202. public onSuccess: (task: IAssetTask) => void;
  3203. public onError: (task: IAssetTask) => void;
  3204. public isCompleted: boolean;
  3205. public data: ArrayBuffer;
  3206. constructor(name: string, url: string);
  3207. public run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  3208. }
  3209. class ImageAssetTask implements IAssetTask {
  3210. public name: string;
  3211. public url: string;
  3212. public onSuccess: (task: IAssetTask) => void;
  3213. public onError: (task: IAssetTask) => void;
  3214. public isCompleted: boolean;
  3215. public image: HTMLImageElement;
  3216. constructor(name: string, url: string);
  3217. public run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  3218. }
  3219. class TextureAssetTask implements IAssetTask {
  3220. public name: string;
  3221. public url: string;
  3222. public noMipmap: boolean;
  3223. public invertY: boolean;
  3224. public samplingMode: number;
  3225. public onSuccess: (task: IAssetTask) => void;
  3226. public onError: (task: IAssetTask) => void;
  3227. public isCompleted: boolean;
  3228. public texture: Texture;
  3229. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  3230. public run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  3231. }
  3232. class AssetsManager {
  3233. private _tasks;
  3234. private _scene;
  3235. private _waitingTasksCount;
  3236. public onFinish: (tasks: IAssetTask[]) => void;
  3237. public onTaskSuccess: (task: IAssetTask) => void;
  3238. public onTaskError: (task: IAssetTask) => void;
  3239. public useDefaultLoadingScreen: boolean;
  3240. constructor(scene: Scene);
  3241. public addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  3242. public addTextFileTask(taskName: string, url: string): IAssetTask;
  3243. public addBinaryFileTask(taskName: string, url: string): IAssetTask;
  3244. public addImageTask(taskName: string, url: string): IAssetTask;
  3245. public addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask;
  3246. private _decreaseWaitingTasksCount();
  3247. private _runTask(task);
  3248. public reset(): AssetsManager;
  3249. public load(): AssetsManager;
  3250. }
  3251. }
  3252. declare module BABYLON {
  3253. class Database {
  3254. private callbackManifestChecked;
  3255. private currentSceneUrl;
  3256. private db;
  3257. private enableSceneOffline;
  3258. private enableTexturesOffline;
  3259. private manifestVersionFound;
  3260. private mustUpdateRessources;
  3261. private hasReachedQuota;
  3262. private isSupported;
  3263. private idbFactory;
  3264. static isUASupportingBlobStorage: boolean;
  3265. constructor(urlToScene: string, callbackManifestChecked: (boolean: any) => any);
  3266. static parseURL: (url: string) => string;
  3267. static ReturnFullUrlLocation: (url: string) => string;
  3268. public checkManifestFile(): void;
  3269. public openAsync(successCallback: any, errorCallback: any): void;
  3270. public loadImageFromDB(url: string, image: HTMLImageElement): void;
  3271. private _loadImageFromDBAsync(url, image, notInDBCallback);
  3272. private _saveImageIntoDBAsync(url, image);
  3273. private _checkVersionFromDB(url, versionLoaded);
  3274. private _loadVersionFromDBAsync(url, callback, updateInDBCallback);
  3275. private _saveVersionIntoDBAsync(url, callback);
  3276. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  3277. private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?);
  3278. private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?);
  3279. }
  3280. }
  3281. declare module BABYLON {
  3282. class FilesInput {
  3283. private engine;
  3284. private currentScene;
  3285. private canvas;
  3286. private sceneLoadedCallback;
  3287. private progressCallback;
  3288. private additionnalRenderLoopLogicCallback;
  3289. private textureLoadingCallback;
  3290. private startingProcessingFilesCallback;
  3291. private elementToMonitor;
  3292. static FilesTextures: any[];
  3293. static FilesToLoad: any[];
  3294. constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any);
  3295. public monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  3296. private renderFunction();
  3297. private drag(e);
  3298. private drop(eventDrop);
  3299. private loadFiles(event);
  3300. }
  3301. }
  3302. declare module BABYLON {
  3303. class Gamepads {
  3304. private babylonGamepads;
  3305. private oneGamepadConnected;
  3306. private isMonitoring;
  3307. private gamepadEventSupported;
  3308. private gamepadSupportAvailable;
  3309. private _callbackGamepadConnected;
  3310. private buttonADataURL;
  3311. private static gamepadDOMInfo;
  3312. constructor(ongamedpadconnected: (gamepad: Gamepad) => void);
  3313. private _insertGamepadDOMInstructions();
  3314. private _insertGamepadDOMNotSupported();
  3315. public dispose(): void;
  3316. private _onGamepadConnected(evt);
  3317. private _addNewGamepad(gamepad);
  3318. private _onGamepadDisconnected(evt);
  3319. private _startMonitoringGamepads();
  3320. private _stopMonitoringGamepads();
  3321. private _checkGamepadsStatus();
  3322. private _updateGamepadObjects();
  3323. }
  3324. class StickValues {
  3325. public x: any;
  3326. public y: any;
  3327. constructor(x: any, y: any);
  3328. }
  3329. class Gamepad {
  3330. public id: string;
  3331. public index: number;
  3332. public browserGamepad: any;
  3333. private _leftStick;
  3334. private _rightStick;
  3335. private _onleftstickchanged;
  3336. private _onrightstickchanged;
  3337. constructor(id: string, index: number, browserGamepad: any);
  3338. public onleftstickchanged(callback: (values: StickValues) => void): void;
  3339. public onrightstickchanged(callback: (values: StickValues) => void): void;
  3340. public leftStick : StickValues;
  3341. public rightStick : StickValues;
  3342. public update(): void;
  3343. }
  3344. class GenericPad extends Gamepad {
  3345. public id: string;
  3346. public index: number;
  3347. public gamepad: any;
  3348. private _buttons;
  3349. private _onbuttondown;
  3350. private _onbuttonup;
  3351. public onbuttondown(callback: (buttonPressed: number) => void): void;
  3352. public onbuttonup(callback: (buttonReleased: number) => void): void;
  3353. constructor(id: string, index: number, gamepad: any);
  3354. private _setButtonValue(newValue, currentValue, buttonIndex);
  3355. public update(): void;
  3356. }
  3357. enum Xbox360Button {
  3358. A = 0,
  3359. B = 1,
  3360. X = 2,
  3361. Y = 3,
  3362. Start = 4,
  3363. Back = 5,
  3364. LB = 6,
  3365. RB = 7,
  3366. LeftStick = 8,
  3367. RightStick = 9,
  3368. }
  3369. enum Xbox360Dpad {
  3370. Up = 0,
  3371. Down = 1,
  3372. Left = 2,
  3373. Right = 3,
  3374. }
  3375. class Xbox360Pad extends Gamepad {
  3376. private _leftTrigger;
  3377. private _rightTrigger;
  3378. private _onlefttriggerchanged;
  3379. private _onrighttriggerchanged;
  3380. private _onbuttondown;
  3381. private _onbuttonup;
  3382. private _ondpaddown;
  3383. private _ondpadup;
  3384. private _buttonA;
  3385. private _buttonB;
  3386. private _buttonX;
  3387. private _buttonY;
  3388. private _buttonBack;
  3389. private _buttonStart;
  3390. private _buttonLB;
  3391. private _buttonRB;
  3392. private _buttonLeftStick;
  3393. private _buttonRightStick;
  3394. private _dPadUp;
  3395. private _dPadDown;
  3396. private _dPadLeft;
  3397. private _dPadRight;
  3398. public onlefttriggerchanged(callback: (value: number) => void): void;
  3399. public onrighttriggerchanged(callback: (value: number) => void): void;
  3400. public leftTrigger : number;
  3401. public rightTrigger : number;
  3402. public onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  3403. public onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  3404. public ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  3405. public ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  3406. private _setButtonValue(newValue, currentValue, buttonType);
  3407. private _setDPadValue(newValue, currentValue, buttonType);
  3408. public buttonA : number;
  3409. public buttonB : number;
  3410. public buttonX : number;
  3411. public buttonY : number;
  3412. public buttonStart : number;
  3413. public buttonBack : number;
  3414. public buttonLB : number;
  3415. public buttonRB : number;
  3416. public buttonLeftStick : number;
  3417. public buttonRightStick : number;
  3418. public dPadUp : number;
  3419. public dPadDown : number;
  3420. public dPadLeft : number;
  3421. public dPadRight : number;
  3422. public update(): void;
  3423. }
  3424. }
  3425. interface Navigator {
  3426. getGamepads(func?: any): any;
  3427. webkitGetGamepads(func?: any): any;
  3428. msGetGamepads(func?: any): any;
  3429. webkitGamepads(func?: any): any;
  3430. }
  3431. declare module BABYLON {
  3432. class SceneSerializer {
  3433. static Serialize(scene: Scene): any;
  3434. }
  3435. }
  3436. declare module BABYLON {
  3437. class SmartArray<T> {
  3438. public data: T[];
  3439. public length: number;
  3440. private _id;
  3441. private _duplicateId;
  3442. constructor(capacity: number);
  3443. public push(value: any): void;
  3444. public pushNoDuplicate(value: any): void;
  3445. public sort(compareFn: any): void;
  3446. public reset(): void;
  3447. public concat(array: any): void;
  3448. public concatWithNoDuplicate(array: any): void;
  3449. public indexOf(value: any): number;
  3450. private static _GlobalId;
  3451. }
  3452. }
  3453. declare module BABYLON {
  3454. class Tags {
  3455. static EnableFor(obj: any): void;
  3456. static DisableFor(obj: any): void;
  3457. static HasTags(obj: any): boolean;
  3458. static GetTags(obj: any): any;
  3459. static AddTagsTo(obj: any, tagsString: string): void;
  3460. static _AddTagTo(obj: any, tag: string): void;
  3461. static RemoveTagsFrom(obj: any, tagsString: string): void;
  3462. static _RemoveTagFrom(obj: any, tag: string): void;
  3463. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  3464. }
  3465. }
  3466. declare module BABYLON {
  3467. interface IAnimatable {
  3468. animations: Animation[];
  3469. }
  3470. interface ISize {
  3471. width: number;
  3472. height: number;
  3473. }
  3474. class Tools {
  3475. static BaseUrl: string;
  3476. static GetExponantOfTwo: (value: number, max: number) => number;
  3477. static GetFilename(path: string): string;
  3478. static GetDOMTextContent(element: HTMLElement): string;
  3479. static ToDegrees(angle: number): number;
  3480. static ToRadians(angle: number): number;
  3481. static ExtractMinAndMaxIndexed(positions: number[], indices: number[], indexStart: number, indexCount: number): {
  3482. minimum: Vector3;
  3483. maximum: Vector3;
  3484. };
  3485. static ExtractMinAndMax(positions: number[], start: number, count: number): {
  3486. minimum: Vector3;
  3487. maximum: Vector3;
  3488. };
  3489. static MakeArray(obj: any, allowsNullUndefined?: boolean): any[];
  3490. static GetPointerPrefix(): string;
  3491. static QueueNewFrame(func: any): void;
  3492. static RequestFullscreen(element: any): void;
  3493. static ExitFullscreen(): void;
  3494. static CleanUrl(url: string): string;
  3495. static LoadImage(url: string, onload: any, onerror: any, database: any): HTMLImageElement;
  3496. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void;
  3497. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  3498. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  3499. static WithinEpsilon(a: number, b: number): boolean;
  3500. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  3501. static IsEmpty(obj: any): boolean;
  3502. static RegisterTopRootEvents(events: {
  3503. name: string;
  3504. handler: EventListener;
  3505. }[]): void;
  3506. static UnregisterTopRootEvents(events: {
  3507. name: string;
  3508. handler: EventListener;
  3509. }[]): void;
  3510. static GetFps(): number;
  3511. static GetDeltaTime(): number;
  3512. static _MeasureFps(): void;
  3513. static CreateScreenshot(engine: Engine, camera: Camera, size: any): void;
  3514. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  3515. private static _NoneLogLevel;
  3516. private static _MessageLogLevel;
  3517. private static _WarningLogLevel;
  3518. private static _ErrorLogLevel;
  3519. static NoneLogLevel : number;
  3520. static MessageLogLevel : number;
  3521. static WarningLogLevel : number;
  3522. static ErrorLogLevel : number;
  3523. static AllLogLevel : number;
  3524. private static _FormatMessage(message);
  3525. static Log: (message: string) => void;
  3526. private static _LogDisabled(message);
  3527. private static _LogEnabled(message);
  3528. static Warn: (message: string) => void;
  3529. private static _WarnDisabled(message);
  3530. private static _WarnEnabled(message);
  3531. static Error: (message: string) => void;
  3532. private static _ErrorDisabled(message);
  3533. private static _ErrorEnabled(message);
  3534. static LogLevels : number;
  3535. }
  3536. }
  3537. declare module BABYLON.Internals {
  3538. interface DDSInfo {
  3539. width: number;
  3540. height: number;
  3541. mipmapCount: number;
  3542. isFourCC: boolean;
  3543. isRGB: boolean;
  3544. isLuminance: boolean;
  3545. isCube: boolean;
  3546. }
  3547. class DDSTools {
  3548. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  3549. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  3550. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  3551. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  3552. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  3553. }
  3554. }
  3555. /**
  3556. * Based on jsTGALoader - Javascript loader for TGA file
  3557. * By Vincent Thibault
  3558. * @blog http://blog.robrowser.com/javascript-tga-loader.html
  3559. */
  3560. declare module BABYLON.Internals {
  3561. class TGATools {
  3562. private static _TYPE_NO_DATA;
  3563. private static _TYPE_INDEXED;
  3564. private static _TYPE_RGB;
  3565. private static _TYPE_GREY;
  3566. private static _TYPE_RLE_INDEXED;
  3567. private static _TYPE_RLE_RGB;
  3568. private static _TYPE_RLE_GREY;
  3569. private static _ORIGIN_MASK;
  3570. private static _ORIGIN_SHIFT;
  3571. private static _ORIGIN_BL;
  3572. private static _ORIGIN_BR;
  3573. private static _ORIGIN_UL;
  3574. private static _ORIGIN_UR;
  3575. static GetTGAHeader(data: Uint8Array): any;
  3576. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  3577. static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  3578. static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  3579. static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  3580. static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  3581. static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  3582. static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  3583. }
  3584. }
  3585. declare module BABYLON {
  3586. enum JoystickAxis {
  3587. X = 0,
  3588. Y = 1,
  3589. Z = 2,
  3590. }
  3591. class VirtualJoystick {
  3592. public reverseLeftRight: boolean;
  3593. public reverseUpDown: boolean;
  3594. public deltaPosition: Vector3;
  3595. public pressed: boolean;
  3596. private static _globalJoystickIndex;
  3597. private static vjCanvas;
  3598. private static vjCanvasContext;
  3599. private static vjCanvasWidth;
  3600. private static vjCanvasHeight;
  3601. private static halfWidth;
  3602. private static halfHeight;
  3603. private _action;
  3604. private _axisTargetedByLeftAndRight;
  3605. private _axisTargetedByUpAndDown;
  3606. private _joystickSensibility;
  3607. private _inversedSensibility;
  3608. private _rotationSpeed;
  3609. private _inverseRotationSpeed;
  3610. private _rotateOnAxisRelativeToMesh;
  3611. private _joystickPointerID;
  3612. private _joystickColor;
  3613. private _joystickPointerPos;
  3614. private _joystickPointerStartPos;
  3615. private _deltaJoystickVector;
  3616. private _leftJoystick;
  3617. private _joystickIndex;
  3618. private _touches;
  3619. constructor(leftJoystick?: boolean);
  3620. public setJoystickSensibility(newJoystickSensibility: number): void;
  3621. private _onPointerDown(e);
  3622. private _onPointerMove(e);
  3623. private _onPointerUp(e);
  3624. /**
  3625. * Change the color of the virtual joystick
  3626. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  3627. */
  3628. public setJoystickColor(newColor: string): void;
  3629. public setActionOnTouch(action: () => any): void;
  3630. public setAxisForLeftRight(axis: JoystickAxis): void;
  3631. public setAxisForUpDown(axis: JoystickAxis): void;
  3632. private _clearCanvas();
  3633. private _drawVirtualJoystick();
  3634. public releaseCanvas(): void;
  3635. }
  3636. }
  3637. declare module BABYLON.VirtualJoystick {
  3638. class Collection<T> {
  3639. private _count;
  3640. private _collection;
  3641. constructor();
  3642. public Count(): number;
  3643. public add<T>(key: string, item: T): number;
  3644. public remove(key: string): number;
  3645. public item(key: string): any;
  3646. public forEach<T>(block: (item: T) => void): void;
  3647. }
  3648. }