void 
GltFields::add(Vector &val,const string &name)
{
	GltFields *root = new GltFields(name);
	_fields.push_back(GltFieldPtr(root));

	root->add(val.x(),1.0,"x");
	root->add(val.y(),1.0,"y");
	root->add(val.z(),1.0,"z");
}
void 
GltFields::add(BoundingBox &val,const string &name)
{
	GltFields *root = new GltFields(name);
	_fields.push_back(GltFieldPtr(root));

	root->add(val.defined(),"defined");
	root->add(val.min()    ,"min");
	root->add(val.max()    ,"max");
}
void 
GltFields::add(GltViewport &val,const string &name)
{
	GltFields *root = new GltFields(name);
	_fields.push_back(GltFieldPtr(root));

	root->add(val.x()     ,"x"     );
	root->add(val.y()     ,"y"     );
	root->add(val.width() ,"width" );
	root->add(val.height(),"height");
}
void 
GltFields::add(GltColor &val,const string &name)
{
	GltFields *root = new GltFields(name);
	_fields.push_back(GltFieldPtr(root));

	root->add(val.red()   ,0.05,"red"   );
	root->add(val.green() ,0.05,"green" );
	root->add(val.blue()  ,0.05,"blue"  );
	root->add(val.alpha() ,0.05,"alpha" );
}
void 
GltFields::add(GltMaterial &val,const string &name)
{
	GltFields *root = new GltFields(name);
	_fields.push_back(GltFieldPtr(root));

	root->add(val.ambient(),  "ambient");
	root->add(val.diffuse(),  "diffuse");
	root->add(val.specular(), "specular");
	root->add(val.emission(), "emission");
	root->add(val.shininess(),"shininess");
}
GltFieldPtr 
GltShape::settings()
{
	GltFields *root = new GltFields(name());

	root->add(_visible       ,"visible"       );
	root->add(_solid         ,"solid"         );
	root->add(_name          ,"name"          );
	root->add(_color         ,"color"         );
	root->add(_transformation,"transformation");

	return root;
}
void 
GltFields::add(Matrix &val,const string &name)
{
	GltFields *root = new GltFields(name);
	_fields.push_back(GltFieldPtr(root));

	root->add(val[ 0],1.0,"00");
	root->add(val[ 1],1.0,"01");
	root->add(val[ 2],1.0,"02");
	root->add(val[ 3],1.0,"03");
	root->add(val[ 4],1.0,"04");
	root->add(val[ 5],1.0,"05");
	root->add(val[ 6],1.0,"06");
	root->add(val[ 7],1.0,"07");
	root->add(val[ 8],1.0,"08");
	root->add(val[ 9],1.0,"09");
	root->add(val[10],1.0,"10");
	root->add(val[11],1.0,"11");
	root->add(val[12],1.0,"12");
	root->add(val[13],1.0,"13");
	root->add(val[14],1.0,"14");
	root->add(val[15],1.0,"15");
}
GltFieldPtr
GltHistogram::settings()
{
    GltFields *root = new GltFields(name());

    root->add(visible()    ,"display"         );
    root->add(_drawLine    ,"line"            );
    root->add(color()      ,"color"           );
    root->add(_min     ,1.0,"min"             );
    root->add(_max     ,1.0,"max"             );
    root->add(_size        ,"size"            );
    root->add(_cumulative  ,"cumulative"      );
    root->add(new GltFieldFunc<GltHistogram>(*this,&GltHistogram::reset,"reset",true));

    return root;
}
GltFields::GltFields(const GltFields &other)
: GltField(other.name()), _fields(other._fields)
{
}
void 
GltFields::add(GltLight &val,const string &name)
{
	GltFields *root = new GltFields(name);
	_fields.push_back(GltFieldPtr(root));

	root->add(val.enabled(),      "enabled");
	root->add(val.ambient(),      "ambient");
	root->add(val.diffuse(),      "diffuse");
	root->add(val.specular(),     "specular");
	root->add(val.position(),     "position");
	root->add(val.spotDirection(),"spotDirection");
	root->add(val.spotExponent(), "spotExponent");
	root->add(val.spotCutoff(),   "spotCutoff");

	GltFields *atten = new GltFields("attenuation");
	atten->add(val.attenutationConstant() ,"constant");
	atten->add(val.attenutationLinear()   ,"linear");
	atten->add(val.attenutationQuadratic(),"quadratic");

	root->add(atten);
}