Esempio n. 1
0
void CausticsMapApp::LightDensityHandler(KlayGE::UISlider const & sender)
{
	float density_min = 1000.0f;
	float density_max = 20000.0f;

	int min_val, max_val;
	sender.GetRange(min_val, max_val);

	light_density_ = (static_cast<float>(sender.GetValue()) - min_val) / (max_val - min_val) * (density_max - density_min) + density_min;
}
Esempio n. 2
0
void CausticsMapApp::PointSizeHandler(KlayGE::UISlider const & sender)
{
	float pt_min = 0.01f;
	float pt_max = 0.1f;

	int min_val, max_val;
	sender.GetRange(min_val, max_val);

	point_size_ = (static_cast<float>(sender.GetValue()) - min_val) / (max_val - min_val) * (pt_max - pt_min) + pt_min;
}
Esempio n. 3
0
//UI Handler
void CausticsMapApp::RefractIndexHandler(KlayGE::UISlider const & sender)
{
	float idx_min = 1.0f;
	float idx_max = 2.0f;

	int min_val, max_val;
	sender.GetRange(min_val, max_val);

	refract_idx_ = (static_cast<float>(sender.GetValue()) - min_val) / (max_val - min_val) * (idx_max - idx_min) + idx_min;
}
Esempio n. 4
0
void DeferredRenderingApp::NumLightsChangedHandler(KlayGE::UISlider const & sender)
{
	int num_lights = sender.GetValue();

	for (size_t i = num_lights; i < particle_lights_.size(); ++ i)
	{
		particle_lights_[i]->DelFromSceneManager();
		particle_light_srcs_[i]->DelFromSceneManager();
	}

	size_t old_size = particle_lights_.size();

	particle_lights_.resize(num_lights);
	particle_light_srcs_.resize(num_lights);
	for (size_t i = old_size; i < particle_lights_.size(); ++ i)
	{
		particle_lights_[i] = MakeSharedPtr<PointLightSource>();
		particle_lights_[i]->Attrib(LightSource::LSA_NoShadow);
		particle_lights_[i]->Falloff(float3(1, 0, 1));
		particle_lights_[i]->AddToSceneManager();

		particle_light_srcs_[i] = MakeSharedPtr<SceneObjectLightSourceProxy>(particle_lights_[i]);
		checked_pointer_cast<SceneObjectLightSourceProxy>(particle_light_srcs_[i])->Scaling(0.1f, 0.1f, 0.1f);
		particle_light_srcs_[i]->AddToSceneManager();
	}

	std::wostringstream stream;
	stream << L"# lights: " << num_lights;
	dialog_->Control<UIStatic>(id_num_lights_static_)->SetText(stream.str());
}
Esempio n. 5
0
void GlobalIlluminationApp::ILScaleChangedHandler(KlayGE::UISlider const & sender)
{
    il_scale_ = sender.GetValue() / 10.0f;
    deferred_rendering_->IndirectScale(il_scale_);

    std::wostringstream stream;
    stream << L"Scale: " << il_scale_ << " x";
    dialog_->Control<UIStatic>(id_il_scale_static_)->SetText(stream.str());
}
Esempio n. 6
0
void TessellationApp::InsideChangedHandler(KlayGE::UISlider const & sender)
{
	tess_factor_.w() = sender.GetValue() / 10.0f;
	checked_pointer_cast<TriangleObject>(polygon_)->TessFactors(tess_factor_);

	std::wostringstream stream;
	stream << L"Inside: " << tess_factor_.w();
	dialog_->Control<UIStatic>(id_inside_static_)->SetText(stream.str());
}
Esempio n. 7
0
void DetailedSurfaceApp::ScaleChangedHandler(KlayGE::UISlider const & sender)
{
	height_scale_ = sender.GetValue() / 100.0f;
	checked_pointer_cast<PolygonObject>(polygon_)->HeightScale(height_scale_);

	std::wostringstream stream;
	stream << L"Scale: " << height_scale_;
	dialog_->Control<UIStatic>(id_scale_static_)->SetText(stream.str());
}
Esempio n. 8
0
void SSSSSApp::TranslucencyStrengthChangedHandler(KlayGE::UISlider const & sender)
{
	float strength = static_cast<float>(sender.GetValue());
	deferred_rendering_->TranslucencyStrength(strength);

	std::wostringstream stream;
	stream << L"Translucency strength: " << strength;
	dialog_params_->Control<UIStatic>(id_translucency_strength_static_)->SetText(stream.str());
}
Esempio n. 9
0
void SSSSSApp::SSSCorrectionChangedHandler(KlayGE::UISlider const & sender)
{
	float correction = sender.GetValue() * 0.1f;
	deferred_rendering_->SSSCorrection(correction);

	std::wostringstream stream;
	stream << L"SSS Correction: " << correction;
	dialog_params_->Control<UIStatic>(id_sss_correction_static_)->SetText(stream.str());
}
Esempio n. 10
0
void SSSSSApp::SSSStrengthChangedHandler(KlayGE::UISlider const & sender)
{
	float strength = sender.GetValue() * 0.1f;
	deferred_rendering_->SSSStrength(strength);

	std::wostringstream stream;
	stream << L"SSS strength: " << strength;
	dialog_params_->Control<UIStatic>(id_sss_strength_static_)->SetText(stream.str());
}
Esempio n. 11
0
void ScreenSpaceReflectionApp::MaxSampleNumHandler(KlayGE::UISlider const & sender)
{
	int32_t sample_num = sender.GetValue();
	if (teapot_)
	{
		checked_pointer_cast<ReflectMesh>(teapot_->GetRenderable())->MaxSamples(sample_num);

		std::wostringstream oss;
		oss << "Max Samples: " << sample_num;
		parameter_dialog_->Control<UIStatic>(id_max_sample_num_static_)->SetText(oss.str());
	}
}
Esempio n. 12
0
void ShadowCubeMap::ScaleFactorChangedHandler(KlayGE::UISlider const & sender)
{
	esm_scale_factor_ = static_cast<float>(sender.GetValue());
	for (size_t i = 0; i < scene_objs_.size(); ++ i)
	{
		checked_pointer_cast<OccluderMesh>(scene_objs_[i]->GetRenderable())->ScaleFactor(esm_scale_factor_);
	}

	std::wostringstream stream;
	stream << L"Scale Factor: " << esm_scale_factor_;
	dialog_->Control<UIStatic>(id_scale_factor_static_)->SetText(stream.str());
}
Esempio n. 13
0
void AtmosphericScatteringApp::DensityHandler(KlayGE::UISlider const & sender)
{
	float value = sender.GetValue() / 100000.0f;
	checked_pointer_cast<PlanetMesh>(planet_->GetRenderable())->Density(value);
	checked_pointer_cast<AtmosphereMesh>(atmosphere_->GetRenderable())->Density(value);
}
Esempio n. 14
0
void AtmosphericScatteringApp::AtmosphereTopHandler(KlayGE::UISlider const & sender)
{
	float value = 1 + sender.GetValue() / 1000.0f;
	checked_pointer_cast<AtmosphereMesh>(atmosphere_->GetRenderable())->AtmosphereTop(value);
}