本文整理汇总了C++中KX_LightObject::ApplyLight方法的典型用法代码示例。如果您正苦于以下问题:C++ KX_LightObject::ApplyLight方法的具体用法?C++ KX_LightObject::ApplyLight怎么用?C++ KX_LightObject::ApplyLight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KX_LightObject
的用法示例。
在下文中一共展示了KX_LightObject::ApplyLight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyLights
int GPC_RenderTools::applyLights(int objectlayer, const MT_Transform& viewmat)
{
// taken from blender source, incompatibility between Blender Object / GameObject
KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
float glviewmat[16];
unsigned int count;
std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin();
for(count=0; count<m_numgllights; count++)
glDisable((GLenum)(GL_LIGHT0+count));
viewmat.getValue(glviewmat);
glPushMatrix();
glLoadMatrixf(glviewmat);
for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit)
{
RAS_LightObject* lightdata = (*lit);
KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
if(kxlight->ApplyLight(kxscene, objectlayer, count))
count++;
}
glPopMatrix();
return count;
}
示例2: ProcessLighting
void RAS_OpenGLRasterizer::ProcessLighting(bool uselights, const MT_Transform& viewmat)
{
bool enable = false;
int layer= -1;
/* find the layer */
if (uselights) {
if (m_clientobject)
layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer();
}
/* avoid state switching */
if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
return;
m_lastlightlayer = layer;
m_lastauxinfo = m_auxilaryClientInfo;
/* enable/disable lights as needed */
if (layer >= 0) {
//enable = ApplyLights(layer, viewmat);
// taken from blender source, incompatibility between Blender Object / GameObject
KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
float glviewmat[16];
unsigned int count;
std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin();
for (count=0; count<m_numgllights; count++)
glDisable((GLenum)(GL_LIGHT0+count));
viewmat.getValue(glviewmat);
glPushMatrix();
glLoadMatrixf(glviewmat);
for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit)
{
RAS_LightObject* lightdata = (*lit);
KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
if (kxlight->ApplyLight(kxscene, layer, count))
count++;
}
glPopMatrix();
enable = count > 0;
}
if (enable)
EnableOpenGLLights();
else
DisableOpenGLLights();
}