feat(web): complete user-facing workflow command coverage
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { SculptBrush, SculptMeshAttributesIR, SculptStrokeIR } from "./sculpt";
|
||||
|
||||
export const PAINT_BUDGET = {
|
||||
maxSamples: 100_000,
|
||||
maxWeightEntries: 1_000_000,
|
||||
@@ -96,6 +98,45 @@ export interface PaintBrushSpatialQueryIR {
|
||||
|
||||
export interface PaintColorPatchIR { indices: number[]; colors: number[] }
|
||||
|
||||
export function createSculptStroke(
|
||||
meshId: string,
|
||||
brush: SculptBrush,
|
||||
radius: number,
|
||||
strength: number,
|
||||
pressure: number,
|
||||
symmetry: [boolean, boolean, boolean],
|
||||
mirrorObjectSpace: boolean,
|
||||
): SculptStrokeIR {
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
meshId,
|
||||
brush,
|
||||
samples: [{ position: [0, 0, 0], normal: [0, 0, 1], radius, strength, pressure, time: 0 }],
|
||||
symmetry,
|
||||
mirrorObjectSpace,
|
||||
};
|
||||
}
|
||||
|
||||
export function createSculptMeshAttributes(
|
||||
meshId: string,
|
||||
vertexCount: number,
|
||||
faceCount: number,
|
||||
maskValue: number,
|
||||
faceSet: number,
|
||||
revision: number,
|
||||
): SculptMeshAttributesIR {
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
meshId,
|
||||
vertexCount,
|
||||
faceCount,
|
||||
mask: Array.from({ length: vertexCount }, () => maskValue),
|
||||
faceSets: Array.from({ length: faceCount }, () => faceSet),
|
||||
activeFaceSet: faceSet,
|
||||
revision,
|
||||
};
|
||||
}
|
||||
|
||||
function parseBrushWeights(value: unknown, path = "brushWeights"): PaintBrushWeightIR[] {
|
||||
if (!Array.isArray(value) || value.length > PAINT_BUDGET.maxWeightEntries) fail(path, "exceeds the brush patch budget", true);
|
||||
if (value.length === 0) fail(path, "must contain at least one brush hit");
|
||||
|
||||
Reference in New Issue
Block a user