babylon.mixins.ts 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // Mixins
  2. interface Window {
  3. mozIndexedDB: IDBFactory;
  4. webkitIndexedDB: IDBFactory;
  5. msIndexedDB: IDBFactory;
  6. webkitURL: typeof URL;
  7. mozRequestAnimationFrame(callback: FrameRequestCallback): number;
  8. oRequestAnimationFrame(callback: FrameRequestCallback): number;
  9. WebGLRenderingContext: WebGLRenderingContext;
  10. MSGesture: MSGesture;
  11. CANNON: any;
  12. AudioContext: AudioContext;
  13. webkitAudioContext: AudioContext;
  14. PointerEvent: any;
  15. Math: Math;
  16. Uint8Array: Uint8ArrayConstructor;
  17. Float32Array: Float32ArrayConstructor;
  18. mozURL: typeof URL;
  19. msURL: typeof URL;
  20. VRFrameData: any; // WebVR, from specs 1.1
  21. DracoDecoderModule: any;
  22. }
  23. interface WebGLRenderingContext {
  24. drawArraysInstanced(mode: number, first: number, count: number, primcount: number): void;
  25. drawElementsInstanced(mode: number, count: number, type: number, offset: number, primcount: number): void;
  26. vertexAttribDivisor(index: number, divisor: number): void;
  27. createVertexArray(): any;
  28. bindVertexArray(vao?: WebGLVertexArrayObject | null): void;
  29. deleteVertexArray(vao: WebGLVertexArrayObject): void;
  30. blitFramebuffer(srcX0: number, srcY0: number, srcX1: number, srcY1: number, dstX0: number, dstY0: number, dstX1: number, dstY1: number, mask: number, filter: number): void;
  31. renderbufferStorageMultisample(target: number, samples: number, internalformat: number, width: number, height: number): void;
  32. bindBufferBase(target: number, index: number, buffer: WebGLBuffer | null): void;
  33. getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): number;
  34. uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: number, uniformBlockBinding: number): void;
  35. // Queries
  36. createQuery(): WebGLQuery;
  37. deleteQuery(query: WebGLQuery): void;
  38. beginQuery(target: number, query: WebGLQuery): void;
  39. endQuery(target: number): void;
  40. getQueryParameter(query: WebGLQuery, pname: number): any;
  41. getQuery(target: number, pname: number): any;
  42. MAX_SAMPLES: number;
  43. RGBA8: number;
  44. READ_FRAMEBUFFER: number;
  45. DRAW_FRAMEBUFFER: number;
  46. UNIFORM_BUFFER: number;
  47. HALF_FLOAT_OES: number;
  48. RGBA16F: number;
  49. RGBA32F: number;
  50. R32F: number;
  51. RG32F: number;
  52. RGB32F: number;
  53. R16F: number;
  54. RG16F: number;
  55. RGB16F: number;
  56. RED: number;
  57. RG: number;
  58. R8: number;
  59. RG8: number;
  60. UNSIGNED_INT_24_8: number;
  61. DEPTH24_STENCIL8: number;
  62. /* Multiple Render Targets */
  63. drawBuffers(buffers: number[]): void;
  64. readBuffer(src: number): void;
  65. readonly COLOR_ATTACHMENT0: number; // 0x8CE1
  66. readonly COLOR_ATTACHMENT1: number; // 0x8CE2
  67. readonly COLOR_ATTACHMENT2: number; // 0x8CE3
  68. readonly COLOR_ATTACHMENT3: number; // 0x8CE4
  69. // Occlusion Query
  70. ANY_SAMPLES_PASSED_CONSERVATIVE: number;
  71. ANY_SAMPLES_PASSED: number;
  72. QUERY_RESULT_AVAILABLE: number;
  73. QUERY_RESULT: number;
  74. }
  75. interface Document {
  76. mozCancelFullScreen(): void;
  77. msCancelFullScreen(): void;
  78. mozFullScreen: boolean;
  79. msIsFullScreen: boolean;
  80. fullscreen: boolean;
  81. mozPointerLockElement: HTMLElement;
  82. msPointerLockElement: HTMLElement;
  83. webkitPointerLockElement: HTMLElement;
  84. }
  85. interface HTMLCanvasElement {
  86. msRequestPointerLock?(): void;
  87. mozRequestPointerLock?(): void;
  88. webkitRequestPointerLock?(): void;
  89. }
  90. interface CanvasRenderingContext2D {
  91. msImageSmoothingEnabled: boolean;
  92. }
  93. interface WebGLBuffer {
  94. references: number;
  95. capacity: number;
  96. is32Bits: boolean;
  97. }
  98. interface WebGLProgram {
  99. transformFeedback?: WebGLTransformFeedback | null;
  100. __SPECTOR_rebuildProgram?: ((vertexSourceCode: string, fragmentSourceCode: string, onCompiled: (program: WebGLProgram) => void, onError: (message: string) => void) => void) | null;
  101. }
  102. interface MouseEvent {
  103. mozMovementX: number;
  104. mozMovementY: number;
  105. webkitMovementX: number;
  106. webkitMovementY: number;
  107. msMovementX: number;
  108. msMovementY: number;
  109. }
  110. interface Navigator {
  111. mozGetVRDevices: (any: any) => any;
  112. webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
  113. mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
  114. msGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
  115. webkitGetGamepads(): Gamepad[];
  116. msGetGamepads(): Gamepad[];
  117. webkitGamepads(): Gamepad[];
  118. }
  119. interface HTMLVideoElement {
  120. mozSrcObject: any;
  121. }
  122. interface Screen {
  123. orientation: string;
  124. mozOrientation: string;
  125. }
  126. interface Math {
  127. fround(x: number): number;
  128. imul(a: number, b: number): number;
  129. }
  130. interface EXT_disjoint_timer_query {
  131. QUERY_COUNTER_BITS_EXT: number;
  132. TIME_ELAPSED_EXT: number;
  133. TIMESTAMP_EXT: number;
  134. GPU_DISJOINT_EXT: number;
  135. QUERY_RESULT_EXT: number;
  136. QUERY_RESULT_AVAILABLE_EXT: number;
  137. queryCounterEXT(query: WebGLQuery, target: number): void;
  138. createQueryEXT(): WebGLQuery;
  139. beginQueryEXT(target: number, query: WebGLQuery): void;
  140. endQueryEXT(target: number): void;
  141. getQueryObjectEXT(query: WebGLQuery, target: number): any;
  142. deleteQueryEXT(query: WebGLQuery): void;
  143. }
  144. interface WebGLUniformLocation {
  145. _currentState: any;
  146. }