当前位置: 首页>>代码示例>>C++>>正文


C++ KX_LightObject::ApplyLight方法代码示例

本文整理汇总了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;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例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();
}
开发者ID:YasirArafath,项目名称:blender-git,代码行数:52,代码来源:RAS_OpenGLRasterizer.cpp


注:本文中的KX_LightObject::ApplyLight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。