本文整理汇总了C++中Light::IsActive方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::IsActive方法的具体用法?C++ Light::IsActive怎么用?C++ Light::IsActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::IsActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void TextureLitMaterial::render(GameObject* pGameObject, Camera* pCamera) {
if (!_diffuseTexture) return;
_shader->use();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, _diffuseTexture->getId());
glUniform1i (_diffMapLoc, 0);
glUniform1f(_diffuseTilingLoc, _diffuseTiling);
if (normalMap) {
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, _normalMapTexture->getId());
glUniform1i (_normalMapLoc, 1);
glUniform1f(_normalTilingLoc, _normalTiling);
}
if (specularMap) {
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, _specularMapTexture->getId());
glUniform1i (_specMapLoc, 2);
glUniform1f(_specularTilingLoc, _specularTiling);
}
if (Renderer::getShadowDepthMapFar()) {
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, Renderer::getShadowDepthMapFar());
glUniform1i (_depthMapLocFar, 3);
}
if (Renderer::getShadowDepthMapFar()) {
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, Renderer::getShadowDepthMapNear());
glUniform1i (_depthMapLocNear, 4);
}
if (Renderer::getShadowDepthMapMid()) {
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_2D, Renderer::getShadowDepthMapMid());
glUniform1i (_depthMapLocMid, 5);
}
glUniform1f(_matSmoothLoc, _smoothness);
glUniform1f(_matShineLoc, _shininess);
glUniform1f(_matAmbLoc, _ambient);
glUniform1f(_hasNormMapLoc, normalMap);
glUniform1f(_hasSpecMapLoc, specularMap);
//pass in light data
int index = 0;
DualLinkList<Light> list = Light::GetLightList();
DualLinkNode<Light>* cn = list.startNode;
//GLfloat near_plane = 1.0f, far_plane = 25.0f;
while(cn!=NULL && index < MGE_MAX_LIGHTS)
{
Light* light = (Light*)cn;
if(!light->IsActive())//do not render with inactive lights
{
cn = cn->nextNode;
continue;
}
string indexString ="LightArray[" + std::to_string(index) + "]";
GLuint loc;
int lightType = light->getType();
if (lightType == MGE_LIGHT_DIRECTIONAL)
{
loc = _shader->getUniformLocation(indexString + ".type");
glUniform1i(loc,lightType);
loc = _shader->getUniformLocation(indexString + ".color");
glUniform3fv(loc,1,glm::value_ptr(light->getColor()));
loc = _shader->getUniformLocation(indexString + ".direction");
glUniform3fv(loc,1,glm::value_ptr(light->getDirection()));
//loc = _shader->getUniformLocation(indexString + ".position");
//glUniform3fv(loc,1,glm::value_ptr(light->getLocalPosition()));
glm::mat4 lightProjection, lightView;
lightView = Light::GetDirectionalViewMatrix();
glm::mat4 lightSpaceMatrix;
lightProjection = Renderer::GetFarShadowOrtho();
lightSpaceMatrix = lightProjection * lightView;
glUniformMatrix4fv(_lightMatLocFar, 1, GL_FALSE, glm::value_ptr(lightSpaceMatrix));
lightProjection = Renderer::GetNearShadowOrtho();
lightSpaceMatrix = lightProjection * lightView;
glUniformMatrix4fv(_lightMatLocNear, 1, GL_FALSE, glm::value_ptr(lightSpaceMatrix));
//.........这里部分代码省略.........