import * as THREE from 'three';
|
|
export const isNullOfUndefined = (param) => {
|
if (null === param || undefined === param) {
|
return true;
|
} else {
|
return false;
|
}
|
}
|
|
export const rotationToNum = (rotation) => {
|
let res = rotation * 180 / Math.PI;
|
if (res < 0) {
|
res += 360;
|
} else if (res > 360) {
|
res -= 360;
|
}
|
return res;
|
}
|
|
export const rotationParseNum = (num) => {
|
return num * Math.PI / 180;
|
}
|
|
export const setShadow = (obj) => {
|
obj.castShadow = true;
|
obj.receiveShadow = true;
|
|
if (obj.children) {
|
obj.children.forEach((child) => {
|
setShadow(child);
|
});
|
}
|
};
|
|
export const setColor = (obj) => {
|
if (obj.material) {
|
obj.material.color.set(0x4680BF);
|
}
|
if (obj.children) {
|
obj.children.forEach((child) => {
|
setColor(child);
|
});
|
}
|
};
|