示例#1
0
void Space::GenBody(SystemBody *sbody, Frame *f)
{
    Body *b = 0;

    if (sbody->type != SystemBody::TYPE_GRAVPOINT) {
        if (sbody->GetSuperType() == SystemBody::SUPERTYPE_STAR) {
            Star *star = new Star(sbody);
            b = star;
        } else if ((sbody->type == SystemBody::TYPE_STARPORT_ORBITAL) ||
                   (sbody->type == SystemBody::TYPE_STARPORT_SURFACE)) {
            SpaceStation *ss = new SpaceStation(sbody);
            b = ss;
        } else {
            Planet *planet = new Planet(sbody);
            b = planet;
        }
        b->SetLabel(sbody->name.c_str());
        b->SetPosition(vector3d(0,0,0));
        AddBody(b);
    }
    f = MakeFrameFor(sbody, b, f);

    for (std::vector<SystemBody*>::iterator i = sbody->children.begin(); i != sbody->children.end(); ++i) {
        GenBody(*i, f);
    }
}
示例#2
0
void Space::GenBody(double time, SystemBody* sbody, Frame* f)
{
	Entity e = m_entities->create();

	if (sbody->GetType() != SystemBody::TYPE_GRAVPOINT) {
		if (sbody->GetSuperType() == SystemBody::SUPERTYPE_STAR) {
			CreateStar(e, sbody);
		} else if ((sbody->GetType() == SystemBody::TYPE_STARPORT_ORBITAL) ||
		           (sbody->GetType() == SystemBody::TYPE_STARPORT_SURFACE)) {
			//SpaceStation *ss = new SpaceStation(sbody);
			//b = ss;
			return;
		} else {
			CreatePlanet(e, sbody);
		}
		e.assign<NameComponent>(sbody->GetName());
		e.assign<PosOrientComponent>(vector3d(0.0), matrix3x3d(1.0));
	}
	f = MakeFrameFor(time, sbody, e, f);

	for (SystemBody* child : sbody->GetChildren())
		GenBody(time, child, f);
}