arx-level-generator
Version:
A tool for creating Arx Fatalis maps
65 lines (64 loc) • 2.25 kB
TypeScript
import { ArxPolygonFlags } from 'arx-convert/types';
import { BufferGeometry, Mesh, Vector2 } from 'three';
import { Rotation } from '../../Rotation.js';
import { Texture } from '../../Texture.js';
import { Vector3 } from '../../Vector3.js';
type loadOBJProperties = {
/**
* default value is undefined
*/
position?: Vector3;
/**
* default value is undefined
*/
scale?: number | Vector3;
/**
* default value is undefined
*/
scaleUV?: number | Vector2 | ((texture: Texture) => number | Vector2);
/**
* default value is undefined
*/
orientation?: Rotation;
/**
* default value is (ArxPolygonFlags.DoubleSided | ArxPolygonFlags.Tiled)
* which is also the same as what you will get as the value for defaultFlags when
* you pass a function as the value
*/
materialFlags?: ArxPolygonFlags | ((texture: Texture, defaultFlags: ArxPolygonFlags) => ArxPolygonFlags);
/**
* default value is Texture.missingTexture with the same flags as materialFlags
*/
fallbackTexture?: Texture;
/**
* default value is false
*/
reversedPolygonWinding?: boolean;
/**
* aligns the center of the model to 0/0/0
*
* default value is false
*/
centralize?: boolean;
/**
* Aligns an object's y axis to 0/0/0
*
* - `"bottom"` will make all the points of the model above 0/0/0
* - `"top"` will make all the points of the model below 0/0/0
* - `"center"` keeps the model in the middle
*
* if centralize is true then the default value is 'center'
* otherwise undefined
*/
verticalAlign?: 'bottom' | 'center' | 'top';
};
/**
* Loads an obj file and an optional mtl file
*
* @see https://en.wikipedia.org/wiki/Wavefront_.obj_file
*/
export declare const loadOBJ: (filenameWithoutExtension: string, { position, scale, scaleUV, orientation, materialFlags, fallbackTexture, reversedPolygonWinding, centralize, verticalAlign, }?: loadOBJProperties) => Promise<{
meshes: Mesh<BufferGeometry<import("three").NormalBufferAttributes>, import("three").Material | import("three").Material[], import("three").Object3DEventMap>[];
materials: Texture[];
}>;
export {};