示例#1
0
void Batch::Read(Archive& ar)
{
	int version=ar.ReadInt("version");
	this->primitive=ar.ReadInt("primitive"); 
	ar.Push("ambient" );ambient.Read (ar);ar.Pop("ambient");
	ar.Push("diffuse" );diffuse.Read (ar);ar.Pop("diffuse");
	ar.Push("specular");specular.Read(ar);ar.Pop("specular");
	ar.Push("emission");emission.Read(ar);ar.Pop("emission");
	this->shininess=ar.ReadFloat("shininess");
	ar.Push("matrix"  );matrix.Read(ar);ar.Pop("matrix");
	ar.Push("vertices");vertices=ar.ReadSmartPointer<Vector>();ar.Pop("vertices");
	ar.Push("normals" );normals=ar.ReadSmartPointer<Vector>();ar.Pop("normals");
	ar.Push("colors" ) ;colors=ar.ReadSmartPointer<Vector>();ar.Pop("colors");
	this->texture0.reset();std::string skin_filename=ar.ReadString("texture0");
	if (skin_filename.length()) this->texture0 =Texture::open(skin_filename);
	ar.Push("texture0coords");texture0coords=ar.ReadSmartPointer<Vector>();ar.Pop("texture0coords");
	this->texture1.reset();std::string light_filename=ar.ReadString("texture1");
	if (light_filename.length()) this->texture1 =Texture::open(light_filename);
	ar.Push("texture1coords");texture1coords=ar.ReadSmartPointer<Vector>();ar.Pop("texture1coords");

	//I force a recalculation of bounding box
	this->invalidateBox();
}