当前位置: 首页>>代码示例>>C++>>正文


C++ Appearance::setTextureWrap方法代码示例

本文整理汇总了C++中Appearance::setTextureWrap方法的典型用法代码示例。如果您正苦于以下问题:C++ Appearance::setTextureWrap方法的具体用法?C++ Appearance::setTextureWrap怎么用?C++ Appearance::setTextureWrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Appearance的用法示例。


在下文中一共展示了Appearance::setTextureWrap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processAppearances

void XMLScene::processAppearances(TiXmlElement* appearancesElement)
{
	TiXmlElement* element= appearancesElement->FirstChildElement("appearance");
	float ambient[4],diffuse[4],specular[4],emissive[4],shininess,sWrap,tWrap;
	string textureRef,id;
	Appearance* appearance;
	while(element!=NULL)
	{
		id=element->Attribute("id"); 
		read1Float("shininess",element,shininess);
		if(element->Attribute("textureref")!=NULL)
			textureRef=element->Attribute("textureref");
		else textureRef="";

		TiXmlElement* component = element ->FirstChildElement();

		while(component != NULL){
			if(component->Attribute("type")=="ambient"){
				read4Float("value", element, ambient[0], ambient[1], ambient[2],
					ambient[3]);}

			if(component->Attribute("type")=="diffuse"){
				read4Float("value", element, diffuse[0], diffuse[1], diffuse[2],
					diffuse[3]);}

			if(component->Attribute("type")=="specular"){
				read4Float("value", element, specular[0], specular[1], specular[2],
					specular[3]);
			}
			component=component->NextSiblingElement();
		}

		if(textureRef!=""){

			Texture* temp = Textures[textureRef];
			appearance = new Appearance(ambient,diffuse,specular,emissive,shininess,temp->getSWrap(),temp->getTWrap(),textureRef);

			appearance->setTextureWrap(appearance->getSWrap(),appearance->getTWrap());
			appearance->setTexture(sceneTextures[textureRef]);

		}
		else
			appearance = new Appearance(ambient,diffuse,specular,emissive,shininess,1,1,textureRef);

		appearances[id]=appearance;

		element=element->NextSiblingElement("appearance");
	}
}
开发者ID:PMRocha,项目名称:Laig,代码行数:49,代码来源:XMLScene.cpp

示例2: processAppearances

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");
	}
}
开发者ID:jnadal,项目名称:LAIG-Projeto,代码行数:37,代码来源:YafFile.cpp

示例3: pontoAux


//.........这里部分代码省略.........
					ap->setIdS(id);

					emissiveS = appearanceElement->Attribute("emissive");
					float Aemissive[4];
					sscanf_s(emissiveS.c_str(),"%f %f %f %f", &Aemissive[0], &Aemissive[1], &Aemissive[2], &Aemissive[3]);
					ap->setEmissive(Aemissive);

					ambientS = appearanceElement->Attribute("ambient");
					float Aambient[4];
					sscanf_s(ambientS.c_str(),"%f %f %f %f", &Aambient[0], &Aambient[1], &Aambient[2], &Aambient[3]);
					ap->setAmbient(Aambient);

					diffuseS = appearanceElement->Attribute("diffuse");
					float Adiffuse[4];
					sscanf_s(diffuseS.c_str(),"%f %f %f %f", &Adiffuse[0], &Adiffuse[1], &Adiffuse[2], &Adiffuse[3]);
					ap->setDiffuse(Adiffuse);

					specularS = appearanceElement->Attribute("specular");
					float Aspecular[4];
					sscanf_s(specularS.c_str(),"%f %f %f %f", &Aspecular[0], &Aspecular[1], &Aspecular[2], &Aspecular[3]);
					ap->setSpecular(Aspecular);


					if(appearanceElement->Attribute("textureref") != NULL)
					{
						if(appearanceElement->QueryFloatAttribute("texlength_s",&texlength_s)==TIXML_SUCCESS &&
							appearanceElement->QueryFloatAttribute("texlength_t",&texlength_t)==TIXML_SUCCESS)
						{

							textureref = appearanceElement->Attribute("textureref");
							ap->setTextureReference(textureref);
							//ap->setTexture(textureref);

							ap->setTextureWrap(texlength_s,texlength_t);

							ap->setShininess(shininess);

							int itTexturesComp = 0;
							std::vector<Texture*>::iterator it = scene->texturesComp.begin();
							for(it; it != scene->texturesComp.end(); it++){
								if(textureref == scene->texturesComp.at(itTexturesComp)->getTId()){
									ap->setTexture((*it));
								}
								itTexturesComp++;
							}
						}
					}

					//printf("\tApearance attributes:\n");
					//printf("\t\tId: %s \n\t\tEmissive: %s \n\t\tAmbient: %s\n", id.c_str(), emissiveS.c_str(), ambientS.c_str());
					//printf("\t\tDiffuse: %s \n\t\tSpecular: %s \n\t\tTextureRef: %s \n\t\tShininess: %f\n", diffuseS.c_str(), specularS.c_str(), textureref.c_str(), shininess);
					if(textureref.length()==0){}
						//printf("\t\tTexLength S: %f \n\t\tTexLength T: %f\n", texlength_s, texlength_t);

					scene->appearancesComp.push_back(ap);

			}
			else
				printf("Error parsing Appearance Element\n");

			appearanceElement = appearanceElement->NextSiblingElement();

		}
	}

	//--------- Graph Parsing -----------
开发者ID:,项目名称:,代码行数:67,代码来源:


注:本文中的Appearance::setTextureWrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。