// PhBWardReflector.H: PhBWardReflector nodes.

// This file has been generated using nodegen 0.5a.
// Restrict manual editing to the sections delimited by
// . the comments "utility includes" and "end of utility includes"
// . the comments "utility members" and "end of utility members"

#ifndef _PhBWardReflector_H_
#define _PhBWardReflector_H_

#include "xrml.H"
#include "PhBScatterer.H"

// utility includes
// end of utility includes

namespace xrml {
#define PhBWardReflectorTypeId 	"PhBWardReflector"
extern bool IsPhBWardReflector(SFNode*);

class PhBWardReflector: public virtual SFNode, public PhBScatterer {
private:
  //
  void clone_here(const PhBWardReflector&);
  void destruct(void);
  
  // field/eventOut update status bits
  // Use xxx_is_updated() and xxx_clear_update() to inspect/reset.
  enum status_bits {
    standardDeviationX_updated = 0x1,
    standardDeviationY_updated = 0x2 
  };
  
public:
  //
  int major_version(void), minor_version(void);
  bool is_leaf_class(void);
  
  PhBWardReflector();
  PhBWardReflector(const PhBWardReflector&);
  PhBWardReflector& operator=(const PhBWardReflector&);
  virtual ~PhBWardReflector();
  
  //
  SFNode*          	instantiate(Proto * =0);
  void             	render(void);
  
  // state values:
  // Do not assign directly unless you know very well what you are doing.
  SFFloat          	standardDeviationX;
  SFFloat          	standardDeviationY;
  
  // set_<exposedField> eventIns: with forwarding and eventOut generation
  void             	set_standardDeviationX(const SFFloat&);
  void             	set_standardDeviationY(const SFFloat&);
  
  // field assignement: no forwarding or eventOut generation!
  bool             	assign_standardDeviationX(const SFFloat&);
  bool             	assign_standardDeviationY(const SFFloat&);
  
  // update status
  inline bool      	standardDeviationX_is_updated(void) { return (status & standardDeviationX_updated); }
  inline void      	standardDeviationX_clear_update(void) { status &= ~standardDeviationX_updated; }
  inline bool      	standardDeviationY_is_updated(void) { return (status & standardDeviationY_updated); }
  inline void      	standardDeviationY_clear_update(void) { status &= ~standardDeviationY_updated; }
  
  // utility members
  float albedo(const Vec3& inDir,
	       const complex& IndexIn,
	       const complex& IndexOut,
	       int modes);
  Vec3 sample(const Vec3& inDir,
	      const complex& IndexIn,
	      const complex& IndexOut,
	      float xi1, float xi2,
	      int modes);
  float eval(const Vec3& inDir,
	     const Vec3& outDir,
	     const complex& IndexIn,
	     const complex& IndexOut,
	     int modes, 
	     float *pdf);
  
protected:
  inline void util_init(void) { }
  inline void util_clone(const PhBWardReflector& src) { }
  inline void util_destruct(void) { }
};

// end of utility members
} // namespace xrml
#endif /*_PhBWardReflector_H_*/
