Ejemplo n.º 1
0
bool LeafModel::loadXML (ATOM_TiXmlElement *root, unsigned randomSeed)
{
	if (!root)
	{
		return false;
	}

	ATOM_TiXmlElement *eRoot = root;

	ATOM_TiXmlElement *eLeafWidth = eRoot->FirstChildElement("LeafWidth");
	if (eLeafWidth)
	{
		double val = width;
		eLeafWidth->Attribute ("Value", &val);
		width = val;
	}

	ATOM_TiXmlElement *eLeafHeight = eRoot->FirstChildElement("LeafHeight");
	if (eLeafHeight)
	{
		double val = height;
		eLeafHeight->Attribute ("Value", &val);
		height = val;
	}

	ATOM_TiXmlElement *eLeafTexture = eRoot->FirstChildElement("LeafTexture");
	if (eLeafTexture)
	{
		const char *filename = eLeafTexture->Attribute ("FileName");
		setTextureFileName (filename ? filename : "");
	}

	ATOM_TiXmlElement *eLeafSizeV = eRoot->FirstChildElement("LeafSizeV");
	if (eLeafSizeV)
	{
		double val = sizeV;
		eLeafSizeV->Attribute ("Value", &val);
		sizeV = val;
	}
	
	ATOM_TiXmlElement *eLeafRandomRange = eRoot->FirstChildElement("LeafRandomRange");
	if (eLeafRandomRange)
	{
		double val = randomRange;
		eLeafRandomRange->Attribute ("Value", &val);
		randomRange = val;
	}

	ATOM_TiXmlElement *eLeafDensity = eRoot->FirstChildElement("LeafDensity");
	if (eLeafDensity)
	{
		eLeafDensity->Attribute ("Value", &density);
	}

	ATOM_TiXmlElement *eLeafFlip = eRoot->FirstChildElement("LeafFlip");
	if (eLeafFlip)
	{
		int b = flip ? 1 : 0;
		eLeafFlip->Attribute ("Value", &b);
		flip = b != 0;
	}

	ATOM_TiXmlElement *eVisible = eRoot->FirstChildElement("LeafVisible");
	if (eVisible)
	{
		int b = visible ? 1 : 0;
		eVisible->Attribute ("Value", &b);
		visible = b != 0;
	}

	return regenerate (randomSeed);
}
Ejemplo n.º 2
0
// setSlotTextureFileName() -- sets the texture file name
bool BmpTexture::setSlotTextureFileName(Basic::String* const s)
{
   if (s != 0) setTextureFileName(*s);
   else setTextureFileName(0);
   return true;
}