Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 15x 15x 117x 117x 223x 80x 80x 3x 77x | import { RecursivePartial, Settings } from "../codeCharta.model"
import { Vector3 } from "three"
export function convertToVectors(settings: RecursivePartial<Settings>) {
const DEFAULT_VALUE = 1
for (const key of Object.keys(settings)) {
if (typeof settings[key] === "object" && settings[key] !== null) {
const { x, y, z } = settings[key]
if (x !== undefined || y !== undefined || z !== undefined) {
settings[key] = new Vector3(x ?? DEFAULT_VALUE, y ?? DEFAULT_VALUE, z ?? DEFAULT_VALUE)
} else {
convertToVectors(settings[key])
}
}
}
}
|