本文整理汇总了C++中PointLight::apply方法的典型用法代码示例。如果您正苦于以下问题:C++ PointLight::apply方法的具体用法?C++ PointLight::apply怎么用?C++ PointLight::apply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointLight
的用法示例。
在下文中一共展示了PointLight::apply方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pointLightPass
void Scene::pointLightPass(RenderTarget *target)
{
if(!this->pointLights.empty ())
{
for(int i =0;i<pointLights.size ();i++)
{
ShaderProgram * shader = ShaderPool::getInstance ()->get("point_light_pass");
shader->use ();
PointLight * light = this->pointLights[i];
light->apply (shader,0);
m_quad->setShaderProgram (shader);
QMatrix4x4 m;
m.setToIdentity ();
auto camera = target->camera ();
shader->setUniformMat4v ("g_MVP_matrix",m.data ());
shader->setUniform2Float ("g_screen_size",1024,768);
shader->setUniformInteger ("g_color_map",0);
shader->setUniformInteger ("g_position_map",1);
shader->setUniformInteger ("g_normal_map",2);
shader->setUniform3Float ("g_eye_position",
camera->pos ().x(),
camera->pos ().y(),
camera->pos ().z());
m_quad->draw (true);
}
}
}
示例2: spotLightPass
void Scene::spotLightPass(RenderTarget * target)
{
if(!this->spotLights.empty ())
{
for(int i =0;i<spotLights.size ();i++)
{
PointLight * light = this->spotLights[i];
light->shadowFBO ()->BindForReading(GL_TEXTURE3);
ShaderProgram * shader = ShaderPool::getInstance ()->get("spot_light_pass");
shader->use ();
light->shadowFBO ()->applyShadowMapTexture (shader,3);
light->apply (shader,0);
m_quad->setShaderProgram (shader);
QMatrix4x4 m;
m.setToIdentity ();
auto camera = target->camera ();
shader->setUniformMat4v ("g_MVP_matrix",m.data ());
shader->setUniform2Float ("g_screen_size",1024,768);
shader->setUniformInteger ("g_color_map",0);
shader->setUniformInteger ("g_position_map",1);
shader->setUniformInteger ("g_normal_map",2);
shader->setUniform3Float ("g_eye_position",
camera->pos ().x(),
camera->pos ().y(),
camera->pos ().z());
QMatrix4x4 lightView;
lightView.setToIdentity();
lightView.lookAt(spotLights[0]->getPos(),this->spotLights[0]->getPos()+this->spotLights[0]->getDirection(),QVector3D(0,1,0));
QMatrix4x4 light_vp;
light_vp = camera->getProjection () * lightView ;
shader->setUniformMat4v ("g_light_vp_matrix",light_vp.data ());
m_quad->draw (true);
}
}
}