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

#include "TextureCoordinate.H"
#include "xrmlP.H"

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

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

bool TextureCoordinate::assign_point(const MFVec2f& value)
{
  // TODO: value range check!
  point = value;
  status |= point_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_TextureCoordinate_point(SFNode* node, const fieldValue& value)
{
  TextureCoordinate* TextureCoordinate_node = dynamic_cast<TextureCoordinate*>(node);
  if (!TextureCoordinate_node)
    Fatal(-1, "assign_TextureCoordinate_point", "called for a non-TextureCoordinate node");
  return TextureCoordinate_node->assign_point((const MFVec2f&)value);
}

void TextureCoordinate::set_point(const MFVec2f& val)
{
  MFVec2f tmpval(val);
  fieldValue v(&tmpval);
  interface[0]->assign(this, v);
}

TextureCoordinate::TextureCoordinate()
{
  interfaceMember* the_interface[1] = {
    new exposedField("point", fieldValue(&point), assign_TextureCoordinate_point),
  };
  SFNode::construct(TextureCoordinateTypeId, 1, the_interface);

  point = MFVec2f(0);
  
  TextureCoordinate::util_init();
}

void TextureCoordinate::destruct(void)
{
  TextureCoordinate::util_destruct();
  SFNode::destruct();
}

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

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

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

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

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

}  // namespace xrml
