@vctrl/hooks
Version:
vctrl/hooks is a React hooks package designed to simplify 3D model loading and management within React applications. It's part of the vectreal-core ecosystem and is primarily used in the vctrl/viewer React component and the official website application.
40 lines (39 loc) • 860 B
TypeScript
import { OptimizationReport } from '../../../core/src/model-optimizer/index.ts';
interface ModelTotals {
verticesCount: number;
primitivesCount: number;
texturesCount: number;
meshesCount: number;
sceneBytes: number;
}
export interface OptimizationInfo {
initial: ModelTotals;
optimized: ModelTotals;
improvement: ModelTotals;
}
/**
* Interface representing the state of the model optimizer.
*/
export interface OptimizationState {
report: OptimizationReport | null;
info: OptimizationInfo | null;
error: Error | null;
loading: boolean;
}
/**
* Types of actions for the reducer.
*/
export type Action = {
type: 'LOAD_START';
} | {
type: 'LOAD_SUCCESS';
payload: {
report: OptimizationReport;
};
} | {
type: 'LOAD_ERROR';
payload: Error;
} | {
type: 'RESET';
};
export {};