Add function to read and validate positive Vec3Draft

This commit is contained in:
2026-03-31 17:42:48 +02:00
parent 558d20f25f
commit 353ad1fc05

View File

@@ -196,6 +196,16 @@ function readPositiveVec2Draft(draft: Vec2Draft, label: string): Vec2 {
return vector;
}
function readPositiveVec3Draft(draft: Vec3Draft, label: string): Vec3 {
const vector = readVec3Draft(draft, label);
if (vector.x <= 0 || vector.y <= 0 || vector.z <= 0) {
throw new Error(`${label} values must remain positive.`);
}
return vector;
}
function readVec3Draft(draft: Vec3Draft, label: string): Vec3 {
const vector = {
x: Number(draft.x),