示例#1
0
void LightWidget::onLightTypeChanged(int index)
{
	if(bEditNotify == false)
		return;

	Light* pLight = (Light*)component_;
	if(pLight)
	{
		if(index >= 0)
		{
			pLight->SetLightType(LightType(index));
		}
	}
}
	inline uint32_t doFillShaderShadowMaps( RenderPipeline & pipeline
		, ShadowMapLightTypeArray & shadowMaps
		, uint32_t & index )
	{
		if ( getShadowType( pipeline.getFlags().m_sceneFlags ) != ShadowType::eNone )
		{
			for ( auto i = 0u; i < shadowMaps.size(); ++i )
			{
				auto lightType = LightType( i );
				auto layer = 0u;

				for ( auto shadowMap : shadowMaps[i] )
				{
					auto & unit = shadowMap.get().getTexture();
					unit.getTexture()->bind( index );
					unit.getSampler()->bind( index );

					switch ( lightType )
					{
					case LightType::eDirectional:
						pipeline.getDirectionalShadowMapsVariable().setValue( index++, layer++ );
						break;

					case LightType::eSpot:
						pipeline.getSpotShadowMapsVariable().setValue( index++, layer++ );
						break;

					case LightType::ePoint:
						pipeline.getPointShadowMapsVariable().setValue( index++, layer++ );
						++layer;
						break;
					}
				}
			}
		}

		return index;
	}