Esempio n. 1
0
void XMLScene::processGlobalLight( TiXmlElement* lights )
{
	bool doublesided,localLights,enabledLights;
	float globalAmbient[4];
	lights->QueryBoolAttribute("doublesided",&doublesided);


	lights->QueryBoolAttribute("enabled",&enabledLights);
	lights->QueryBoolAttribute("local",&localLights);
	read4Float("ambient",lights,globalAmbient[0],globalAmbient[1],globalAmbient[2],globalAmbient[3]);
	Light::setGlobalParameters(doublesided,localLights,enabledLights,globalAmbient);
}
Esempio n. 2
0
void YafFile::processGlobals(TiXmlElement* globalsElement) {
	float background1, background2, background3, background4;
	string drawmode, shading, cullface, cullorder;
	read4Float("background", globalsElement, background1, background2,
		background3, background4);
	drawmode = globalsElement->Attribute("drawmode");
	shading = globalsElement->Attribute("shading");
	cullface = globalsElement->Attribute("cullface");
	cout << cullface << endl;
	cullorder = globalsElement->Attribute("cullorder");
	globalVariables= new Globals(background1, background2, background3, background4,
		drawmode, shading, cullface, cullorder);
}
Esempio n. 3
0
void YafFile::processAppearances(TiXmlElement* appearancesElement)
{
	TiXmlElement* element= appearancesElement->FirstChildElement("appearance");
	float ambient[4],diffuse[4],specular[4],emissive[4],shininess,sWrap,tWrap;
	string textureRef,id;
	while(element!=NULL)
	{
		id=element->Attribute("id"); 
		read4Float("ambient", element, ambient[0], ambient[1], ambient[2],
			ambient[3]);
		read4Float("emissive", element, emissive[0], emissive[1], emissive[2],
			emissive[3]);
		read4Float("diffuse", element, diffuse[0], diffuse[1], diffuse[2],
			diffuse[3]);
		read4Float("specular", element, specular[0], specular[1], specular[2],
			specular[3]);
		element->QueryFloatAttribute("shininess",&shininess);
		if(element->Attribute("texlength_t")!=NULL)
			element->QueryFloatAttribute("texlength_t",&tWrap);
		else tWrap=0;
		if(element->Attribute("texlength_s")!=NULL)
			element->QueryFloatAttribute("texlength_s",&sWrap);
		else sWrap=0;
		if(element->Attribute("textureref")!=NULL)
			textureRef=element->Attribute("textureref");
		else textureRef="";
		Appearance* appearance = new Appearance(ambient,diffuse,specular,emissive,shininess,sWrap,tWrap,textureRef);

		if(textureRef!="")
		{
			appearance->setTextureWrap(tWrap,sWrap);
			appearance->setTexture(sceneTextures[textureRef]);
		}
		appearances[id]=appearance;
		element=element->NextSiblingElement("appearance");
	}
}