cosmo/frontend/src/config/celestialSizes.ts

70 lines
1.5 KiB
TypeScript

/**
* Celestial body rendering sizes configuration
* Shared across components for consistent sizing
*/
/**
* Planet rendering sizes (radius in scene units)
*/
export const PLANET_SIZES: Record<string, number> = {
Mercury: 0.35,
Venus: 0.55,
Earth: 0.6,
Mars: 0.45,
Jupiter: 1.4,
Saturn: 1.2,
Uranus: 0.8,
Neptune: 0.8,
Pluto: 0.2,
// Default for unknown planets
default: 0.5,
};
/**
* Satellite rendering sizes (radius in scene units)
*/
export const SATELLITE_SIZES: Record<string, number> = {
Moon: 0.15,
// Default for unknown satellites
default: 0.12,
};
/**
* Star rendering sizes (radius in scene units)
*/
export const STAR_SIZES: Record<string, number> = {
Sun: 0.4,
// Default for unknown stars
default: 0.4,
};
/**
* Comet rendering sizes (radius in scene units)
* Comets are typically small with a bright nucleus
*/
export const COMET_SIZES: Record<string, number> = {
// Famous comets
Halley: 0.15,
// Default for unknown comets
default: 0.12,
};
/**
* Get the rendering size for a celestial body by name and type
*/
export function getCelestialSize(name: string, type: string): number {
switch (type) {
case 'planet':
case 'dwarf_planet':
return PLANET_SIZES[name] || PLANET_SIZES.default;
case 'satellite':
return SATELLITE_SIZES[name] || SATELLITE_SIZES.default;
case 'star':
return STAR_SIZES[name] || STAR_SIZES.default;
case 'comet':
return COMET_SIZES[name] || COMET_SIZES.default;
default:
return 0.5;
}
}