threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
58 lines • 2.32 kB
TypeScript
import { AViewerPluginSync, ThreeViewer } from '../../viewer';
import { IMaterial, IObject3D } from '../../core';
import { UiObjectConfig } from 'uiconfig.js';
import { GLTFMaterialsVariantsExtensionImport } from './helpers/GLTFMaterialsVariantsExtensionImport';
import { gltfExporterMaterialsVariantsExtensionExport } from './helpers/GLTFMaterialsVariantsExtensionExport';
/**
* GLTF khr_material_variants plugin
*
* This plugin allows to import and export gltf files with KHR_materials_variants extension.
* The material data is stored in the object userData. The plugin also provides a UI to select the variant.
*
* @category Plugins
*/
export declare class GLTFKHRMaterialVariantsPlugin extends AViewerPluginSync {
static readonly PluginType = "GLTFKHRMaterialVariantsPlugin";
enabled: boolean;
constructor();
onAdded(v: ThreeViewer): void;
onRemove(v: ThreeViewer): void;
variants: Record<string, IObject3D[]>;
/**
* The selected variant. Changing this will automatically apply the variant to the objects.
*/
selectedVariant: string;
/**
* If true, the first variant will be applied to the objects when object is added and nothing is selected.
*/
applyFirstVariantOnLoad: boolean;
private _variantChanged;
/**
* Apply the variant to objects.
* It will also change the `selectedVariant` if `root` is not provided.
* @param name
* @param force
* @param root
* @param doTraverse
*/
applyVariant(name: string, force?: boolean, root?: IObject3D[], doTraverse?: boolean): void;
private _objectAdded;
uiConfig: UiObjectConfig;
}
declare module './../../core/IObject' {
interface IObject3DUserData {
/**
* Starts with `_` so that its not saved in gltf, but saved in json.
*/
_variantMaterials?: Record<string, {
material: IMaterial;
}>;
_originalMaterial?: IObject3D['material'];
}
}
export declare const khrMaterialVariantsGLTFExtension: {
name: string;
import: (p: import('three/examples/jsm/loaders/GLTFLoader.js').GLTFParser) => GLTFMaterialsVariantsExtensionImport;
export: typeof gltfExporterMaterialsVariantsExtensionExport;
};
//# sourceMappingURL=../../src/plugins/extras/GLTFKHRMaterialVariantsPlugin.d.ts.map