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


C++ PolycodeShaderModule::hasShader方法代码示例

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


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

示例1: applyMaterial

void OpenGLRenderer::applyMaterial(Material *material,  ShaderBinding *localOptions,unsigned int shaderIndex) {
	if(!material->getShader(shaderIndex) || !shadersEnabled) {
		setTexture(NULL);
		return;
	}
	
	FixedShaderBinding *fBinding;
	
	switch(material->getShader(shaderIndex)->getType()) {
		case Shader::FIXED_SHADER:
//			FixedShader *fShader = (FixedShader*)material->getShader();
			fBinding = (FixedShaderBinding*)material->getShaderBinding(shaderIndex);
			setTexture(fBinding->getDiffuseTexture());
//			setTexture(fShader->getDiffuseTexture());
		break;	
		case Shader::MODULE_SHADER:		
			currentMaterial = material;
			if(material->shaderModule == NULL) {
				for(int m=0; m < shaderModules.size(); m++) {
					PolycodeShaderModule *shaderModule = shaderModules[m];	
					if(shaderModule->hasShader(material->getShader(shaderIndex))) {
						material->shaderModule = (void*)shaderModule;
					}
				}	
			} else {
				PolycodeShaderModule *shaderModule = (PolycodeShaderModule*)material->shaderModule;
				shaderModule->applyShaderMaterial(this, material, localOptions, shaderIndex);
				currentShaderModule = shaderModule;
			}
		break;
	}
	
	setBlendingMode(material->blendingMode);
}
开发者ID:baumicon,项目名称:Polycode,代码行数:34,代码来源:PolyGLRenderer.cpp

示例2: applyMaterial

void OpenGLRenderer::applyMaterial(Material *material,  ShaderBinding *localOptions,unsigned int shaderIndex) {
	if(!material->getShader(shaderIndex) || !shadersEnabled) {
		setTexture(NULL);
		return;
	}
	

	GLfloat data4[] = {material->diffuseColor.r, material->diffuseColor.g, material->diffuseColor.b, material->diffuseColor.a};					
	glMaterialfv(GL_FRONT, GL_DIFFUSE, data4);

	data4[0] = material->specularColor.r;
	data4[1] = material->specularColor.g;
	data4[2] = material->specularColor.b;
	data4[3] = material->specularStrength;
				
	glMaterialfv(GL_FRONT, GL_SPECULAR, data4);

	glMaterialf(GL_FRONT, GL_SHININESS, material->specularValue);



	data4[0] = ambientColor.r;
	data4[1] = ambientColor.g;
	data4[2] = ambientColor.b;
	data4[3] = 1.0;
	glMaterialfv(GL_FRONT, GL_AMBIENT, data4);

	FixedShaderBinding *fBinding;
	
	switch(material->getShader(shaderIndex)->getType()) {
		case Shader::FIXED_SHADER:
//			FixedShader *fShader = (FixedShader*)material->getShader();
			fBinding = (FixedShaderBinding*)material->getShaderBinding(shaderIndex);
			setTexture(fBinding->getDiffuseTexture());
//			setTexture(fShader->getDiffuseTexture());
		break;	
		case Shader::MODULE_SHADER:		
			currentMaterial = material;
			if(material->shaderModule == NULL) {
				for(int m=0; m < shaderModules.size(); m++) {
					PolycodeShaderModule *shaderModule = shaderModules[m];	
					if(shaderModule->hasShader(material->getShader(shaderIndex))) {
						material->shaderModule = (void*)shaderModule;
					}
				}	
			} else {
				PolycodeShaderModule *shaderModule = (PolycodeShaderModule*)material->shaderModule;
				shaderModule->applyShaderMaterial(this, material, localOptions, shaderIndex);
				currentShaderModule = shaderModule;
			}
		break;
	}
}
开发者ID:meroon,项目名称:Polycode,代码行数:53,代码来源:PolyGLRenderer.cpp

示例3: applyMaterial

void Renderer::applyMaterial(Material *material,  ShaderBinding *localOptions,unsigned int shaderIndex, bool forceMaterial) {
    
    if(overrideMaterial) {
        if(!forceMaterial) {
            material = overrideMaterial;
        }
    }
    
	if(!material->getShader(shaderIndex) || !shadersEnabled) {
		setTexture(NULL);
		return;
	}
	
	FixedShaderBinding *fBinding;
    
    Shader *shader = material->getShader(shaderIndex);
	if(shader->numPointLights + shader->numSpotLights > 0) {
		sortLights();
	}
	
	switch(material->getShader(shaderIndex)->getType()) {
		case Shader::FIXED_SHADER:
			fBinding = (FixedShaderBinding*)material->getShaderBinding(shaderIndex);
			setTexture(fBinding->getDiffuseTexture());
            break;
		case Shader::MODULE_SHADER:
			currentMaterial = material;
			if(material->shaderModule == NULL) {
				for(int m=0; m < shaderModules.size(); m++) {
					PolycodeShaderModule *shaderModule = shaderModules[m];
					if(shaderModule->hasShader(material->getShader(shaderIndex))) {
						material->shaderModule = (void*)shaderModule;
					}
				}
			} else {
				PolycodeShaderModule *shaderModule = (PolycodeShaderModule*)material->shaderModule;
				shaderModule->applyShaderMaterial(this, material, localOptions, shaderIndex);
				currentShaderModule = shaderModule;
			}
            break;
	}
	
	setBlendingMode(material->blendingMode);
    setWireframePolygonMode(material->wireframe);
}
开发者ID:0x81c,项目名称:Polycode,代码行数:45,代码来源:PolyRenderer.cpp


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