本文整理汇总了C++中GLSLShader::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ GLSLShader::setName方法的具体用法?C++ GLSLShader::setName怎么用?C++ GLSLShader::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLSLShader
的用法示例。
在下文中一共展示了GLSLShader::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: String
Shader *GLSLShaderModule::createShader(TiXmlNode *node) {
TiXmlNode* pChild, *pChild2, *pChild3;
GLSLProgram *vp = NULL;
GLSLProgram *fp = NULL;
GLSLShader *retShader = NULL;
for (pChild = node->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
if(strcmp(pChild->Value(), "vp") == 0) {
vp = (GLSLProgram*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_PROGRAM, String(pChild->ToElement()->Attribute("source")));
if(vp) {
for (pChild2 = pChild->FirstChild(); pChild2 != 0; pChild2 = pChild2->NextSibling()) {
if(strcmp(pChild2->Value(), "params") == 0) {
for (pChild3 = pChild2->FirstChild(); pChild3 != 0; pChild3 = pChild3->NextSibling()) {
if(strcmp(pChild3->Value(), "param") == 0) {
addParamToProgram(vp,pChild3);
}
}
}
}
}
}
if(strcmp(pChild->Value(), "fp") == 0) {
fp = (GLSLProgram*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_PROGRAM, String(pChild->ToElement()->Attribute("source")));
if(fp) {
for (pChild2 = pChild->FirstChild(); pChild2 != 0; pChild2 = pChild2->NextSibling()) {
if(strcmp(pChild2->Value(), "params") == 0) {
for (pChild3 = pChild2->FirstChild(); pChild3 != 0; pChild3 = pChild3->NextSibling()) {
if(strcmp(pChild3->Value(), "param") == 0) {
addParamToProgram(fp,pChild3);
}
}
}
}
}
}
}
if(vp != NULL && fp != NULL) {
GLSLShader *cgShader = new GLSLShader(vp,fp);
cgShader->setName(String(node->ToElement()->Attribute("name")));
retShader = cgShader;
shaders.push_back((Shader*)cgShader);
}
return retShader;
}
示例2: String
Shader *GLSLShaderModule::createShader(TiXmlNode *node) {
TiXmlNode* pChild, *pChild2, *pChild3;
GLSLProgram *vp = NULL;
GLSLProgram *fp = NULL;
GLSLShader *retShader = NULL;
std::vector<String> expectedTextures;
std::vector<ProgramParam> expectedFragmentParams;
std::vector<ProgramParam> expectedVertexParams;
TiXmlElement *nodeElement = node->ToElement();
if (!nodeElement) return NULL; // Skip comment nodes
for (pChild = node->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
TiXmlElement *pChildElement = pChild->ToElement();
if (!pChildElement) continue; // Skip comment nodes
if(strcmp(pChild->Value(), "vp") == 0) {
vp = (GLSLProgram*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_PROGRAM, String(pChildElement->Attribute("source")));
if(vp) {
for (pChild2 = pChild->FirstChild(); pChild2 != 0; pChild2 = pChild2->NextSibling()) {
if(strcmp(pChild2->Value(), "params") == 0) {
for (pChild3 = pChild2->FirstChild(); pChild3 != 0; pChild3 = pChild3->NextSibling()) {
if(strcmp(pChild3->Value(), "param") == 0) {
expectedVertexParams.push_back(addParamToProgram(vp,pChild3));
}
}
}
}
}
}
if(strcmp(pChild->Value(), "fp") == 0) {
fp = (GLSLProgram*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_PROGRAM, String(pChildElement->Attribute("source")));
if(fp) {
for (pChild2 = pChild->FirstChild(); pChild2 != 0; pChild2 = pChild2->NextSibling()) {
if(strcmp(pChild2->Value(), "params") == 0) {
for (pChild3 = pChild2->FirstChild(); pChild3 != 0; pChild3 = pChild3->NextSibling()) {
if(strcmp(pChild3->Value(), "param") == 0) {
expectedFragmentParams.push_back(addParamToProgram(fp,pChild3));
}
}
}
if(strcmp(pChild2->Value(), "textures") == 0) {
for (pChild3 = pChild2->FirstChild(); pChild3 != 0; pChild3 = pChild3->NextSibling()) {
if(strcmp(pChild3->Value(), "texture") == 0) {
TiXmlElement *texNodeElement = pChild3->ToElement();
if (texNodeElement) {
expectedTextures.push_back(String(texNodeElement->Attribute("name")));
}
}
}
}
}
}
}
}
if(vp != NULL && fp != NULL) {
GLSLShader *cgShader = new GLSLShader(vp,fp);
cgShader->setName(String(nodeElement->Attribute("name")));
cgShader->expectedTextures = expectedTextures;
cgShader->expectedVertexParams = expectedVertexParams;
cgShader->expectedFragmentParams = expectedFragmentParams;
retShader = cgShader;
shaders.push_back((Shader*)cgShader);
}
return retShader;
}