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

#include "PhBSphereTextureProjection.H"
#include "xrmlP.H"

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

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

bool PhBSphereTextureProjection::assign_radius(const SFFloat& value)
{
  // TODO: value range check!
  radius = value;
  status |= radius_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBSphereTextureProjection_radius(SFNode* node, const fieldValue& value)
{
  PhBSphereTextureProjection* PhBSphereTextureProjection_node = dynamic_cast<PhBSphereTextureProjection*>(node);
  if (!PhBSphereTextureProjection_node)
    Fatal(-1, "assign_PhBSphereTextureProjection_radius", "called for a non-PhBSphereTextureProjection node");
  return PhBSphereTextureProjection_node->assign_radius((const SFFloat&)value);
}

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

PhBSphereTextureProjection::PhBSphereTextureProjection()
{
  interfaceMember* the_interface[1] = {
    new exposedField("radius", fieldValue(&radius), assign_PhBSphereTextureProjection_radius),
  };
  SFNode::construct(PhBSphereTextureProjectionTypeId, 1, the_interface);

  radius = 1;
  
  PhBTextureProjection::util_init();
  PhBSphereTextureProjection::util_init();
}

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

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

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

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

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

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

}  // namespace xrml
