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


C++ CLight::GetSpotExponent方法代码示例

本文整理汇总了C++中CLight::GetSpotExponent方法的典型用法代码示例。如果您正苦于以下问题:C++ CLight::GetSpotExponent方法的具体用法?C++ CLight::GetSpotExponent怎么用?C++ CLight::GetSpotExponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CLight的用法示例。


在下文中一共展示了CLight::GetSpotExponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Update

void CShader_Deferred::Update()
{
	CLight* light = GetGame()->GetRenderSystem()->GetCurLight();

	// Pass light data to shader
	GLuint lightTypeID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "lightType");
	if (lightTypeID != -1)
		glUniform1i(lightTypeID, light->GetType());

	GLuint lightDiffuseID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "lightDiffuse");
	if (lightDiffuseID != -1)
		glUniform3f(lightDiffuseID, light->GetDiffuse().x, light->GetDiffuse().y, light->GetDiffuse().z);

	GLuint lightAmbientID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "lightAmbient");
	if (lightAmbientID != -1)
		glUniform3f(lightAmbientID, light->GetAmbient().x, light->GetAmbient().y, light->GetAmbient().z);

	GLuint lightSpecularID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "lightSpecular");
	if (lightSpecularID != -1)
		glUniform3f(lightSpecularID, light->GetSpecular().x, light->GetSpecular().y, light->GetSpecular().z);

	GLuint lightPowerID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "lightPower");
	if (lightPowerID != -1)
		glUniform1f(lightPowerID, light->GetPower());

	GLuint lightPosID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "lightPos");
	if (lightPosID != -1)
		glUniform3f(lightPosID, light->GetViewSpacePos().x, light->GetViewSpacePos().y, light->GetViewSpacePos().z);

	GLuint lightAngleID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "lightAngle");
	if (lightAngleID != -1)
		glUniform3f(lightAngleID, light->GetViewSpaceAngles().x, light->GetViewSpaceAngles().y, light->GetViewSpaceAngles().z);

	// Point light data
	GLuint cAttID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "constAtt");
	if (cAttID != -1)
		glUniform1f(cAttID, light->GetConstantAtt());

	GLuint lAttID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "linAtt");
	if (lAttID != -1)
		glUniform1f(lAttID, light->GetLinearAtt());

	GLuint qAttID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "quadAtt");
	if (qAttID != -1)
		glUniform1f(qAttID, light->GetQuadraticAtt());

	GLuint spotCutoffID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "spotCosCutoff");
	if (qAttID != -1)
		glUniform1f(spotCutoffID, light->GetSpotCutoff());

	GLuint spotExpID = glGetUniformLocation(GetGame()->GetRenderSystem()->GetCurShader()->GetID(), "spotExp");
	if (qAttID != -1)
		glUniform1f(spotExpID, light->GetSpotExponent());
}
开发者ID:rrkpp,项目名称:kopengi,代码行数:54,代码来源:CShader_Deferred.cpp

示例2:

void 
Moose::Graphics::UniformLights::SetData(int index, CLight & l, COglRenderer & r )
{
  enabled[index].SetData(l.IsEnabled());
  diffuse[index].SetData(&l.GetDiffuseColor());
  ambient[index].SetData(&l.GetAmbientColor());
  specular[index].SetData(&l.GetSpecularColor());
  position[index].SetData(&l.GetPosition());
  direction[index].SetData(&l.GetDirection());
  halfVector[index].SetData((r.GetCurrentCamera()->GetPosition()-l.GetPosition()).GetNormalized());
  spotAngle[index].SetData(l.GetSpotAngle());
  spotExponent[index].SetData(l.GetSpotExponent());
  constantAttenuation[index].SetData(l.GetConstantAttenuation());
  linearAttenuation[index].SetData(l.GetLinearAttenuation());
  quadraticAttenuation[index].SetData(l.GetQuadraticAttenuation());


}
开发者ID:moose3d,项目名称:moose,代码行数:18,代码来源:MooseRenderState.cpp


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