Beispiel #1
0
void ObjectViewerView::OnChangeGeoSphereStyle()
{
	SBody sbody;

	const fixed volatileGas = fixed(65536.0*atof(m_sbodyVolatileGas->GetText().c_str()), 65536);
	const fixed volatileLiquid = fixed(65536.0*atof(m_sbodyVolatileLiquid->GetText().c_str()), 65536);
	const fixed volatileIces = fixed(65536.0*atof(m_sbodyVolatileIces->GetText().c_str()), 65536);
	const fixed life = fixed(65536.0*atof(m_sbodyLife->GetText().c_str()), 65536);
	const fixed volcanicity = fixed(65536.0*atof(m_sbodyVolcanicity->GetText().c_str()), 65536);
	const fixed metallicity = fixed(65536.0*atof(m_sbodyMetallicity->GetText().c_str()), 65536);
	const fixed mass = fixed(65536.0*atof(m_sbodyMass->GetText().c_str()), 65536);
	const fixed radius = fixed(65536.0*atof(m_sbodyRadius->GetText().c_str()), 65536);

	sbody.parent = 0;
	sbody.name = "Test";
	/* These should be the only SBody attributes GeoSphereStyle uses */
	sbody.type = SBody::TYPE_PLANET_TERRESTRIAL;
	sbody.seed = atoi(m_sbodySeed->GetText().c_str());
	sbody.radius = radius;
	sbody.mass = mass;
	sbody.averageTemp = 273;
	sbody.m_metallicity = metallicity;
	sbody.m_volatileGas = volatileGas;
	sbody.m_volatileLiquid = volatileLiquid;
	sbody.m_volatileIces = volatileIces;
	sbody.m_volcanicity = volcanicity;
	sbody.m_life = life;
	sbody.heightMapFilename = 0;

	Body *body = Pi::player->GetNavTarget();
	if (body->IsType(Object::PLANET)) {
		Planet *planet = static_cast<Planet*>(body);
		GeoSphere *gs = planet->GetGeoSphere();
		gs->m_style = GeoSphereStyle(&sbody);
		// force rebuild
		gs->OnChangeDetailLevel();
	}
}