本文整理汇总了C++中Light::GetAttenuationLinear方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::GetAttenuationLinear方法的具体用法?C++ Light::GetAttenuationLinear怎么用?C++ Light::GetAttenuationLinear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::GetAttenuationLinear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateShader
void LightPass::UpdateShader(Light& light)
{
glUniform3fv(m_lightColor_u, 1, glm::value_ptr(light.GetColor()));
glUniform1f(m_lightAmbientIntencity_u,light.GetAmbientIntencity());
glUniform1f(m_lightDiffuseIntencity_u, light.GetIntencity());
glUniform1f(m_constantAttenuation_u, light.GetAttenuationConstant());
glUniform1f(m_linearAttenuation_u, light.GetAttenuationLinear());
glUniform1f(m_expAttenuation_u, light.GetAttenuationExp());
glUniform1f(m_expAttenuation_u, light.GetAttenuationExp());
glUniform3fv(m_position_u, 1, glm::value_ptr((glm::vec3)(light.GetBoundingSphere()->transform.position)));
}
示例2: main
int main(){
try{
ILogger::Init();
Settings::Call().Parse();
ResourceManager::Call().AddPath("Data/shaders", "Shader");
ResourceManager::Call().AddPath("Data/textures", "Image");
{
Window myWindow;
Image Crate;
Texture CrateTexture;
Text FPSText, MousePosText;
Clock FrameClock, FpsClock;
Input myInput;
myInput.Init(myWindow);
Renderer& myRenderer = Renderer::Call();
myRenderer.Init(myWindow);
Crate.LoadFromFile("crate.jpg");
CrateTexture.LoadFromImage(Crate);
Light l;
l.SetPosition(Vector3F(1,3,1.5));
l.SetDiffuse(Color(1.f,1.f,1.f));
l.SetRange(8);
Shader ColorShader;
ColorShader.Compile("shaderColor.vs", "shaderColor.fs");
ColorShader.Bind();
ColorShader.SendColor("ambientColor", myRenderer.GetSpecifications().mAmbientColor);
ColorShader.SendFloat("constantAtt", l.GetAttenuationConstant());
ColorShader.SendFloat("linearAtt", l.GetAttenuationLinear());
ColorShader.SendFloat("quadraticAtt", l.GetAttenuationQuadratic());
ColorShader.SendFloat("range", l.GetRange());
ColorShader.SendVector3("lightPosition", l.GetPosition());
ColorShader.SendColor("lightColor", l.GetDiffuse());
ColorShader.UnBind();
Object obj1;
obj1.MakeCube("cube", ColorShader);
obj1.GetMaterial().mAmbient = Color(0.f, 0.08f, 0.08f);
obj1.GetMaterial().mDiffuse = Color(0.f, 0.8f, 0.8f);
obj1.GetMaterial().mSpecular = Color(0.0f, 0.5f, 0.5f);
obj1.GetMaterial().mShininess = 50.f;
Camera cam;
cam.LookAt(Vector3F(0.5f,0,1), Vector3F(-2.5f,2,4));
FPSText.SetSize(12);
FPSText.SetPosition(10,10);
MousePosText.SetSize(12);
MousePosText.SetPosition(10,22);
while(myWindow.IsOpened()){
ElapsedTime = FrameClock.GetElapsedTime();
FrameClock.Reset();
if(FpsClock.GetElapsedTime() > 1.f){
FPSText.SetText(String(1.f/ElapsedTime));
FpsClock.Reset();
}
while(myInput.GetEvent()){
if(myInput.GetEventType() == sf::Event::Closed)
myWindow.Close();
if(myInput.IsKeyHit(Space))
if(!paused){
paused = true;
FrameClock.Pause();
}else{
paused = false;
FrameClock.Resume();
}
}
MousePosText.SetText(String("X : ")+myInput.GetMouseX()+" Y : "+myInput.GetMouseY());
MousePosText.Draw();
FPSText.Draw();
obj1.Draw();
myRenderer.BeginScene(myRenderer.GetSpecifications().mAmbientColor);
myRenderer.Render();
myRenderer.EndScene();
}
}
}catch(Exception e){
std::cout << e.what() << std::endl;
system("PAUSE");
}
Renderer::Kill();
ResourceManager::Kill();
Settings::Kill();
ILogger::Kill();
//.........这里部分代码省略.........