playcanvas
Version:
PlayCanvas WebGL game engine
73 lines (72 loc) • 2.75 kB
TypeScript
/**
* Implementation of the GLTF 2.0 format exporter.
*
* @category Exporter
*/
export class GltfExporter extends CoreExporter {
static writeBufferView(resources: any, json: any, buffer: any): void;
static createPrimitive(resources: any, json: any, mesh: any, options?: {}): {
attributes: {};
};
/**
* @ignore
*/
collectResources(root: any): {
buffers: any[];
cameras: any[];
entities: any[];
materials: any[];
skins: any[];
textures: any[];
entityMeshInstances: any[];
bufferViewMap: Map<any, any>;
compressableTexture: Set<any>;
};
writeBufferViews(resources: any, json: any): void;
writeCameras(resources: any, json: any): void;
attachTexture(resources: any, material: any, destination: any, name: any, textureSemantic: any, json: any): void;
writeStandardMaterial(resources: any, mat: any, output: any, json: any): void;
writeMaterials(resources: any, json: any): void;
writeNodes(resources: any, json: any): void;
writeMeshes(resources: any, json: any, options: any): void;
writeSkins(resources: any, json: any): void;
convertTextures(srcTextures: any, options: any): any[];
writeTextures(resources: any, textureCanvases: any, json: any, options: any): Promise<any[]>;
getBlob(canvas: any, mimeType: any): any;
getPaddedArrayBuffer(arrayBuffer: any, paddingByte?: number): any;
buildJson(resources: any, options: any): Promise<{
asset: {
version: string;
generator: string;
};
scenes: {
nodes: number[];
}[];
images: any[];
samplers: any[];
textures: any[];
scene: number;
}>;
/**
* Converts a hierarchy of entities to GLB format.
*
* @param {Entity} entity - The root of the entity hierarchy to convert.
* @param {object} options - Object for passing optional arguments.
* @param {number} [options.maxTextureSize] - Maximum texture size. Texture is resized if over the size.
* @param {boolean} [options.stripUnusedAttributes] - If true, removes unused vertex attributes:
*
* - Texture coordinates not referenced by materials
* - Vertex colors if not used by materials
* - Tangents if no normal maps are used
* - Skinning data if no skinned meshes exist
*
* Defaults to false.
* @returns {Promise<ArrayBuffer>} - The GLB file content.
*/
build(entity: Entity, options?: {
maxTextureSize?: number;
stripUnusedAttributes?: boolean;
}): Promise<ArrayBuffer>;
}
import { CoreExporter } from './core-exporter.js';
import type { Entity } from '../../framework/entity.js';