//----------------------------------------------------------------------------
// William Baxter III's Ray Tracer
//
//     Project for Comp 238, Raster Graphics
//     University of North Carolina at Chapel Hill
//     
// $Id:$
//----------------------------------------------------------------------------

#include "wb3Artifact.hpp"

using namespace wb3Component;

const float wb3Artifact::ms_fEps = 1e-3f;

//----------------------------------------------------------------------------
wb3Artifact::wb3Artifact()
{
  m_pShader = 0;
  m_pMaterial = 0;
  m_pTexset = 0;
  m_fGloss = 1.0f;
}
//----------------------------------------------------------------------------

wb3Artifact::~wb3Artifact()
{
  // need to ref count materials and shaders, and deref 'em here!!
  delete m_pTexset;
}

//----------------------------------------------------------------------------
Vec3f& wb3Artifact::GetColorComponent(
    Vec3f& color, wb3Component::ComponentType type, const Vec3f& Pw) const
{
  // In general this will iterate over all textures in the textureset of
  // the given type and add each of their contributions to the Materials.
  color = GetMaterial()->GetColorComponent(type);

  // [Texture set stuff...]

  return color;
}
//----------------------------------------------------------------------------
float wb3Artifact::GetScalarComponent(
    wb3Component::ComponentType type, const Vec3f& Pw) const
{
  // In general this will iterate over all textures in the textureset of
  // the given type and add each of their contributions to the Materials.
  // Except for bump
  float attrib = GetMaterial()->GetScalarComponent(type);

  // [Texture set stuff...]

  return attrib;
}
//----------------------------------------------------------------------------


