UNPKG

@react-gnome/gjs-esm-types

Version:

TypeScript module declarations for GJS ESM modules.

1,532 lines (1,504 loc) 118 kB
/* * Type Definitions for Gjs (https://gjs.guide/) * * These type definitions are automatically generated, do not edit them by hand. * If you found a bug fix it in ts-for-gir itself or create a bug report on https://github.com/gjsify/ts-for-gjs */ import type GObject from "gi://GObject?version=2.0"; import type GLib from "gi://GLib?version=2.0"; declare module "gi://Graphene?version=1.0" { /** * Specify the order of the rotations on each axis. * * The %GRAPHENE_EULER_ORDER_DEFAULT value is special, and is used * as an alias for one of the other orders. */ enum EulerOrder { /** * Rotate in the default order; the * default order is one of the following enumeration values */ DEFAULT, /** * Rotate in the X, Y, and Z order. Deprecated in * Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SXYZ */ XYZ, /** * Rotate in the Y, Z, and X order. Deprecated in * Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SYZX */ YZX, /** * Rotate in the Z, X, and Y order. Deprecated in * Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SZXY */ ZXY, /** * Rotate in the X, Z, and Y order. Deprecated in * Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SXZY */ XZY, /** * Rotate in the Y, X, and Z order. Deprecated in * Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SYXZ */ YXZ, /** * Rotate in the Z, Y, and X order. Deprecated in * Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SZYX */ ZYX, /** * Defines a static rotation along the X, Y, and Z axes (Since: 1.10) */ SXYZ, /** * Defines a static rotation along the X, Y, and X axes (Since: 1.10) */ SXYX, /** * Defines a static rotation along the X, Z, and Y axes (Since: 1.10) */ SXZY, /** * Defines a static rotation along the X, Z, and X axes (Since: 1.10) */ SXZX, /** * Defines a static rotation along the Y, Z, and X axes (Since: 1.10) */ SYZX, /** * Defines a static rotation along the Y, Z, and Y axes (Since: 1.10) */ SYZY, /** * Defines a static rotation along the Y, X, and Z axes (Since: 1.10) */ SYXZ, /** * Defines a static rotation along the Y, X, and Y axes (Since: 1.10) */ SYXY, /** * Defines a static rotation along the Z, X, and Y axes (Since: 1.10) */ SZXY, /** * Defines a static rotation along the Z, X, and Z axes (Since: 1.10) */ SZXZ, /** * Defines a static rotation along the Z, Y, and X axes (Since: 1.10) */ SZYX, /** * Defines a static rotation along the Z, Y, and Z axes (Since: 1.10) */ SZYZ, /** * Defines a relative rotation along the Z, Y, and X axes (Since: 1.10) */ RZYX, /** * Defines a relative rotation along the X, Y, and X axes (Since: 1.10) */ RXYX, /** * Defines a relative rotation along the Y, Z, and X axes (Since: 1.10) */ RYZX, /** * Defines a relative rotation along the X, Z, and X axes (Since: 1.10) */ RXZX, /** * Defines a relative rotation along the X, Z, and Y axes (Since: 1.10) */ RXZY, /** * Defines a relative rotation along the Y, Z, and Y axes (Since: 1.10) */ RYZY, /** * Defines a relative rotation along the Z, X, and Y axes (Since: 1.10) */ RZXY, /** * Defines a relative rotation along the Y, X, and Y axes (Since: 1.10) */ RYXY, /** * Defines a relative rotation along the Y, X, and Z axes (Since: 1.10) */ RYXZ, /** * Defines a relative rotation along the Z, X, and Z axes (Since: 1.10) */ RZXZ, /** * Defines a relative rotation along the X, Y, and Z axes (Since: 1.10) */ RXYZ, /** * Defines a relative rotation along the Z, Y, and Z axes (Since: 1.10) */ RZYZ, } /** * The type of intersection. */ enum RayIntersectionKind { /** * No intersection */ NONE, /** * The ray is entering the intersected * object */ ENTER, /** * The ray is leaving the intersected * object */ LEAVE, } const PI: number; const PI_2: number; /** * Evaluates to the number of components of a #graphene_vec2_t. * * This symbol is useful when declaring a C array of floating * point values to be used with graphene_vec2_init_from_float() and * graphene_vec2_to_float(), e.g. * * |[ * float v[GRAPHENE_VEC2_LEN]; * * // vec is defined elsewhere * graphene_vec2_to_float (&vec, v); * * for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) * fprintf (stdout, "component %d: %g\n", i, v[i]); * ``` * */ const VEC2_LEN: number; /** * Evaluates to the number of components of a #graphene_vec3_t. * * This symbol is useful when declaring a C array of floating * point values to be used with graphene_vec3_init_from_float() and * graphene_vec3_to_float(), e.g. * * |[ * float v[GRAPHENE_VEC3_LEN]; * * // vec is defined elsewhere * graphene_vec3_to_float (&vec, v); * * for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) * fprintf (stdout, "component %d: %g\n", i, v[i]); * ``` * */ const VEC3_LEN: number; /** * Evaluates to the number of components of a #graphene_vec4_t. * * This symbol is useful when declaring a C array of floating * point values to be used with graphene_vec4_init_from_float() and * graphene_vec4_to_float(), e.g. * * |[ * float v[GRAPHENE_VEC4_LEN]; * * // vec is defined elsewhere * graphene_vec4_to_float (&vec, v); * * for (int i = 0; i < GRAPHENE_VEC4_LEN; i++) * fprintf (stdout, "component %d: %g\n", i, v[i]); * ``` * */ const VEC4_LEN: number; /** * A degenerate #graphene_box_t that can only be expanded. * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ function box_empty(): Box; /** * A degenerate #graphene_box_t that cannot be expanded. * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ function box_infinite(): Box; /** * A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the * maximum vertex set at (0, 0, 0). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ function box_minus_one(): Box; /** * A #graphene_box_t with the minimum vertex set at (0, 0, 0) and the * maximum vertex set at (1, 1, 1). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ function box_one(): Box; /** * A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the * maximum vertex set at (1, 1, 1). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ function box_one_minus_one(): Box; /** * A #graphene_box_t with both the minimum and maximum vertices set at (0, 0, 0). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ function box_zero(): Box; /** * Retrieves a constant point with all three coordinates set to 0. * @returns a zero point */ function point3d_zero(): Point3D; /** * Returns a point fixed at (0, 0). * @returns a fixed point */ function point_zero(): Point; /** * Allocates a new #graphene_rect_t. * * The contents of the returned rectangle are undefined. * @returns the newly allocated rectangle */ function rect_alloc(): Rect; /** * Returns a degenerate rectangle with origin fixed at (0, 0) and * a size of 0, 0. * @returns a fixed rectangle */ function rect_zero(): Rect; /** * A constant pointer to a zero #graphene_size_t, useful for * equality checks and interpolations. * @returns a constant size */ function size_zero(): Size; /** * Retrieves a constant vector with (1, 1) components. * @returns the one vector */ function vec2_one(): Vec2; /** * Retrieves a constant vector with (1, 0) components. * @returns the X axis vector */ function vec2_x_axis(): Vec2; /** * Retrieves a constant vector with (0, 1) components. * @returns the Y axis vector */ function vec2_y_axis(): Vec2; /** * Retrieves a constant vector with (0, 0) components. * @returns the zero vector */ function vec2_zero(): Vec2; /** * Provides a constant pointer to a vector with three components, * all sets to 1. * @returns a constant vector */ function vec3_one(): Vec3; /** * Provides a constant pointer to a vector with three components * with values set to (1, 0, 0). * @returns a constant vector */ function vec3_x_axis(): Vec3; /** * Provides a constant pointer to a vector with three components * with values set to (0, 1, 0). * @returns a constant vector */ function vec3_y_axis(): Vec3; /** * Provides a constant pointer to a vector with three components * with values set to (0, 0, 1). * @returns a constant vector */ function vec3_z_axis(): Vec3; /** * Provides a constant pointer to a vector with three components, * all sets to 0. * @returns a constant vector */ function vec3_zero(): Vec3; /** * Retrieves a pointer to a #graphene_vec4_t with all its * components set to 1. * @returns a constant vector */ function vec4_one(): Vec4; /** * Retrieves a pointer to a #graphene_vec4_t with its * components set to (0, 0, 0, 1). * @returns a constant vector */ function vec4_w_axis(): Vec4; /** * Retrieves a pointer to a #graphene_vec4_t with its * components set to (1, 0, 0, 0). * @returns a constant vector */ function vec4_x_axis(): Vec4; /** * Retrieves a pointer to a #graphene_vec4_t with its * components set to (0, 1, 0, 0). * @returns a constant vector */ function vec4_y_axis(): Vec4; /** * Retrieves a pointer to a #graphene_vec4_t with its * components set to (0, 0, 1, 0). * @returns a constant vector */ function vec4_z_axis(): Vec4; /** * Retrieves a pointer to a #graphene_vec4_t with all its * components set to 0. * @returns a constant vector */ function vec4_zero(): Vec4; interface Box { // Owm methods of Graphene-1.0.Graphene.Box /** * Checks whether the #graphene_box_t `a` contains the given * #graphene_box_t `b`. * @param b a #graphene_box_t * @returns `true` if the box is contained in the given box */ contains_box(b: Box): boolean; /** * Checks whether `box` contains the given `point`. * @param point the coordinates to check * @returns `true` if the point is contained in the given box */ contains_point(point: Point3D): boolean; /** * Checks whether the two given boxes are equal. * @param b a #graphene_box_t * @returns `true` if the boxes are equal */ equal(b: Box): boolean; /** * Expands the dimensions of `box` to include the coordinates at `point`. * @param point the coordinates of the point to include */ expand(point: Point3D): /* res */ Box; /** * Expands the dimensions of `box` by the given `scalar` value. * * If `scalar` is positive, the #graphene_box_t will grow; if `scalar` is * negative, the #graphene_box_t will shrink. * @param scalar a scalar value */ expand_scalar(scalar: number): /* res */ Box; /** * Expands the dimensions of `box` to include the coordinates of the * given vector. * @param vec the coordinates of the point to include, as a #graphene_vec3_t */ expand_vec3(vec: Vec3): /* res */ Box; /** * Frees the resources allocated by graphene_box_alloc(). */ free(): void; /** * Computes the bounding #graphene_sphere_t capable of containing the given * #graphene_box_t. */ get_bounding_sphere(): /* sphere */ Sphere; /** * Retrieves the coordinates of the center of a #graphene_box_t. */ get_center(): /* center */ Point3D; /** * Retrieves the size of the `box` on the Z axis. * @returns the depth of the box */ get_depth(): number; /** * Retrieves the size of the `box` on the Y axis. * @returns the height of the box */ get_height(): number; /** * Retrieves the coordinates of the maximum point of the given * #graphene_box_t. */ get_max(): /* max */ Point3D; /** * Retrieves the coordinates of the minimum point of the given * #graphene_box_t. */ get_min(): /* min */ Point3D; /** * Retrieves the size of the box on all three axes, and stores * it into the given `size` vector. */ get_size(): /* size */ Vec3; /** * Computes the vertices of the given #graphene_box_t. */ get_vertices(): /* vertices */ Vec3[]; /** * Retrieves the size of the `box` on the X axis. * @returns the width of the box */ get_width(): number; /** * Initializes the given #graphene_box_t with two vertices. * @param min the coordinates of the minimum vertex * @param max the coordinates of the maximum vertex * @returns the initialized #graphene_box_t */ init(min: Point3D | null, max: Point3D | null): Box; /** * Initializes the given #graphene_box_t with the vertices of * another #graphene_box_t. * @param src a #graphene_box_t * @returns the initialized #graphene_box_t */ init_from_box(src: Box): Box; /** * Initializes the given #graphene_box_t with the given array * of vertices. * * If `n_points` is 0, the returned box is initialized with * graphene_box_empty(). * @param points an array of #graphene_point3d_t * @returns the initialized #graphene_box_t */ init_from_points(points: Point3D[]): Box; /** * Initializes the given #graphene_box_t with two vertices * stored inside #graphene_vec3_t. * @param min the coordinates of the minimum vertex * @param max the coordinates of the maximum vertex * @returns the initialized #graphene_box_t */ init_from_vec3(min: Vec3 | null, max: Vec3 | null): Box; /** * Initializes the given #graphene_box_t with the given array * of vertices. * * If `n_vectors` is 0, the returned box is initialized with * graphene_box_empty(). * @param vectors an array of #graphene_vec3_t * @returns the initialized #graphene_box_t */ init_from_vectors(vectors: Vec3[]): Box; /** * Intersects the two given #graphene_box_t. * * If the two boxes do not intersect, `res` will contain a degenerate box * initialized with graphene_box_empty(). * @param b a #graphene_box_t * @returns true if the two boxes intersect */ intersection(b: Box): [/* returnType */ boolean, /* res */ Box]; /** * Unions the two given #graphene_box_t. * @param b the box to union to `a` */ union(b: Box): /* res */ Box; } /** * A 3D box, described as the volume between a minimum and * a maximum vertices. * @record */ class Box { // Own properties of Graphene-1.0.Graphene.Box static name: string; // Constructors of Graphene-1.0.Graphene.Box /** * Allocates a new #graphene_box_t. * * The contents of the returned structure are undefined. * @constructor * @returns the newly allocated #graphene_box_t structure. Use graphene_box_free() to free the resources allocated by this function */ static alloc(): Box; /** * A degenerate #graphene_box_t that can only be expanded. * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ static empty(): Box; /** * A degenerate #graphene_box_t that cannot be expanded. * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ static infinite(): Box; /** * A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the * maximum vertex set at (0, 0, 0). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ static minus_one(): Box; /** * A #graphene_box_t with the minimum vertex set at (0, 0, 0) and the * maximum vertex set at (1, 1, 1). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ static one(): Box; /** * A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the * maximum vertex set at (1, 1, 1). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ static one_minus_one(): Box; /** * A #graphene_box_t with both the minimum and maximum vertices set at (0, 0, 0). * * The returned value is owned by Graphene and should not be modified or freed. * @returns a #graphene_box_t */ static zero(): Box; } interface Euler { // Owm methods of Graphene-1.0.Graphene.Euler /** * Checks if two #graphene_euler_t are equal. * @param b a #graphene_euler_t * @returns `true` if the two #graphene_euler_t are equal */ equal(b: Euler): boolean; /** * Frees the resources allocated by graphene_euler_alloc(). */ free(): void; /** * Retrieves the first component of the Euler angle vector, * depending on the order of rotation. * * See also: graphene_euler_get_x() * @returns the first component of the Euler angle vector, in radians */ get_alpha(): number; /** * Retrieves the second component of the Euler angle vector, * depending on the order of rotation. * * See also: graphene_euler_get_y() * @returns the second component of the Euler angle vector, in radians */ get_beta(): number; /** * Retrieves the third component of the Euler angle vector, * depending on the order of rotation. * * See also: graphene_euler_get_z() * @returns the third component of the Euler angle vector, in radians */ get_gamma(): number; /** * Retrieves the order used to apply the rotations described in the * #graphene_euler_t structure, when converting to and from other * structures, like #graphene_quaternion_t and #graphene_matrix_t. * * This function does not return the %GRAPHENE_EULER_ORDER_DEFAULT * enumeration value; it will return the effective order of rotation * instead. * @returns the order used to apply the rotations */ get_order(): EulerOrder; /** * Retrieves the rotation angle on the X axis, in degrees. * @returns the rotation angle */ get_x(): number; /** * Retrieves the rotation angle on the Y axis, in degrees. * @returns the rotation angle */ get_y(): number; /** * Retrieves the rotation angle on the Z axis, in degrees. * @returns the rotation angle */ get_z(): number; /** * Initializes a #graphene_euler_t using the given angles. * * The order of the rotations is %GRAPHENE_EULER_ORDER_DEFAULT. * @param x rotation angle on the X axis, in degrees * @param y rotation angle on the Y axis, in degrees * @param z rotation angle on the Z axis, in degrees * @returns the initialized #graphene_euler_t */ init(x: number, y: number, z: number): Euler; /** * Initializes a #graphene_euler_t using the angles and order of * another #graphene_euler_t. * * If the #graphene_euler_t `src` is %NULL, this function is equivalent * to calling graphene_euler_init() with all angles set to 0. * @param src a #graphene_euler_t * @returns the initialized #graphene_euler_t */ init_from_euler(src: Euler | null): Euler; /** * Initializes a #graphene_euler_t using the given rotation matrix. * * If the #graphene_matrix_t `m` is %NULL, the #graphene_euler_t will * be initialized with all angles set to 0. * @param m a rotation matrix * @param order the order used to apply the rotations * @returns the initialized #graphene_euler_t */ init_from_matrix(m: Matrix | null, order: EulerOrder): Euler; /** * Initializes a #graphene_euler_t using the given normalized quaternion. * * If the #graphene_quaternion_t `q` is %NULL, the #graphene_euler_t will * be initialized with all angles set to 0. * @param q a normalized #graphene_quaternion_t * @param order the order used to apply the rotations * @returns the initialized #graphene_euler_t */ init_from_quaternion(q: Quaternion | null, order: EulerOrder): Euler; /** * Initializes a #graphene_euler_t using the given angles * and order of rotation. * @param x rotation angle on the X axis, in radians * @param y rotation angle on the Y axis, in radians * @param z rotation angle on the Z axis, in radians * @param order order of rotations * @returns the initialized #graphene_euler_t */ init_from_radians( x: number, y: number, z: number, order: EulerOrder ): Euler; /** * Initializes a #graphene_euler_t using the angles contained in a * #graphene_vec3_t. * * If the #graphene_vec3_t `v` is %NULL, the #graphene_euler_t will be * initialized with all angles set to 0. * @param v a #graphene_vec3_t containing the rotation angles in degrees * @param order the order used to apply the rotations * @returns the initialized #graphene_euler_t */ init_from_vec3(v: Vec3 | null, order: EulerOrder): Euler; /** * Initializes a #graphene_euler_t with the given angles and `order`. * @param x rotation angle on the X axis, in degrees * @param y rotation angle on the Y axis, in degrees * @param z rotation angle on the Z axis, in degrees * @param order the order used to apply the rotations * @returns the initialized #graphene_euler_t */ init_with_order(x: number, y: number, z: number, order: EulerOrder): Euler; /** * Reorders a #graphene_euler_t using `order`. * * This function is equivalent to creating a #graphene_quaternion_t from the * given #graphene_euler_t, and then converting the quaternion into another * #graphene_euler_t. * @param order the new order */ reorder(order: EulerOrder): /* res */ Euler; /** * Converts a #graphene_euler_t into a transformation matrix expressing * the extrinsic composition of rotations described by the Euler angles. * * The rotations are applied over the reference frame axes in the order * associated with the #graphene_euler_t; for instance, if the order * used to initialize `e` is %GRAPHENE_EULER_ORDER_XYZ: * * * the first rotation moves the body around the X axis with * an angle φ * * the second rotation moves the body around the Y axis with * an angle of ϑ * * the third rotation moves the body around the Z axis with * an angle of ψ * * The rotation sign convention is right-handed, to preserve compatibility * between Euler-based, quaternion-based, and angle-axis-based rotations. */ to_matrix(): /* res */ Matrix; /** * Converts a #graphene_euler_t into a #graphene_quaternion_t. */ to_quaternion(): /* res */ Quaternion; /** * Retrieves the angles of a #graphene_euler_t and initializes a * #graphene_vec3_t with them. */ to_vec3(): /* res */ Vec3; } /** * Describe a rotation using Euler angles. * * The contents of the #graphene_euler_t structure are private * and should never be accessed directly. * @record */ class Euler { // Own properties of Graphene-1.0.Graphene.Euler static name: string; // Constructors of Graphene-1.0.Graphene.Euler /** * Allocates a new #graphene_euler_t. * * The contents of the returned structure are undefined. * @constructor * @returns the newly allocated #graphene_euler_t */ static alloc(): Euler; } interface Frustum { // Owm methods of Graphene-1.0.Graphene.Frustum /** * Checks whether a point is inside the volume defined by the given * #graphene_frustum_t. * @param point a #graphene_point3d_t * @returns `true` if the point is inside the frustum */ contains_point(point: Point3D): boolean; /** * Checks whether the two given #graphene_frustum_t are equal. * @param b a #graphene_frustum_t * @returns `true` if the given frustums are equal */ equal(b: Frustum): boolean; /** * Frees the resources allocated by graphene_frustum_alloc(). */ free(): void; /** * Retrieves the planes that define the given #graphene_frustum_t. */ get_planes(): /* planes */ Plane[]; /** * Initializes the given #graphene_frustum_t using the provided * clipping planes. * @param p0 a clipping plane * @param p1 a clipping plane * @param p2 a clipping plane * @param p3 a clipping plane * @param p4 a clipping plane * @param p5 a clipping plane * @returns the initialized frustum */ init( p0: Plane, p1: Plane, p2: Plane, p3: Plane, p4: Plane, p5: Plane ): Frustum; /** * Initializes the given #graphene_frustum_t using the clipping * planes of another #graphene_frustum_t. * @param src a #graphene_frustum_t * @returns the initialized frustum */ init_from_frustum(src: Frustum): Frustum; /** * Initializes a #graphene_frustum_t using the given `matrix`. * @param matrix a #graphene_matrix_t * @returns the initialized frustum */ init_from_matrix(matrix: Matrix): Frustum; /** * Checks whether the given `box` intersects a plane of * a #graphene_frustum_t. * @param box a #graphene_box_t * @returns `true` if the box intersects the frustum */ intersects_box(box: Box): boolean; /** * Checks whether the given `sphere` intersects a plane of * a #graphene_frustum_t. * @param sphere a #graphene_sphere_t * @returns `true` if the sphere intersects the frustum */ intersects_sphere(sphere: Sphere): boolean; } /** * A 3D volume delimited by 2D clip planes. * * The contents of the `graphene_frustum_t` are private, and should not be * modified directly. * @record */ class Frustum { // Own properties of Graphene-1.0.Graphene.Frustum static name: string; // Constructors of Graphene-1.0.Graphene.Frustum /** * Allocates a new #graphene_frustum_t structure. * * The contents of the returned structure are undefined. * @constructor * @returns the newly allocated #graphene_frustum_t structure. Use graphene_frustum_free() to free the resources allocated by this function. */ static alloc(): Frustum; } interface Matrix { // Owm methods of Graphene-1.0.Graphene.Matrix /** * Decomposes a transformation matrix into its component transformations. * * The algorithm for decomposing a matrix is taken from the * [CSS3 Transforms specification](http://dev.w3.org/csswg/css-transforms/); * specifically, the decomposition code is based on the equivalent code * published in "Graphics Gems II", edited by Jim Arvo, and * [available online](http://web.archive.org/web/20150512160205/http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c). * @returns `true` if the matrix could be decomposed */ decompose(): [ /* returnType */ boolean, /* translate */ Vec3, /* scale */ Vec3, /* rotate */ Quaternion, /* shear */ Vec3, /* perspective */ Vec4 ]; /** * Computes the determinant of the given matrix. * @returns the value of the determinant */ determinant(): number; /** * Checks whether the two given #graphene_matrix_t matrices are equal. * @param b a #graphene_matrix_t * @returns `true` if the two matrices are equal, and `false` otherwise */ equal(b: Matrix): boolean; /** * Checks whether the two given #graphene_matrix_t matrices are * byte-by-byte equal. * * While this function is faster than graphene_matrix_equal(), it * can also return false negatives, so it should be used in * conjuction with either graphene_matrix_equal() or * graphene_matrix_near(). For instance: * * * ```c * if (graphene_matrix_equal_fast (a, b)) * { * // matrices are definitely the same * } * else * { * if (graphene_matrix_equal (a, b)) * // matrices contain the same values within an epsilon of FLT_EPSILON * else if (graphene_matrix_near (a, b, 0.0001)) * // matrices contain the same values within an epsilon of 0.0001 * else * // matrices are not equal * } * ``` * * @param b a #graphene_matrix_t * @returns `true` if the matrices are equal. and `false` otherwise */ equal_fast(b: Matrix): boolean; /** * Frees the resources allocated by graphene_matrix_alloc(). */ free(): void; /** * Retrieves the given row vector at `index_` inside a matrix. * @param index_ the index of the row vector, between 0 and 3 */ get_row(index_: number): /* res */ Vec4; /** * Retrieves the value at the given `row` and `col` index. * @param row the row index * @param col the column index * @returns the value at the given indices */ get_value(row: number, col: number): number; /** * Retrieves the scaling factor on the X axis in `m`. * @returns the value of the scaling factor */ get_x_scale(): number; /** * Retrieves the translation component on the X axis from `m`. * @returns the translation component */ get_x_translation(): number; /** * Retrieves the scaling factor on the Y axis in `m`. * @returns the value of the scaling factor */ get_y_scale(): number; /** * Retrieves the translation component on the Y axis from `m`. * @returns the translation component */ get_y_translation(): number; /** * Retrieves the scaling factor on the Z axis in `m`. * @returns the value of the scaling factor */ get_z_scale(): number; /** * Retrieves the translation component on the Z axis from `m`. * @returns the translation component */ get_z_translation(): number; /** * Initializes a #graphene_matrix_t from the values of an affine * transformation matrix. * * The arguments map to the following matrix layout: * * |[<!-- language="plain" --> * ⎛ xx yx ⎞ ⎛ a b 0 ⎞ * ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ * ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠ * ``` * * * This function can be used to convert between an affine matrix type * from other libraries and a #graphene_matrix_t. * @param xx the xx member * @param yx the yx member * @param xy the xy member * @param yy the yy member * @param x_0 the x0 member * @param y_0 the y0 member * @returns the initialized matrix */ init_from_2d( xx: number, yx: number, xy: number, yy: number, x_0: number, y_0: number ): Matrix; /** * Initializes a #graphene_matrix_t with the given array of floating * point values. * @param v an array of at least 16 floating point values * @returns the initialized matrix */ init_from_float(v: number[]): Matrix; /** * Initializes a #graphene_matrix_t using the values of the * given matrix. * @param src a #graphene_matrix_t * @returns the initialized matrix */ init_from_matrix(src: Matrix): Matrix; /** * Initializes a #graphene_matrix_t with the given four row * vectors. * @param v0 the first row vector * @param v1 the second row vector * @param v2 the third row vector * @param v3 the fourth row vector * @returns the initialized matrix */ init_from_vec4(v0: Vec4, v1: Vec4, v2: Vec4, v3: Vec4): Matrix; /** * Initializes a #graphene_matrix_t compatible with #graphene_frustum_t. * * See also: graphene_frustum_init_from_matrix() * @param left distance of the left clipping plane * @param right distance of the right clipping plane * @param bottom distance of the bottom clipping plane * @param top distance of the top clipping plane * @param z_near distance of the near clipping plane * @param z_far distance of the far clipping plane * @returns the initialized matrix */ init_frustum( left: number, right: number, bottom: number, top: number, z_near: number, z_far: number ): Matrix; /** * Initializes a #graphene_matrix_t with the identity matrix. * @returns the initialized matrix */ init_identity(): Matrix; /** * Initializes a #graphene_matrix_t so that it positions the "camera" * at the given `eye` coordinates towards an object at the `center` * coordinates. The top of the camera is aligned to the direction * of the `up` vector. * * Before the transform, the camera is assumed to be placed at the * origin, looking towards the negative Z axis, with the top side of * the camera facing in the direction of the Y axis and the right * side in the direction of the X axis. * * In theory, one could use `m` to transform a model of such a camera * into world-space. However, it is more common to use the inverse of * `m` to transform another object from world coordinates to the view * coordinates of the camera. Typically you would then apply the * camera projection transform to get from view to screen * coordinates. * @param eye the vector describing the position to look from * @param center the vector describing the position to look at * @param up the vector describing the world's upward direction; usually, this is the graphene_vec3_y_axis() vector * @returns the initialized matrix */ init_look_at(eye: Vec3, center: Vec3, up: Vec3): Matrix; /** * Initializes a #graphene_matrix_t with an orthographic projection. * @param left the left edge of the clipping plane * @param right the right edge of the clipping plane * @param top the top edge of the clipping plane * @param bottom the bottom edge of the clipping plane * @param z_near the distance of the near clipping plane * @param z_far the distance of the far clipping plane * @returns the initialized matrix */ init_ortho( left: number, right: number, top: number, bottom: number, z_near: number, z_far: number ): Matrix; /** * Initializes a #graphene_matrix_t with a perspective projection. * @param fovy the field of view angle, in degrees * @param aspect the aspect value * @param z_near the near Z plane * @param z_far the far Z plane * @returns the initialized matrix */ init_perspective( fovy: number, aspect: number, z_near: number, z_far: number ): Matrix; /** * Initializes `m` to represent a rotation of `angle` degrees on * the axis represented by the `axis` vector. * @param angle the rotation angle, in degrees * @param axis the axis vector as a #graphene_vec3_t * @returns the initialized matrix */ init_rotate(angle: number, axis: Vec3): Matrix; /** * Initializes a #graphene_matrix_t with the given scaling factors. * @param x the scale factor on the X axis * @param y the scale factor on the Y axis * @param z the scale factor on the Z axis * @returns the initialized matrix */ init_scale(x: number, y: number, z: number): Matrix; /** * Initializes a #graphene_matrix_t with a skew transformation * with the given factors. * @param x_skew skew factor, in radians, on the X axis * @param y_skew skew factor, in radians, on the Y axis * @returns the initialized matrix */ init_skew(x_skew: number, y_skew: number): Matrix; /** * Initializes a #graphene_matrix_t with a translation to the * given coordinates. * @param p the translation coordinates * @returns the initialized matrix */ init_translate(p: Point3D): Matrix; /** * Linearly interpolates the two given #graphene_matrix_t by * interpolating the decomposed transformations separately. * * If either matrix cannot be reduced to their transformations * then the interpolation cannot be performed, and this function * will return an identity matrix. * @param b a #graphene_matrix_t * @param factor the linear interpolation factor */ interpolate(b: Matrix, factor: number): /* res */ Matrix; /** * Inverts the given matrix. * @returns `true` if the matrix is invertible */ inverse(): [/* returnType */ boolean, /* res */ Matrix]; /** * Checks whether the given #graphene_matrix_t is compatible with an * a 2D affine transformation matrix. * @returns `true` if the matrix is compatible with an affine transformation matrix */ is_2d(): boolean; /** * Checks whether a #graphene_matrix_t has a visible back face. * @returns `true` if the back face of the matrix is visible */ is_backface_visible(): boolean; /** * Checks whether the given #graphene_matrix_t is the identity matrix. * @returns `true` if the matrix is the identity matrix */ is_identity(): boolean; /** * Checks whether a matrix is singular. * @returns `true` if the matrix is singular */ is_singular(): boolean; /** * Multiplies two #graphene_matrix_t. * * Matrix multiplication is not commutative in general; the order of the factors matters. * The product of this multiplication is (`a` × `b)` * @param b a #graphene_matrix_t */ multiply(b: Matrix): /* res */ Matrix; /** * Compares the two given #graphene_matrix_t matrices and checks * whether their values are within the given `epsilon` of each * other. * @param b a #graphene_matrix_t * @param epsilon the threshold between the two matrices * @returns `true` if the two matrices are near each other, and `false` otherwise */ near(b: Matrix, epsilon: number): boolean; /** * Normalizes the given #graphene_matrix_t. */ normalize(): /* res */ Matrix; /** * Applies a perspective of `depth` to the matrix. * @param depth the depth of the perspective */ perspective(depth: number): /* res */ Matrix; /** * Prints the contents of a matrix to the standard error stream. * * This function is only useful for debugging; there are no guarantees * made on the format of the output. */ print(): void; /** * Projects a #graphene_point_t using the matrix `m`. * @param p a #graphene_point_t */ project_point(p: Point): /* res */ Point; /** * Projects all corners of a #graphene_rect_t using the given matrix. * * See also: graphene_matrix_project_point() * @param r a #graphene_rect_t */ project_rect(r: Rect): /* res */ Quad; /** * Projects a #graphene_rect_t using the given matrix. * * The resulting rectangle is the axis aligned bounding rectangle capable * of fully containing the projected rectangle. * @param r a #graphene_rect_t */ project_rect_bounds(r: Rect): /* res */ Rect; /** * Adds a rotation transformation to `m,` using the given `angle` * and `axis` vector. * * This is the equivalent of calling graphene_matrix_init_rotate() and * then multiplying the matrix `m` with the rotation matrix. * @param angle the rotation angle, in degrees * @param axis the rotation axis, as a #graphene_vec3_t */ rotate(angle: number, axis: Vec3): void; /** * Adds a rotation transformation to `m,` using the given * #graphene_euler_t. * @param e a rotation described by a #graphene_euler_t */ rotate_euler(e: Euler): void; /** * Adds a rotation transformation to `m,` using the given * #graphene_quaternion_t. * * This is the equivalent of calling graphene_quaternion_to_matrix() and * then multiplying `m` with the rotation matrix. * @param q a rotation described by a #graphene_quaternion_t */ rotate_quaternion(q: Quaternion): void; /** * Adds a rotation transformation around the X axis to `m,` using * the given `angle`. * * See also: graphene_matrix_rotate() * @param angle the rotation angle, in degrees */ rotate_x(angle: number): void; /** * Adds a rotation transformation around the Y axis to `m,` using * the given `angle`. * * See also: graphene_matrix_rotate() * @param angle the rotation angle, in degrees */ rotate_y(angle: number): void; /** * Adds a rotation transformation around the Z axis to `m,` using * the given `angle`. * * See also: graphene_matrix_rotate() * @param angle the rotation angle, in degrees */ rotate_z(angle: number): void; /** * Adds a scaling transformation to `m,` using the three * given factors. * * This is the equivalent of calling graphene_matrix_init_scale() and then * multiplying the matrix `m` with the scale matrix. * @param factor_x scaling factor on the X axis * @param factor_y scaling factor on the Y axis * @param factor_z scaling factor on the Z axis */ scale(factor_x: number, factor_y: number, factor_z: number): void; /** * Adds a skew of `factor` on the X and Y axis to the given matrix. * @param factor skew factor */ skew_xy(factor: number): void; /** * Adds a skew of `factor` on the X and Z axis to the given matrix. * @param factor skew factor */ skew_xz(factor: number): void; /** * Adds a skew of `factor` on the Y and Z axis to the given matrix. * @param factor skew factor */ skew_yz(factor: number): void; /** * Converts a #graphene_matrix_t to an affine transformation * matrix, if the given matrix is compatible. * * The returned values have the following layout: * * |[<!-- language="plain" --> * ⎛ xx yx ⎞ ⎛ a b 0 ⎞ * ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ * ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠ * ``` * * * This function can be used to convert between a #graphene_matrix_t * and an affine matrix type from other libraries. * @returns `true` if the matrix is compatible with an affine transformation matrix */ to_2d(): [ /* returnType */ boolean, /* xx */ number, /* yx */ number, /* xy */ number, /* yy */ number, /* x_0 */ number, /* y_0 */ number ]; /** * Converts a #graphene_matrix_t to an array of floating point * values. */ to_float(): /* v */ number[]; /** * Transforms each corner of a #graphene_rect_t using the given matrix `m`. * * The result is the axis aligned bounding rectangle containing the coplanar * quadrilateral. * * See also: graphene_matrix_transform_point() * @param r a #graphene_rect_t */ transform_bounds(r: Rect): /* res */ Rect; /** * Transforms the vertices of a #graphene_box_t using the given matrix `m`. * * The result is the axis aligned bounding box containing the transformed * vertices. * @param b a #graphene_box_t */ transform_box(b: Box): /* res */ Box; /** * Transforms the given #graphene_point_t using the matrix `m`. * * Unlike graphene_matrix_transform_vec3(), this function will take into * account the fourth row vector of the #graphene_matrix_t when computing * the dot product of each row vector of the matrix. * * See also: graphene_simd4x4f_point3_mul() * @param p a #graphene_point_t */ transform_point(p: Point): /* res */ Point; /** * Transforms the given #graphene_point3d_t using the matrix `m`. * * Unlike graphene_matrix_transform_vec3(), this function will take into * account the fourth row vector of the #graphene_matrix_t when computing * the dot product of each row vector of the matrix. * * See also: graphene_simd4x4f_point3_mul() * @param p a #graphene_point3d_t */ transform_point3d(p: Point3D): /* res */ Point3D; /** * Transform a #graphene_ray_t using the given matrix `m`. * @param r a #graphene_ray_t */ transform_ray(r: Ray): /* res */ Ray; /** * Transforms each corner of a #graphene_rect_t using the given matrix `m`. * * The result is a coplanar quadrilateral. * * See also: graphene_matrix_transform_point() * @param r a #graphene_rect_t */ transform_rect(r: Rect): /* res */ Quad; /** * Transforms a #graphene_sphere_t using the given matrix `m`. The * result is the bounding sphere containing the transformed sphere. * @param s a #graphene_sphere_t */ transform_sphere(s: Sphere): /* res */ Sphere; /** * Transforms the given #graphene_vec3_t using the matrix `m`. * * This function will multiply the X, Y, and Z row vectors of the matrix `m` * with the corresponding components of the vector `v`. The W row vector will * be ignored. * * See also: graphene_simd4x4f_vec3_mul() * @param v a #graphene_vec3_t */ transform_vec3(v: Vec3): /* res */ Vec3; /** * Transforms the given #graphene_vec4_t using the matrix `m`. * * See also: graphene_simd4x4f_vec4_mul() * @param v a #graphene_vec4_t */ transform_vec4(v: Vec4): /* res */ Vec4; /** * Adds a translation transformation to `m` using the coordinates * of the given #graphene_point3d_t. * * This is the equivalent of calling graphene_matrix_init_translate() and * then multiplying `m` with the translation matrix. * @param pos a #graphene_point3d_t */ translate(pos: Point3D): void; /** * Transposes the given matrix. */ transpose(): /* res */ Matrix; /** * Unprojects the given `point` using the `projection` matrix and * a `modelview` matrix. * @param modelview a #graphene_matrix_t for the modelview matrix; this is the inverse of the modelview used when projecting the point * @param point a #graphene_point3d_t with the coordinates of the point */ unproject_point3d(modelview: Matrix, point: Point3D): /* res */ Point3D; /** * Undoes the transformation on the corners of a #graphene_rect_t using the * given matrix, within the given axis aligned rectangular `bounds`. * @param r a #graphene_rect_t * @param bounds the bounds of the transformation */ untransform_bounds(r: Rect, bounds: Rect): /* res */ Rect; /** * Undoes the transformation of a #graphene_point_t using the * given matrix, within the given axis aligned rectangular `bounds`. * @param p a #graphene_point_t * @param bounds the bounds of the transformation * @returns `true` if the point was successfully untransformed */ untransform_point( p: Point, bounds: Rect ): [/* returnType */ boolean, /* res */ Point]; } /** * A structure capable of holding a 4x4 matrix. * * The contents of the #graphene_matrix_t structure are private and * should never be accessed directly. * @record */ class Matrix { // Own properties of Graphene-1.0.Graphene.Matrix static name: string; // Constructors of Graphene-1.0.Graphene.Matrix /** * Allocates a new #graphene_matrix_t. * @constructor * @returns the newly allocated matrix */ static alloc(): Matrix; } interface Plane { // Owm methods of Graphene-1.0.Graphene.Plane /** * Computes the distance of `point` from a #graphene_plane_t. * @param point a #graphene_point3d_t * @returns the distance of the given #graphene_point3d_t from the plane */ distance(point: Point3D): number; /** * Checks whether the two given #graphene_plane_t are equal. * @param b a #graphene_plane_t * @returns `true` if the given planes are equal */ equal(b: Plane): boolean; /** * Frees the resources allocated by graphene_plane_alloc(). */ free(): void; /** * Retrieves the distance along the normal vector of the * given #graphene_plane_t from the origin. * @returns the constant value