import profile from '../public/client-prototype/origin/effects/presentation-profile.json';

export const effectPresentation = profile;
export type EffectPresentationProfile = typeof profile;
export function effectFrameTime(seconds: number, fps = profile.effectFramesPerSecond): number {
  return Math.floor(seconds * fps + 1e-9) / fps;
}
export function effectEmitterTime(birthTime: number, fps = profile.effectFramesPerSecond): number {
  return Math.ceil(birthTime * fps - 1e-9) / fps;
}
export function clipsEffectTexture(source: { path?: string; sha256?: string }, meshBlockIndex?: number,
    presentation = profile): boolean {
  return presentation.surfaceOverrides.some(row => row.sourcePath === source.path &&
    row.sourceSha256 === source.sha256 && row.meshBlockIndex === meshBlockIndex &&
    row.textureDomain === 'TRANSPARENT_OUTSIDE_UNIT_UV');
}
