// PhBPhongRefractorP.C: PhBPhongRefractor nodes (private source).
// Automatically generated with nodegen 0.5a - do not edit.

#include "PhBPhongRefractor.H"
#include "xrmlP.H"

namespace xrml {
int PhBPhongRefractor::major_version(void) { return 0; }
int PhBPhongRefractor::minor_version(void) { return 5; }
bool PhBPhongRefractor::is_leaf_class(void) { return true; }

bool IsPhBPhongRefractor(SFNode* node)
{
  return (dynamic_cast<PhBPhongRefractor*>(node) != 0);
}

bool PhBPhongRefractor::assign_sharpness(const SFFloat& value)
{
  // TODO: value range check!
  sharpness = value;
  status |= sharpness_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBPhongRefractor_sharpness(SFNode* node, const fieldValue& value)
{
  PhBPhongRefractor* PhBPhongRefractor_node = dynamic_cast<PhBPhongRefractor*>(node);
  if (!PhBPhongRefractor_node)
    Fatal(-1, "assign_PhBPhongRefractor_sharpness", "called for a non-PhBPhongRefractor node");
  return PhBPhongRefractor_node->assign_sharpness((const SFFloat&)value);
}

void PhBPhongRefractor::set_sharpness(const SFFloat& val)
{
  SFFloat tmpval(val);
  fieldValue v(&tmpval);
  interface[0]->assign(this, v);
}

PhBPhongRefractor::PhBPhongRefractor()
{
  interfaceMember* the_interface[1] = {
    new exposedField("sharpness", fieldValue(&sharpness), assign_PhBPhongRefractor_sharpness),
  };
  SFNode::construct(PhBPhongRefractorTypeId, 1, the_interface);

  sharpness = 0;
  
  PhBScatterer::util_init();
  PhBPhongRefractor::util_init();
}

void PhBPhongRefractor::destruct(void)
{
  PhBPhongRefractor::util_destruct();
  PhBScatterer::util_destruct();
  SFNode::destruct();
}

PhBPhongRefractor::~PhBPhongRefractor()
{
  destruct();
}

void PhBPhongRefractor::clone_here(const PhBPhongRefractor& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&sharpness);
  
  sharpness = src.sharpness;
  
  PhBScatterer::util_clone(src);
  PhBPhongRefractor::util_clone(src);
}

PhBPhongRefractor::PhBPhongRefractor(const PhBPhongRefractor& src)
{
  clone_here(src);
}

PhBPhongRefractor& PhBPhongRefractor::operator=(const PhBPhongRefractor& src)
{
  if (this != &src) {
    destruct();
    clone_here(src);
  }
  return *this;
}

SFNode* PhBPhongRefractor::instantiate(Proto *enclosing_proto)
{
  if (nameIndex>=0)
    // named node: return pointer to pre-made instance
    return enclosing_proto ? enclosing_proto->namedNodes[nameIndex] : this;
  
  PhBPhongRefractor* instance = new PhBPhongRefractor(*this);
  instance->instantiate_interface(enclosing_proto);
  return instance;
}

}  // namespace xrml
