@react-three/csg
Version:
Constructive solid geometry for React
70 lines (69 loc) • 4.3 kB
TypeScript
import * as React from 'react';
import * as THREE from 'three';
import { Brush as BrushImpl } from 'three-bvh-csg';
declare const TYPES: {
subtraction: import("three-bvh-csg").CSGOperation;
reverseSubtraction: import("three-bvh-csg").CSGOperation;
addition: import("three-bvh-csg").CSGOperation;
difference: import("three-bvh-csg").CSGOperation;
intersection: import("three-bvh-csg").CSGOperation;
};
interface BrushProperties {
operator: keyof typeof TYPES;
showOperation?: boolean;
}
export declare type Brush = BrushImpl & BrushProperties;
declare module 'react' {
namespace JSX {
interface IntrinsicElements {
brush: Omit<React.JSX.IntrinsicElements['mesh'], 'ref'> & Partial<BrushProperties & {
ref?: React.Ref<Brush>;
}>;
}
}
}
export declare type CSGGeometryProps = {
children?: React.ReactNode;
/** Use material groups, each operation can have its own material, default: false */
useGroups?: boolean;
/** If true then any group in the final geometry that shares a common material with another group will be merged into one to reduce the number of draw calls required by the resulting mesh. */
consolidateGroups?: boolean;
/** Show operation meshes, default: false */
showOperations?: boolean;
/** Re-compute vertx normals, default: false */
computeVertexNormals?: boolean;
};
export declare type CSGGeometryApi = {
computeVertexNormals: boolean;
showOperations: boolean;
useGroups: boolean;
update: () => void;
};
export declare type CSGGeometryRef = CSGGeometryApi & {
geometry: THREE.BufferGeometry;
operations: THREE.Group;
};
export declare const Geometry: React.ForwardRefExoticComponent<CSGGeometryProps & React.RefAttributes<CSGGeometryRef>>;
export declare type BaseProps = React.JSX.IntrinsicElements['brush'];
export declare type BaseRef = Brush;
export declare const Base: React.ForwardRefExoticComponent<Omit<Omit<import("@react-three/fiber/dist/declarations/src/core/utils").Mutable<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Partial<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>, import("@react-three/fiber").MathProps<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>> & import("@react-three/fiber").ReactProps<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>> & Partial<import("@react-three/fiber").EventHandlers>>>, Omit<import("@react-three/fiber").InstanceProps<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>, typeof THREE.Mesh>, "object">>>, "ref"> & Partial<BrushProperties & {
ref?: React.Ref<Brush> | undefined;
}>, "ref"> & React.RefAttributes<Brush>>;
declare type OperationProps = Omit<BaseProps, 'operator'>;
export declare type AdditionProps = OperationProps;
export declare type AdditionRef = BaseRef;
export declare const Addition: React.ForwardRefExoticComponent<Omit<OperationProps, "ref"> & React.RefAttributes<Brush>>;
export declare type SubtractionProps = OperationProps;
export declare type SubtractionRef = BaseRef;
export declare const Subtraction: React.ForwardRefExoticComponent<Omit<OperationProps, "ref"> & React.RefAttributes<Brush>>;
export declare type ReverseSubtractionProps = OperationProps;
export declare type ReverseSubtractionRef = BaseRef;
export declare const ReverseSubtraction: React.ForwardRefExoticComponent<Omit<OperationProps, "ref"> & React.RefAttributes<Brush>>;
export declare type DifferenceProps = OperationProps;
export declare type DifferenceRef = BaseRef;
export declare const Difference: React.ForwardRefExoticComponent<Omit<OperationProps, "ref"> & React.RefAttributes<Brush>>;
export declare type IntersectionProps = OperationProps;
export declare type IntersectionRef = BaseRef;
export declare const Intersection: React.ForwardRefExoticComponent<Omit<OperationProps, "ref"> & React.RefAttributes<Brush>>;
export declare function useCSG(): CSGGeometryApi;
export {};