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

#pragma once

#include "rkcommon/math/box.ih"
// c++ shared
#include "TileShared.h"

OSPRAY_BEGIN_ISPC_NAMESPACE

inline void setRGBA(uniform Tile &tile,
    const varying uint32 i,
    const varying vec3f rgb,
    const varying float alpha = 0.f)
{
  tile.r[i] = rgb.x;
  tile.g[i] = rgb.y;
  tile.b[i] = rgb.z;
  tile.a[i] = alpha;
}

inline void setRGBAZ(uniform Tile &tile,
    const varying uint32 i,
    const varying vec3f rgb,
    const varying float alpha,
    const varying float z)
{
  tile.r[i] = rgb.x;
  tile.g[i] = rgb.y;
  tile.b[i] = rgb.z;
  tile.a[i] = alpha;
  tile.z[i] = z;
}

inline void setRGBA(
    uniform Tile &tile, const varying uint32 i, const varying vec4f rgba)
{
  tile.r[i] = rgba.x;
  tile.g[i] = rgba.y;
  tile.b[i] = rgba.z;
  tile.a[i] = rgba.w;
}

inline void setNormalAlbedo(
    uniform Tile &tile, const uint32 i, const vec3f normal, const vec3f albedo)
{
  tile.nx[i] = normal.x;
  tile.ny[i] = normal.y;
  tile.nz[i] = normal.z;
  tile.ar[i] = albedo.x;
  tile.ag[i] = albedo.y;
  tile.ab[i] = albedo.z;
}
OSPRAY_END_ISPC_NAMESPACE
