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

#include "PhBBoxTextureProjection.H"
#include "xrmlP.H"

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

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

bool PhBBoxTextureProjection::assign_size(const SFVec3f& value)
{
  // TODO: value range check!
  size = value;
  status |= size_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBBoxTextureProjection_size(SFNode* node, const fieldValue& value)
{
  PhBBoxTextureProjection* PhBBoxTextureProjection_node = dynamic_cast<PhBBoxTextureProjection*>(node);
  if (!PhBBoxTextureProjection_node)
    Fatal(-1, "assign_PhBBoxTextureProjection_size", "called for a non-PhBBoxTextureProjection node");
  return PhBBoxTextureProjection_node->assign_size((const SFVec3f&)value);
}

void PhBBoxTextureProjection::set_size(const SFVec3f& val)
{
  SFVec3f tmpval(val);
  fieldValue v(&tmpval);
  interface[0]->assign(this, v);
}

PhBBoxTextureProjection::PhBBoxTextureProjection()
{
  interfaceMember* the_interface[1] = {
    new exposedField("size", fieldValue(&size), assign_PhBBoxTextureProjection_size),
  };
  SFNode::construct(PhBBoxTextureProjectionTypeId, 1, the_interface);

  size = SFVec3f(2,2,2);
  
  PhBTextureProjection::util_init();
  PhBBoxTextureProjection::util_init();
}

void PhBBoxTextureProjection::destruct(void)
{
  PhBBoxTextureProjection::util_destruct();
  PhBTextureProjection::util_destruct();
  SFNode::destruct();
}

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

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

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

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

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

}  // namespace xrml
