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

#include "PhB3DNoiseTexture.H"
#include "xrmlP.H"

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

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

bool PhB3DNoiseTexture::assign_k(const SFFloat& value)
{
  // TODO: value range check!
  k = value;
  status |= k_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhB3DNoiseTexture_k(SFNode* node, const fieldValue& value)
{
  PhB3DNoiseTexture* PhB3DNoiseTexture_node = dynamic_cast<PhB3DNoiseTexture*>(node);
  if (!PhB3DNoiseTexture_node)
    Fatal(-1, "assign_PhB3DNoiseTexture_k", "called for a non-PhB3DNoiseTexture node");
  return PhB3DNoiseTexture_node->assign_k((const SFFloat&)value);
}

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

PhB3DNoiseTexture::PhB3DNoiseTexture()
{
  interfaceMember* the_interface[1] = {
    new exposedField("k", fieldValue(&k), assign_PhB3DNoiseTexture_k),
  };
  SFNode::construct(PhB3DNoiseTextureTypeId, 1, the_interface);

  k = 1;
  
  PhB3DTexture::util_init();
  PhB3DNoiseTexture::util_init();
}

void PhB3DNoiseTexture::destruct(void)
{
  PhB3DNoiseTexture::util_destruct();
  PhB3DTexture::util_destruct();
  SFNode::destruct();
}

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

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

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

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

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

}  // namespace xrml
