Ejemplo n.º 1
0
void AtmosphericScatteringApp::LoadAbsorb(Color const & clr)
{
	RenderFactory& rf = Context::Instance().RenderFactoryInstance();

	checked_pointer_cast<PlanetMesh>(planet_->GetRenderable())->Absorb(clr);
	checked_pointer_cast<AtmosphereMesh>(atmosphere_->GetRenderable())->Absorb(clr);

	ElementFormat fmt;
	uint32_t data = 0xFF000000;
	if (rf.RenderEngineInstance().DeviceCaps().texture_format_support(EF_ABGR8))
	{
		fmt = EF_ABGR8;
		data |= clr.ABGR();
	}
	else
	{
		BOOST_ASSERT(rf.RenderEngineInstance().DeviceCaps().texture_format_support(EF_ARGB8));

		fmt = EF_ARGB8;
		data |= clr.ARGB();
	}

	ElementInitData init_data;
	init_data.data = &data;
	init_data.row_pitch = 4;
	TexturePtr tex_for_button = rf.MakeTexture2D(1, 1, 1, 1, fmt, 1, 0, EAH_GPU_Read | EAH_Immutable, &init_data);
	dialog_param_->Control<UITexButton>(id_absorb_button_)->SetTexture(tex_for_button);
}