import { AssetError, type Result } from '@forgeax/engine-types'; /** Write a finite unit tangent in the normal plane; leave output unchanged on failure. * Writes xyz only, so the producer retains its own handedness policy. */ export declare function writeNormalPlaneTangent(out: Float32Array, offset: number, nx: number, ny: number, nz: number): boolean; /** * Compute per-vertex tangent (vec4) for a procedural mesh using path A * (UV-derivative + face-area-weighted average + Gram-Schmidt + handedness). * * @param positions Float32Array, vertexCount * 3 (xyz interleaved). * @param normals Float32Array, vertexCount * 3 (xyz interleaved); must be * pre-normalised by the caller (procedural factories already produce * unit-length normals at vertex emit time). * @param uvs Float32Array, vertexCount * 2 (uv interleaved). * @param indices optional Uint16Array | Uint32Array triangle list; when * undefined, sequential triangulation 0,1,2,3,4,5,... is assumed. * @returns `Result` with a Float32Array of * vertexCount * 4 on success. `.xyz` is the tangent and `.w` is the * handedness sign in {+1, -1}; malformed topology returns the existing * `asset-parse-failed` AssetError before working or output buffers exist. * * @remarks * Path A formula (per triangle): * ``` * dP1 = p2 - p1; dP2 = p3 - p1 * dUV1 = uv2 - uv1; dUV2 = uv3 - uv1 * det = dUV1.u * dUV2.v - dUV2.u * dUV1.v * T_face = (dUV2.v * dP1 - dUV1.v * dP2) / det * sign = det >= 0 ? +1 : -1 * ``` * Per-vertex aggregation: accumulate `T_face * faceArea` into the three * vertices of the triangle; accumulate `sign` (the dominant sign per * vertex wins). After accumulation: Gram-Schmidt against the supplied * normal `T' = normalize(T - dot(T, N) * N)`; repack as vec4 with the * dominant handedness sign. */ export declare function computeTangentVec4(positions: Float32Array, normals: Float32Array, uvs: Float32Array, indices?: Uint16Array | Uint32Array): Result; //# sourceMappingURL=tangent.d.ts.map