Add utility functions for transform states and material caching

This commit is contained in:
2026-05-11 13:55:46 +02:00
parent 72bae09629
commit 57944ee147

View File

@@ -684,6 +684,55 @@ function collectTransformPreviewTargetIds(
return targetIds;
}
function cloneEntityTransformScaleState(
scale: EntityTransformScaleState
): EntityTransformScaleState {
switch (scale.kind) {
case "none":
return {
kind: "none"
};
case "scale":
return {
kind: "scale",
scale: {
...scale.scale
}
};
case "size":
return {
kind: "size",
size: {
...scale.size
}
};
}
}
function getRotationDegreesFromEntityRotationState(
rotation: EntityTransformRotationState
): Vec3 {
switch (rotation.kind) {
case "yaw":
return {
x: 0,
y: rotation.yawDegrees,
z: 0
};
case "euler":
return {
...rotation.rotationDegrees
};
case "direction":
case "none":
return {
x: 0,
y: 0,
z: 0
};
}
}
interface CachedMaterialTexture {
signature: string;
textureSet: StarterMaterialTextureSet;