feat(web): complete product workflow implementation
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { SculptBrush, SculptMeshAttributesIR, SculptStrokeIR } from "./sculpt";
|
||||
import type { SculptBrush, SculptMeshAttributesIR, SculptStrokeIR, SculptStrokeSampleIR } from "./sculpt";
|
||||
|
||||
export const PAINT_BUDGET = {
|
||||
maxSamples: 100_000,
|
||||
@@ -106,12 +106,30 @@ export function createSculptStroke(
|
||||
pressure: number,
|
||||
symmetry: [boolean, boolean, boolean],
|
||||
mirrorObjectSpace: boolean,
|
||||
cursorSamples: ReadonlyArray<SculptStrokeSampleIR> = [],
|
||||
): SculptStrokeIR {
|
||||
const samples = cursorSamples.length > 0
|
||||
? cursorSamples.slice(0, 2048).map((sample) => ({
|
||||
position: [...sample.position] as [number, number, number],
|
||||
normal: [...sample.normal] as [number, number, number],
|
||||
radius,
|
||||
strength,
|
||||
pressure,
|
||||
time: sample.time,
|
||||
}))
|
||||
: Array.from({ length: 3 }, (_, index) => ({
|
||||
position: [0, 0, index * 0.01] as [number, number, number],
|
||||
normal: [0, 0, 1] as [number, number, number],
|
||||
radius,
|
||||
strength,
|
||||
pressure,
|
||||
time: index,
|
||||
}));
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
meshId,
|
||||
brush,
|
||||
samples: [{ position: [0, 0, 0], normal: [0, 0, 1], radius, strength, pressure, time: 0 }],
|
||||
samples,
|
||||
symmetry,
|
||||
mirrorObjectSpace,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user