本文整理汇总了C++中PointLight::GetLinear方法的典型用法代码示例。如果您正苦于以下问题:C++ PointLight::GetLinear方法的具体用法?C++ PointLight::GetLinear怎么用?C++ PointLight::GetLinear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointLight
的用法示例。
在下文中一共展示了PointLight::GetLinear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Use
void BaseLightShaderModule::Use(Mesh* mesh, mat4 toWorldTransform, Camera* camera)
{
float specularPower = BaseLight::GetSpecularPower();
float specularIntensity = BaseLight::GetSpecularIntensity();
glUniform1f(_specularPowerLocation, specularPower);
glUniform1f(_specularIntensityLocation, specularIntensity);
vec3 eyePos = camera->GetPositionInWorld();
glUniform3f(_eyeWorldPosLocation, eyePos.x, eyePos.y, eyePos.z);
DirectionLight* dirLight = Director::GetInstance()->GetCurrentTree()->_directionLight;
if (dirLight)
{
glUniform3f(_dirLightUniformLocation.color, dirLight->GetColor().r, dirLight->GetColor().g, dirLight->GetColor().b);
glUniform1f(_dirLightUniformLocation.ambientIntensity, dirLight->GetAmbientIntensity());
glUniform1f(_dirLightUniformLocation.diffuseIntensity, dirLight->GetDiffuseIntensity());
vec3 direction = dirLight->GetDirection();
direction = glm::normalize(direction);
glUniform3f(_dirLightUniformLocation.direction, direction.x, direction.y, direction.z);
}
vector<PointLight*>& pointLights = Director::GetInstance()->GetCurrentTree()->_pointLights;
glUniform1i(_pointLightsNumLocation, pointLights.size());
for (int i = 0; i < pointLights.size(); i++)
{
PointLight* light = pointLights[i];
tPointLightLocation& loc = _pointLightsLocation[i];
glUniform3f(loc.color, light->GetColor().r, light->GetColor().g, light->GetColor().b);
glUniform1f(loc.ambientIntensity, light->GetAmbientIntensity());
glUniform1f(loc.diffuseIntensity, light->GetDiffuseIntensity());
vec3 lightWorldPos = light->GetPositionInWorld();
glUniform3f(loc.worldPos, lightWorldPos.x, lightWorldPos.y, lightWorldPos.z);
glUniform1f(loc.constant, light->GetConstant());
glUniform1f(loc.linear, light->GetLinear());
glUniform1f(loc.exp, light->GetExp());
}
vector<SpotLight*>& spotLights = Director::GetInstance()->GetCurrentTree()->_spotLights;
glUniform1i(_spotLightsNumLocation, spotLights.size());
for (int i = 0; i < spotLights.size(); i++)
{
SpotLight* light = spotLights[i];
tSpotLightLocation& loc = _spotLightsLocation[i];
glUniform3f(loc.color, light->GetColor().r, light->GetColor().g, light->GetColor().b);
glUniform1f(loc.ambientIntensity, light->GetAmbientIntensity());
glUniform1f(loc.diffuseIntensity, light->GetDiffuseIntensity());
vec3 lightWorldPos = light->GetPositionInWorld();
glUniform3f(loc.worldPos, lightWorldPos.x, lightWorldPos.y, lightWorldPos.z);
glUniform1f(loc.constant, light->GetConstant());
glUniform1f(loc.linear, light->GetLinear());
glUniform1f(loc.exp, light->GetExp());
vec3 direction = light->GetDirection();
direction = glm::normalize(direction);
glUniform3f(loc.direction, direction.x, direction.y, direction.z);
glUniform1f(loc.cutoff, light->GetCutoff());
}
glUniform1i(_openNormalMapLocation, mesh->HaveNormalMap() ? 1 : 0);
}