gsots3d
Version:
Getting S**t On The Screen in 3D. A library for doing 3D graphics in the browser.
37 lines (34 loc) • 1.18 kB
TypeScript
export { M as MtlMaterial, p as parseMTL } from '../mtl-parser-Cw8gA4Aw.js';
/**
* ParseResult is the result of parsing an OBJ file
*/
type ParseResult = {
/** List of material libs (MTL files) */
matLibNames: string[];
/** List of geometries, each with a material name and vertex data */
geometries: Geometry[];
/** Total number of triangles in the OBJ file */
triangles: number;
};
/**
* Each OBJ file is made up of a list of geometries, each with a material name.
* These can be thought of as parts of the overall model.
*/
type Geometry = {
/** Name of the material for this geometry part */
material: string;
/** Vertex data for this geometry part, ready for turning into an BufferInfo in twgl.js */
data: {
position: number[];
texcoord?: number[];
normal: number[];
tangent?: number[];
};
};
/**
* Parse an OBJ file returning a list of geometries and materials libs
* @param {string} objFile - The OBJ file as a string
* @param {boolean} flipUV - Flip the V texcoord axis, for OpenGL
*/
declare function parseOBJ(objFile: string, flipUV: boolean): ParseResult;
export { parseOBJ };