import { Vec2Array, Vec3Array } from "@amodx/math"; import { VoxelFaceNames } from "../../Math"; /**Define a custom geometry node */ export interface VoxelCustomGeometryNode { type: "custom"; id: string; inputs: Record; } export interface VoxelBoxGeometryNode { type: "box"; /**Divisor used for transform of this specific node.*/ divisor?: Vec3Array; points: [start: Vec3Array, end: Vec3Array]; rotation?: Vec3Array; faces: Record; } export interface BaseVoxelQuadData { doubleSided?: boolean | string; enabled?: boolean; /**Id for an input arg for the texture */ texture: string; /**UV for the face or id for an input arg. */ uv: [x1: number, y1: number, x2: number, y2: number] | string; /**UV rotation or id for an input arg */ rotation?: number | string; } export interface VoxelQuadGeometryNode extends BaseVoxelQuadData { type: "quad"; /**Divisor used for transform of this specific node.*/ divisor?: Vec3Array; points: [p1: Vec3Array, p2: Vec3Array, p3: Vec3Array, p4: Vec3Array]; } export interface BaseVoxelTriangleData { doubleSided?: boolean; /**Id for the input arg for the texture */ texture: string; /**UV for the triangle or id for the input arg. */ uv: [v1: Vec2Array, v2: Vec2Array, v3: Vec2Array] | string; /**UV rotation or id for an input arg */ rotation?: number | string; } export interface VoxelTriangleGeometryNode extends BaseVoxelTriangleData { type: "triangle"; /**Divisor used for transform of this specific node.*/ divisor?: Vec3Array; points: [p1: Vec3Array, p2: Vec3Array, p3: Vec3Array]; } export interface VoxelGeometryTextureArgument { type: "texture"; } /**Creates a way to set multiple arguments to the same thing. What ever value is passed in will be passed to the arguments. */ export interface VoxelGeometryArgumentAliasList { type: "arg-list"; arguments: string[]; } export interface VoxelGeometryBooleanArgument { type: "boolean"; default: boolean; } export interface VoxelGeometryIntArgument { type: "int"; default: number; } export interface VoxelGeometryFloatArgument { type: "float"; default: number; } export interface VoxelGeometryBoxUVArgument { type: "box-uv"; default: [x1: number, y1: number, x2: number, y2: number]; } export interface VoxelGeometryUVArgument { type: "uv"; default: Vec2Array[]; } export interface VoxelGeometryVector3Argument { type: "vector3"; default?: Vec3Array; min?: Vec3Array; max?: Vec3Array; } export type VoxelGeometryNodes = VoxelCustomGeometryNode | VoxelBoxGeometryNode | VoxelTriangleGeometryNode | VoxelQuadGeometryNode; export type CullingProcedureData = { type: "default"; } | { type: "none"; } | { type: "transparent"; }; export interface VoxelGeometryData { id: string; nodes: VoxelGeometryNodes[]; divisor?: Vec3Array; /** * If this is set the voxel geometry will not be included in the * geometry rules and will be fall back to custom inputs. * Ideal for advanced or non cubic models. * */ doNotBuildRules?: true; /** * Define the culling procedure for faces */ cullingProcedure?: CullingProcedureData; arguments: Record; }