【发布时间】:2014-04-29 04:28:42
【问题描述】:
我正在尝试在我的场景中渲染几个点光源,但无法让实际的灯光照亮。我要工作的唯一光源是一个定向灯,它最初会照亮场景:
显示两块岩石的位置与两个点光源的位置相同。我玩弄了漫反射、颜色和衰减值,但得到了相同的结果。但是当改变任何一种灯光的氛围时,颜色就会改变:
我在 GLSL 中的计算是正确的,我的制服也被正确读取。但不知何故,我失去了我的漫射强度。 m_pointLight[0].DiffuseIntensity 没有注册更改,但如果使用注释的AmbientIntensity,场景会被染成红色。
m_scale += 0.0057f;
// changing the value makes scene red
m_pointLight[0].AmbientIntensity = 0.5f;
// changing the value does nothing
m_pointLight[0].DiffuseIntensity = 1.5f;
// light color is red
m_pointLight[0].Color = glm::vec3(1.0f, 0.0f, 0.0f);
// position of light (same as rock)
m_pointLight[0].Position = glm::vec3(3.0f, 1.0f, FieldDepth * (cosf(m_scale) + 1.0f) / 2.0f);
// Light decay
m_pointLight[0].Attenuation.Linear = 0.01f;
【问题讨论】: