// ===================================================================
//
// anisotropicPhong.cpp
//     Implementation of Anisotropic Phong shading model (Asikhmin&Shirley).
//
// Licence and usage conditions in November 2003:
// This file can be used and modified only with written permission of
// Vlastimil Havran, Pohodli 27, 57001 Litomysl, the Czech Republic.
// This library is granted to be used by Polina Kondratieva within
// her MPI HIWI job working on BRDFLIB library. The usage condition
// may change in the next version of the library. At the moment,
// the library development is supported by Max-Planck-Institut for
// Informatik, Stuhlsatzenhausweg 85, 66123 Saarbruecken Germany
// See WWW: http://www.mpi-sb.mpg.de
// REPLACEMENT_STRING
//
// Initial coding by Hana Truskova & Michael Smutny
// as a term work for X36RSO 2008/2009 at Prague CTU FEL
//
// Given to BRDFLIB project for the Polina Kondratieva's
// HIWI JOB assignment in November 2003.
// ===================================================================


#ifndef __ANISOTROPIC_PHONG_H__
#define __ANISOTROPIC_PHONG_H__

// BRDFLIB library
#include "configh.h"
#include "surface.h"
#include "functions.h"
#include "phong.h"

// Implementation according to paper:
//"An Anisotropic Phong BRDF Model", Asikhmin, M., Shirley, P., August 2000.
__BEGIN_BRDFLIB_HEADER


// Forward-declare classes
class CHitPointInfo;
class CMatrix4;
class CRay;
class CTexture;

// Refernce:
// "An Anisotropic Phong BRDF Model", Asikhmin, M., Shirley, P., August 2000

class CSurfaceAnisotropicPhong:
  public CSurfacePhongPhysical
{
public:
  CSurfaceAnisotropicPhong():
    CSurfacePhongPhysical()
  {}

  virtual CSurfaceAnisotropicPhong* CreateNewObject() const
  { return new CSurfaceAnisotropicPhong; }

  virtual int
  SpawnDeterministicRays(CContributionArray  &carray,
		         const CHitPointInfo &hitInfo,
       		         EDistributionType   distType = EE_ALL) const
  {
     return 0;
  }

  virtual int
  SpawnStochasticRays(CContributionArray  &carray,
		      const CHitPointInfo &hitInfo,
		      CSamplingInfo       &samplingInfo,
      		      EDistributionType   distType = EE_ALL) const;

  virtual bool
  EvaluateBSDF(CValues             &brdf,
	       const CHitPointInfo &hitInfo,
	       const CVector3D     &out,
	       EDistributionType   distType=EE_ALL) const;

protected:
  virtual EDistributionType _phongReflectionType() const
  { return EE_REFLECTED_GLOSSY; }


  virtual int SpawnStochasticSpecularRays(const CValues       &ks_local,
				  const CValues       &shininess,
				  CContributionArray  &carray,
				  const CHitPointInfo &hitInfo,
				  CSamplingInfo        &samplingInfo,
				  int                 maxRays) const;

  // same function as in ordinary Phong model
  /*virtual int SpawnStochasticDiffuseRays(const CValues       &kd_local,
				 CContributionArray  &carray,
				 const CHitPointInfo &hitInfo,
				 CSamplingInfo        &samplingInfo,
				 int                 maxRays) const;*/
  virtual const char* GetHelp() const;

  virtual const char* GetParameterTitle(int parameterIndex) const;

  virtual const char* GetParameterDescription(int parameterIndex) const;

  virtual EParameterUIType GetParameterSyntax(int parameterIndex) const;

  virtual void SetParameter(int parameterIndex, 
							const CValues& value);

  virtual CValues GetParameter(int parameterIndex) const;

  virtual CValues GetParameterConstraints(int parameterIndex) const;

  virtual int GetNumParameters() const;

private:
  CSurfaceAnisotropicPhong& operator=(const CSurfaceAnisotropicPhong&);
  CSurfaceAnisotropicPhong(const CSurfaceAnisotropicPhong&);
};


__END_BRDFLIB_HEADER

#endif // __ANISOTROPIC_PHONG_H__
