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.
73 lines • 2.9 kB
TypeScript
import { Vector4, Vector4Tuple } from 'three';
import { AViewerPluginSync, ThreeViewer } from '../../viewer';
import { IMaterial, IMaterialUserData } from '../../core';
import { MaterialExtension } from '../../materials';
import { GLTFWriter2 } from '../../assetmanager';
import type { GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
/**
* FragmentClipping Materials Extension
* Adds a material extension to PhysicalMaterial to add support for fragment clipping.
* Fragment clipping allows to clip fragments of the material in screen space or world space based on a circle, rectangle, plane, sphere, etc.
* It uses fixed SDFs with params defined by the user for clipping.
* It also adds a UI to the material to edit the settings.
* It uses `WEBGI_materials_fragment_clipping_extension` glTF extension to save the settings in glTF files.
* @category Plugins
*/
export declare class FragmentClippingExtensionPlugin extends AViewerPluginSync {
static readonly PluginType = "FragmentClippingExtensionPlugin1";
enabled: boolean;
private _defines;
private _uniforms;
static AddFragmentClipping(material: IMaterial, params?: IMaterialUserData['_fragmentClippingExt']): boolean;
private _plane;
private _viewNormalMatrix;
private _v4;
readonly materialExtension: MaterialExtension;
setDirty: () => void;
constructor();
onAdded(v: ThreeViewer): void;
onRemove(v: ThreeViewer): void;
/**
* @deprecated use - use {@link fragmentClippingGLTFExtension}
*/
static readonly FRAGMENT_CLIPPING_EXTENSION_GLTF_EXTENSION = "WEBGI_materials_fragment_clipping_extension";
}
declare module '../../core/IMaterial' {
interface IMaterialUserData {
_fragmentClippingExt?: {
clipEnabled?: boolean;
clipPosition?: Vector4 | Vector4Tuple;
clipParams?: Vector4 | Vector4Tuple;
clipMode?: FragmentClippingMode;
clipInvert?: boolean;
};
}
}
export declare enum FragmentClippingMode {
Circle = 0,
Ellipse = 1,
Rectangle = 2,
Plane = 3,
Sphere = 4
}
/**
* FragmentClipping Materials Extension
*
* Specification: https://threepipe.org/docs/gltf-extensions/WEBGI_materials_fragment_clipping_extension.html
*/
declare class GLTFMaterialsFragmentClippingExtensionImport implements GLTFLoaderPlugin {
name: string;
parser: GLTFParser;
constructor(parser: GLTFParser);
extendMaterialParams(materialIndex: number, materialParams: any): Promise<void>;
}
export declare const fragmentClippingGLTFExtension: {
name: string;
import: (p: GLTFParser) => GLTFMaterialsFragmentClippingExtensionImport;
export: (w: GLTFWriter2) => {
writeMaterial: (material: any, materialDef: any) => void;
};
textures: undefined;
};
export {};
//# sourceMappingURL=FragmentClippingExtensionPlugin.d.ts.map