// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "rkcommon/math/vec.ih"

#include "MediumShared.h"

OSPRAY_BEGIN_ISPC_NAMESPACE

inline Medium make_Medium(const vec3f attenuation, const float ior)
{
  Medium m;
  m.attenuation = attenuation;
  m.ior = ior;
  return m;
}

inline Medium make_Medium_vacuum()
{
  return make_Medium(make_vec3f(0.0f), 1.0f);
}

inline bool eq(const Medium &a, const Medium &b)
{
  return (a.ior == b.ior) & eq(a.attenuation, b.attenuation);
}

#ifdef ISPC
inline bool eq(const Medium &a, const uniform Medium &b)
{
  return (a.ior == b.ior) & eq(a.attenuation, b.attenuation);
}

inline uniform bool eq(const uniform Medium &a, const uniform Medium &b)
{
  return (a.ior == b.ior) & eq(a.attenuation, b.attenuation);
}
#endif

OSPRAY_END_ISPC_NAMESPACE
