babylon.math.d.ts 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /// <reference path="../babylon.d.ts" />
  2. declare module BABYLON {
  3. interface RayTriangleIntersection {
  4. hit: bool;
  5. distance: number;
  6. bu: number;
  7. bv: number;
  8. }
  9. interface IColor3 {
  10. r: number;
  11. g: number;
  12. b: number;
  13. }
  14. interface Size2D
  15. {
  16. width: number;
  17. height: number;
  18. }
  19. interface Sphere {
  20. center: Vector3;
  21. radius: number;
  22. }
  23. class Ray {
  24. origin: Vector3;
  25. direction: Vector3;
  26. constructor(origin: Vector3, direction: Vector3);
  27. intersectsSphere(sphere: Sphere): bool;
  28. intersectsTriangle(vertex0: Vector3,
  29. vertex1: Vector3,
  30. vertex2: Vector3): RayTriangleIntersection;
  31. static CreateNew(x: number,
  32. y: number,
  33. viewportWidth: number,
  34. viewportHeight: number,
  35. world: Matrix,
  36. view: Matrix,
  37. projection: Matrix): Ray;
  38. }
  39. class Color3 implements IColor3 {
  40. r: number;
  41. g: number;
  42. b: number;
  43. constructor(intialR: number, initialG: number, initialB: number);
  44. equals(otherColor: Color3): bool;
  45. equals(otherColor: Color4): bool;
  46. toString(): string;
  47. clone(): Color3;
  48. multiply(otherColor: Color3): Color3;
  49. scale(scale: number): Color3;
  50. static FromArray(number[]): Color3;
  51. }
  52. class Color4 implements IColor3 {
  53. r: number;
  54. g: number;
  55. b: number;
  56. a: number;
  57. constructor(initialR: number, initialG: number, initialB: number, initialA: number);
  58. add(right: Color4): Color4;
  59. subtract(right: Color4): Color4;
  60. scale(factor: number): Color4;
  61. toString(): string;
  62. clone(): Color4;
  63. static Lerp(left: number, right: number, amount: number): Color4;
  64. static FromArray(number[]): Color4;
  65. }
  66. class Vector2 {
  67. x: number;
  68. y: number;
  69. constructor(x: number, y: number);
  70. toString(): string;
  71. add(other: Vector2): Vector2;
  72. subtract(other: Vector2): Vector2;
  73. negate(): Vector2;
  74. scale(factor: number): Vector2;
  75. equals(other: Vector2): bool;
  76. length(): number;
  77. lengthSquared(): number;
  78. normalize();
  79. clone(): Vector2;
  80. static Zero(): Vector2;
  81. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  82. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  83. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  84. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  85. static Dot(left: Vector2, right: Vector2): number;
  86. static Normalize(vector: Vector2): Vector2;
  87. static Minimize(left: Vector2, right: Vector2): Vector2;
  88. static Maximize(left: Vector2, right: Vector2): Vector2;
  89. static Transform(vector: Vector2, transformation: number[]): Vector2;
  90. static Distance(value1: Vector2, value2: Vector2): number;
  91. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  92. }
  93. class Vector3 {
  94. x: number;
  95. y: number;
  96. z: number;
  97. constructor(x: number, y: number, z: number);
  98. toString(): string;
  99. add(other: Vector3): Vector3;
  100. subtract(other: Vector3): Vector3;
  101. negate(): Vector3;
  102. scale(factor: number): Vector3;
  103. equals(other: Vector3): bool;
  104. multiply(other: Vector3): Vector3;
  105. divide(other: Vector3): Vector3;
  106. length(): number;
  107. lengthSquared(): number;
  108. normalize();
  109. clone(): Vector3;
  110. static FromArray(array: number[], offset?: number = 0);
  111. static Zero(): Vector3;
  112. static Up(): Vector3;
  113. static TransformCoordinates(vector: Vector3, transformation: Matrix);
  114. static TransformNormal(vector: Vector3, transformation: Matrix);
  115. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  116. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  117. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  118. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  119. static Dot(left: Vector3, right: Vector3): number;
  120. static Normalize(vector: Vector3): Vector3;
  121. static Unproject(source: Vector3,
  122. viewportWidth: number,
  123. viewportHeight: number,
  124. world: Matrix,
  125. view: Matrix,
  126. projection: Matrix): Vector3;
  127. static Minimize(left: Vector3, right: Vector3): Vector3;
  128. static Maximize(left: Vector3, right: Vector3): Vector3;
  129. static Distance(value1: Vector3, value2: Vector3): number;
  130. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  131. }
  132. class Quaternion {
  133. x: number;
  134. y: number;
  135. z: number;
  136. w: number;
  137. constructor(x: number, y: number, z: number, w: number);
  138. clone(): Quaternion;
  139. add(other: Quaternion): Quaternion;
  140. scale(factor: number): Quaternion;
  141. toEulerAngles(): Vector3;
  142. static FromArray(array: number[], offset?: number = 0): Quaternion;
  143. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  144. }
  145. class Matrix {
  146. m: number[];
  147. constructor();
  148. isIdentity(): bool;
  149. determinant(): number;
  150. toArray(): number[];
  151. invert(): void;
  152. multiply(other: Matrix): Matrix;
  153. equals(other: Matrix): Matrix;
  154. clone(): Matrix;
  155. static FromValues(m11: number, m12: number, m13: number, m14: number,
  156. m21: number, m22: number, m23: number, m24: number,
  157. m31: number, m32: number, m33: number, m34: number,
  158. m41: number, m42: number, m43: number, m44: number): Matrix;
  159. static Identity(): Matrix;
  160. static Zero(): Matrix;
  161. static RotationX(angle: number): Matrix;
  162. static RotationY(angle: number): Matrix;
  163. static RotationZ(angle: number): Matrix;
  164. static RotationAxis(axis: Vector3, angle: number): Matrix;
  165. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  166. static Scaling(scaleX: number, scaleY: number, scaleZ: number): Matrix;
  167. static Translation(x: number, y: number, z: number): Matrix;
  168. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  169. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  170. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  171. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  172. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  173. static AffineTransformation(scaling: number, rotationCenter: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  174. static GetFinalMatrix(viewport: Size2D, world: Matrix, view: Matrix, projection: Matrix): Matrix;
  175. static Transpose(matrix: Matrix): Matrix;
  176. static Reflection(plane: Plane): Matrix;
  177. }
  178. class Plane {
  179. normal: Vector3;
  180. d: number;
  181. normalize(): void;
  182. transform(transformation: Matrix): Plane;
  183. dotCoordinate(point: Vector3): number;
  184. static FromArray(array: number[]): Plane;
  185. static FromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  186. }
  187. class Frustum {
  188. static GetPlanes(transform: Matrix): Plane[];
  189. }
  190. }